Page 1 of 1

Passing parameters to a stack at start up

Posted: Thu Apr 24, 2008 9:54 pm
by edgore
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.

Posted: Thu Apr 24, 2008 10:37 pm
by Mark
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

Posted: Mon Apr 28, 2008 9:02 pm
by edgore
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.