Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
rezapaz
Posted - 05/06/2008 : 1:23:32 PM Origin Version (Select Help-->About Origin): 7.5 Operating System: Vista
Hi,
I am unsing Origin now for a while, and now I need some scripting. I have the following problem: I have several Worksheets and column A of some of them should be added with 3600 and so on. How can I do that with a script? and is there a good tutorial how to learn wrting scripts?
Thanks a lot
Reza
2 L A T E S T R E P L I E S (Newest First)
rezapaz
Posted - 05/07/2008 : 11:13:35 AM thank you very much for your help
greg
Posted - 05/07/2008 : 10:33:54 AM Here is a script that asks for the magic number, then loops through all the worksheets and when it finds one with a column named 'A' asks if you want to add the magic number to it. // BEGIN SCRIPT getn (Value to add) val (Column A Adder); doc -e W { if(exist(%H_A)) { sum(%H_A); getyesno (Add to %H_A? [$(sum.min)..$(sum.max)) resp; if(resp) %H_A+=val; } } // END SCRIPT
getn (Value to add) val (Column A Adder); prompts you for a value. Could replace with val=3600;
doc -e W { .. } handles looping through all Worksheets.
if(exists(%H_A)) { .. } makes sure we only look at worksheets with a column 'A'.
sum(%H_A); gathers some statistics to help you decide.
getyesno (Add to %H_A? [$(sum.min)..$(sum.max)) resp; asks if adding should occur (and gives you a min and max value).
if(resp) %H_A+=val; does the job if you clicked Yes.
Going through the 'Overview of the LabTalk Language' book in the Programming Help : LabTalk Language Reference might be useful.