AppleScript Studio and Menus

I am new to this board. Hello everyone!

I am here because I am using Applescript Studio and Leopard and find it great, while intimidating.

I have stumbled around and created an application that has menus in it. I can call the menus fine.

For example, this works:

on choose menu item theObject

if (Title of theObject is “Test Menu 1”) then
display dialog “You chose Test Menu 1”
end if

end choose menu item

All I want to do is have the user make a choice from the menu, and based on that choice, call an external script. I’m stumped. Any help with this?

on choose menu item theObject

if (Title of theObject is “Test Menu 1”) then
– What goes here to call an external script?
end if

end choose menu item

Model: Mac Pro Quad
AppleScript: 2.0
Browser: Firefox 2.0.0.13
Operating System: Mac OS X (10.5)

Boberino,

Welcome!

You already did it. The display dialog is a script, albeit a short one.

The easiest way for a larger script is to put it in a handler inside
your studio script.

if (Title of theObject is "Test Menu 1") then
     my displayMsg("Here is my message")
end if

--put this outside your "on clicked theObject" handler
on displayMsg(theMsg)
	display dialog theMsg
end displayMsg

Have you had a chance to look at the AppleScript Studio examples
under the Developer folder? There are also some good tutorials
online. Also, VTC.com has a pretty good video tutorial. It is
on the older version of AppleScript Studio but most everything
still applies.

hth,

Craig

Faster replies using “Latest MacScripter Posts” :wink:
http://scriptbuilders.net/files/latestmacscripterposts1.0.html

Thanks. I’ll check it out. :slight_smile:

Model: Mac Pro Quad
AppleScript: 2.0
Browser: Firefox 2.0.0.13
Operating System: Mac OS X (10.5)