Ken Apthorpe wrote:
(I don't have a helpful working version, so can't include one here ....
but I can tell you where you started to go wrong ....)
Hi anyone
SHORT VERSION (immediate problem)
Created my first menu, using menu builder and autoscript. Ungrouped to look
at scripts. File menu has Exit, divider and Quit (for Mac shift). Script
is:
--The following menuPick handler was generated by the Menu Builder.
on menuPick pWhich
switch pWhich
case "Exit"
--Insert script for Exit menu item here
break
case "Quit"
--Insert script for Quit menu item here
break
end switch
end menuPick
After exploration to discover an Exit/Quit script, my script is:
on menuPick pWhich
switch pWhich
case "Exit"
on "Exit" answer "Are you sure you want to exit?" with "Yes" or "OK"
if it is "OK" then quit
end "Exit"
break
case "Quit"
on "Quit" answer "Are you sure you want to quit?" with "Cancel Quit" or
"OK"
if it is "OK" then quit
end "Quit"
break
end switch
end menuPick
You don't need (in fact, MUST NOT have) the 'end "Exit"', or 'end
"Quit"' lines in there. There is no 'end' statement after each part of
the switch structure.
So the 'end "Exit"' statement is being taken as an attempt to end the
handler - i.e. to match with the "on menuPick". That's why the error
hint is 'on'
Error window says error, hint "on".
This, and all subsequent errors, are variants of that.
A good hint is to use the TAB key in the editor, to get the script to be
automatically properly indented. This will help you check that the
various control structures are properly matching up - mismatching
if-then-else or switch-end switch can lead to confusing error messages.
LONG VERSION (working example of newbie problem)
First question is what does pWhich mean?
it's a parameter name - so it could have been anything.
It's a convention to start parameters names with 'p' to help you
remember that it is a parameter to the handler/function, and to name it
helpfully. So pWhich is the parameter telling you which menu has been
picked.
-- Alex.
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17/02/2006
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution