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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 passing arguments to labtalk function

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Flavs Posted - 08/29/2006 : 2:12:27 PM
Origin Version (Select Help-->About Origin):7.5
Operating System:win xp sp2

I want to re-use some labtalk scripts. To do this I need to pass arguments to my functions. For example, suppose I have a labtalk script that copies file a to file b (where a and b are int variables), I can give a and b the values and then run the script like this

a=2
b=3
run.section(copy)

Is there any way of doing this in a direct form, like the way you do in C?
how do I pass arguments to a labtalk script(function)?

2   L A T E S T    R E P L I E S    (Newest First)
Flavs Posted - 09/07/2006 : 10:20:58 AM
Thanks, that worked well!!
Hideo Fujii Posted - 08/29/2006 : 4:59:49 PM
Hi Flavs,

You can use upto 5 arguments in the "run.section" object method. See the Programming help. The syntax is:
  run.section(fileName,sectionName[,arg1 arg2 arg3 arg4 arg5])

Note that there are no commas between arguments. When arguments are passed to a section in the script, they are refered as %1, %2, etc. They are text variables. For example, if you create a script file D:\temp\AAA.ogs that has lines:
    [mysect1]
      type -a >> %1 plus %2 is $(%1+%2);
and you enter the following in the Script window:
  run.section(D:\temp\AAA.ogs,mysect1,2 3)<ENTER>
you get:
  >> 2 plus 3 is 5

--Hideo Fujii
OriginLab


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000