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
 passing arguments to labtalk function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Flavs

Spain
Posts

Posted - 08/29/2006 :  2:12:27 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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)?

Hideo Fujii

USA
1582 Posts

Posted - 08/29/2006 :  4:59:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page

Flavs

Spain
Posts

Posted - 09/07/2006 :  10:20:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, that worked well!!
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