Page 1 of 1

put the filename = error

Posted: Sun Feb 01, 2009 1:43 am
by Preston Shea
This button script works great:

on mouseUp
put the filename of this stack into msg
end mouseUp

but this button script produces and error:

on mouseUp
put the filename of this stack into nameToSave
end mouseUp

here's the error:
button "Answer File": compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "nameToSave", char 35

what gives?

RE: put the filename = error

Posted: Sun Feb 01, 2009 2:26 am
by gmccarthy
With the global explicitVariables set to true local variables must be explicitly declared with the local command.

Try the following:

on mouseUp
local nameToSave
put the filename of this stack into nameToSave
end mouseUp


on mouseUp
set the explicitVariables to false
put the filename of this stack into nameToSave
end mouseUp


Gerard McCarthy

Posted: Sun Feb 01, 2009 10:51 am
by bn
With the global explicitVariables set to true local variables must be explicitly declared with the local command.
What Gerard is saying is that in the preferences under 'script editor' 'strict compilation mode' is turned on.
Rev then enforces that you declare variables as Gerard showed. If you turn this option off your script compiles without the error. It is a way to protect you from typos in your script since if you misspell a variable name in a script it will alert you to it since you did not declare it. Misspelled variable names are hard to debug as a typo may be hard to detect.
Also this option forces you to enclose literals in quotes.
I don't use the 'strict compilation mode' since I am too lazy to declare all the variables, but that has a downside as noted above. I do enclose literals in quotes because it can get really messy without.
regards
Bernd

loccal variables

Posted: Sun Feb 01, 2009 1:57 pm
by Preston Shea
Thanks for the immediate rescue. I'm an old Hyper Carder who uses Revolutionn on and off. The amazing feature growth of the system leaves me dazzled.

Posted: Sun Feb 01, 2009 6:37 pm
by bn
In nova fert animus mutatas dicere formas corpora.
to which I reply
quamvis sint sub aqua, sub aqua errordicere temptant
which you could translate with a grain of salt as
although they are all under water, they throw an error (the bugs)
my oh my, what would Ovid say to that? Was he using Hypercard? Probably the random syntax generator which shipped with version .01. It allowed to randomly switch the order of subject object and verb on the fly as well as providing sophisticated interposition of relative clauses into the main clause with no discernible pattern.
regards
Bernd

:)

Posted: Sun Feb 01, 2009 9:30 pm
by Preston Shea
bn wrote:
In nova fert animus mutatas dicere formas corpora.
to which I reply
quamvis sint sub aqua, sub aqua errordicere temptant
which you could translate with a grain of salt as
although they are all under water, they throw an error (the bugs)
my oh my, what would Ovid say to that? Was he using Hypercard? Probably the random syntax generator which shipped with version .01. It allowed to randomly switch the order of subject object and verb on the fly as well as providing sophisticated interposition of relative clauses into the main clause with no discernible pattern.
regards
Bernd

:)
A bit of humanist wit and much appreciated, along with the technical help. My quote of Ovid refers to the RunRev project I have been working on for too many years, conversion of the textbook Latin Via Ovid to an interactive stack of stacks.