The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 wcopy and workbook scripts
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

DataConv

Germany
60 Posts

Posted - 09/10/2010 :  04:27:14 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.1G SR3
Operating System: XP Pro SP3

When applying the wcopy command, one can make a full copy of a sheet. That is nice. To copy only the formats without data, the option c:=0 can be applied. oK.
But: I want to make a copy of a sheet (w/o data) - but without copying the worksheet script attached to the origin sheet! Best solution would be keeping the script in the target sheet... Is there an option or way to do so?
BTW:
* the wcopy command copies the attached script - but not the conditions for execution - so it's a bit inconsistent, luckily...
* If a sheet is copied manually within a book (using 'Duplicate') - then everything is copied. E.g. the script plus conditions. This should be kept for future...

Penn

China
644 Posts

Posted - 09/14/2010 :  02:55:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Does the attached script mean the script in Script Panel (show by selecting item Show Script Panel from the right-click menu of the workbook title bar)? If so, the wcopy X-Function cannot copy these script when the output worksheet is not in the current workbook. That is because these scripts are attached to the workbook, but not the worksheet, and wcopy is used to create a copy of worksheet, not workbook.

If the attached script means the script in the Set Column Values, a parameter option keep in wcopy can be used to decide whether or not to keep the column formula.

Penn
Go to Top of Page

DataConv

Germany
60 Posts

Posted - 09/14/2010 :  02:59:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Penn for the response.
But no, I mean another script: If you have an active worksheet, you can attach a script to a sheet using the main menu bar: worksheet / worksheet script. I mean this one...
Go to Top of Page

Penn

China
644 Posts

Posted - 09/14/2010 :  05:51:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I have tried and found that the scripts in Worksheet Script window all were copied to the target worksheet, together with the status of the check-box. You have mentioned that wcopy command would copy the attached script, but not the conditions for execution. Could you explain what conditions? It will be better to provide some steps or screen shots.

By the way, we will consider to adding option for controlling this. Thank you for your suggestion.

Penn
Go to Top of Page

DataConv

Germany
60 Posts

Posted - 09/14/2010 :  06:45:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I have to correct myself concerning the script option copy. I did a small test by myself and found the reason. Ok, here we go:
This is the starting point:

Then the workbook script with condition 'Execution when a value of the second column is changed':
aa$ = page.name$;
type Processing workbook %(aa$);
if (aa$ == "Book2") {type Double execution!; break;};
type Start workbook copying...;
wcopy [Book1]1! [Book2]1! a:=0;
type Copying finished!;


Note the entry part of the script. You have to check, whether the copied workbook/sheet is processed. Alternatively, one could delete the new created sheet at the end of the script.
NOT DOING SO RESULTS IN A CRASH OF ORIGIN!!!
That is what the script window responds:

As can be seen, the script is executed a second time. If it was not halted, Origin would crash because the sheet processed would be overwritten by the wcopy command.
And the final result looks like this:

Note that although the activate option is set to zero, the target book/sheet is activated. Probably due to the execution of the script...

Therefore it would really make sense to implement a switch controlling the script copy as you suggested. Suppressing the condition check while script execution on the other hand seem to me NO solution, since this restricts program variability too much (conditionally chained script execution - you can program really nice things with that!).

Edited by - DataConv on 09/14/2010 06:48:42 AM
Go to Top of Page

Penn

China
644 Posts

Posted - 09/15/2010 :  9:23:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I see what the problem is now. We will add option to handle with this issue in the future version. Thank you for reporting this.

Penn
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000