How to pass a command line parameter to a windows standalone

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
rearview
Posts: 4
Joined: Thu Mar 31, 2011 8:49 pm

How to pass a command line parameter to a windows standalone

Post by rearview » Mon May 23, 2011 6:03 pm

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

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus » Mon May 23, 2011 6:25 pm

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

rearview
Posts: 4
Joined: Thu Mar 31, 2011 8:49 pm

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

Post by rearview » Mon May 23, 2011 8:42 pm

Klaus,
I love it!
Spent about 90 minutes missing the obvious :o
Works like a charm now.

Thanks Shane

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

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

Post by mwieder » Tue May 24, 2011 7:47 pm

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.

Post Reply