Hi Bidge,
in the stack you posted the button Search has this script:
Code: Select all
on mouseUp
ask "Name of button"
put it into tFeedback
answer seekButton("ButtonName","CardNameOrNumber")
end mouseUp
This can not work. You first create a variable 'tFeedback', this variable holds the name of the button you are looking for. but when you call the function with seekButton("ButtonName","CardNameOrNumber")
you put "ButtonName" into quotes. That tell rev to treat this as a literal. That means just the word ButtonName. Even if you had a variable ButtonName the function would not pass the content of the variable, only the word ButtonName,
If you would put
Code: Select all
seekButton(tFeedback,"CardNameOrNumber")
that would work for the button name, still leaves the CardNameOrNumber. Here the same, you just pass the word without any content to the function. You could put
Code: Select all
on mouseUp
ask "Name of button"
put it into tFeedback
put the name of this card into tCardName
answer seekButton(tFeedback,tCardName)
end mouseUp
into your button. You would additionally fill the variable tCardName with the name of the card this is on and pass it as a variable (not literal word) to the function. This works.
Please Bidge, get this sorted out what is a variable and a literal.
For example the name of a field is a literal just the word so you put it into quotes to indicate to Rev: look no further this is just the word and not the name of a variable. In Rev you should always quote a word, but you can never quote a variable name.
It is very important to make that distinction.
To confuse you a bit: This is how Rev looks at it: Rev finds a word it does not know. It looks around whether there is a variable of that name. If Rev does not find a variable of that name it treats it as a literal. That is the reason why you can get away with a literal without quoting it. BUT I strongly discourage this approach because sooner or later you dont remember if you had a variabel of the same name and you want to take that name for a literal and bang, you have a hard time to figure out why the script does not work.
So: literals -> always quote
variables -> you can not quote without making them literals and defying the purpose of a variable.
regards
Bernd