Passing parameters to a stack at start up

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
edgore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 197
Joined: Wed Jun 14, 2006 8:40 pm

Passing parameters to a stack at start up

Post by edgore » Thu Apr 24, 2008 9:54 pm

I got the idea that it was possible to pass info to a stack at startup from a post here, though it was talking about the Mac. I am trying to do the same thing on Windows.

Right now I have the following script at the stack level:

on startup chParam
if is not empty then
put it into card field "ch#field" of card 1
end if
end startup

I am running the application as foldermaker /ch1234567

I was hoping that this would cause "ch1234567" to magically appear in card field "ch#field" of card 1, but apparently it's doesn't and I don't know what I am doing wrong...

Any help much appreciated.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5132
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Apr 24, 2008 10:37 pm

Hi Edgore,

Unless it is a file path, I am not sure that it is a good idea to start a parameter with a slash. I am not sure what Revolution does with it. Of course, you can test this and make sure that it is alright to do this.

It might be good to use quotes around the string, to make sure that the entire string is in one parameter.

If you run your programme from the command line as

foldermaker ch1234567

the string ch1234567 should be in the variable $1. You might want to check the keyword "$" in the docs. Your script could look like:

Code: Select all

on startup
  if $1 is not empty then
    put $1 into card field "ch field" of card 1
  end if
end startup
The "#" in the field name is confusing to me. I never understand why people must use DOS/UNIX-like names in a natural programming language.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

edgore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 197
Joined: Wed Jun 14, 2006 8:40 pm

Post by edgore » Mon Apr 28, 2008 9:02 pm

That did it - thanks!

On the field name, the field contains a change number from another system (that's the param I was trying to pass), and I am still in the habit of using symbols...bad habit, I know.

Post Reply

Return to “Windows”