Notifications
Clear all

[Closed] How to put a variable value in a queryBox dialog?

Hi everyone.
I’m trying to do what I’m sure it pretty simple. I just cant find any syntax examples anywhere.


exampleVar = "Fred"
queryBox "Oh my!, it seams as if (exampleVar) has been sleeping with your wife. Is this OK?" beep:false

So basically I want the querybox to pop up and say…

“Oh my!, it seams as if Fred has been sleeping with your wife. Is this OK”

How do I slip that var value in the text?
Thanks.

2 Replies
exampleVar = "Fred"
   result = queryBox ("Oh my!, it seams as if "+exampleVar as string+" has been sleeping with your wife.
Is this OK?") title:"OMG!"
   if result then format "Oh never mind!
" else format "The life of the wife was ended by the knife...
"

In this particular case, the ‘as string’ is not even needed, but if exampleVar happens to be anything but string, like a floating point number, an array or, God forbid, a Capsule primitive (you really don’t want your wife sleeping with that primitive! ) , it would take care of the conversion…

Thanks for the help.
Much appreciated.