Applescript unexpectedly runs OS9 Apps

I’m having an issue with some of my applescripts on several machines. I’m calling applications that SHOULD run in OSX, but the script will instead start up the classic environiment and launch the classic counterpart. I’ve run into this with Calculator, Stickies, and some third party apps.

Is there a way to force the OS X app to run?

Here is a small sample code:

property theApp : "" -- Name of application to be run from this dialog

set theApp to text returned of (display dialog "Type the name of the Application to run." default answer "")

tell application theApp to activate
quit

Type in “Calculator” and it will find the classic calc on my machine instead of the osx one. Any suggestions?

Hi,

There are several ways you can do this. I wouldn’t have the user enter an apps name because there is a lot of room for mistakes. You could use the standard additions’ ‘choose application’ command. For example:

set app_list to (choose application with multiple selections allowed)
repeat with this_app in app_list
tell this_app to activate
end repeat

You may want to prompt the user to press the Command key to select seperate multiple apps or the Shift key to select a range. The type of reference used here is an application reference. I think I would rather have the user select an application from a list.

EDIT: also, you may want to prompt the user to select an OSX app. There is a difference in the choose app dialog.

How else can you get a list? You could search the Applications folder. This would eliminate the classic applications that were included in the ‘choose application’ command. Then you could run an app with the Finder using the path:

tell application “Finder”
open alias “Macintosh HD:Applications:Calculator.app:”
end tell

Here, the .app extension is used only because I got the path with the ‘path to’ command but I think it’s not necessary.

I forgot what else I had to say but if you have more questions please ask.

It’s Friday!

gl,