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.
Passing parameters to a stack at start up
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
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:
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
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
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode