Page 1 of 1

How to pass a command line parameter to a windows standalone

Posted: Mon May 23, 2011 6:03 pm
by rearview
Hi All,
I must be missing something here.
Having problems creating a windows standalone that will read the parameters passed at time of execution.

For example... using a LiveCode standalone named para.exe the command line would simply be something like
c:\para.exe byteme

Code: Select all

on preOpenScript
put $1 into field "fName"
end preOpenScript
I would expect the word "byteme" to be displayed in the field named "fName"
I am sure that I am just getting frustrated and missing the obvious but i cant find the answer.

Thanks in advance - Shane

Re: How to pass a command line parameter to a windows standalone

Posted: Mon May 23, 2011 6:25 pm
by Klaus
Hi Shane,

there is no message/handler "preopenscript"!

I have few experience with this, but try "preopenstack" in your mainstack script:
on preopenstack
put $1 into field "fName" of cd 1
## Important to pass a descriptor for that field!
...
end preopenstack


Best

Klaus

Re: How to pass a command line parameter to a windows standalone

Posted: Mon May 23, 2011 8:42 pm
by rearview
Klaus,
I love it!
Spent about 90 minutes missing the obvious :o
Works like a charm now.

Thanks Shane

Re: How to pass a command line parameter to a windows standalone

Posted: Tue May 24, 2011 7:47 pm
by mwieder
Shane- ...and a caveat that if you're going to be passing -options to the standalone from a command line, note that there are some that the engine itself will eat. Run "livecode -h" to get a list.

Update: I forgot you're running Windows. Never mind. You can get the list if you use other operating systems.