Launching Application folders by file path

I have been searching via google and forums for the last three days - so I apologize ahead of time if this is apparent and I’ve missed something, as I’m very new to Applescript and MacOS.

I’m using Snow Leopard 10.6.2 and the pre existing AppleScript.

I am trying to call an application to launch via file path:

tell application “Applications/Microsoft Office 2004/Microsoft Word.app” to launch

It tells me it cannot find that directory

However if I use terminal:
open /Applications/Microsoft\ Office\ 2008/Microsoft\ Word.app

The application launches. However, if I use the same command for Microsoft office 2004 it tells me it cannot be located - so I find I’m having difficulty solving this problem with perhaps a quick and easy shell script to launch via Applescript (as I’ve read can be done).

The end goal is I have two versions of office on this Mac, 2004 and 2008 I need to be able to launch them all (both versions) with a script. Can this be done?

Thank you very much for your time and help,

Myst

Hi,

AppleScript works with HFS paths (colon separated)
try this


set applicationFolder to path to applications folder as text
tell application (applicationFolder & "Microsoft Office 2004:Microsoft Word") to launch

StefanK

Thank you so much for the help! I tried the script and it works perfectly. Now I need to figure out how to chain them together because if I just run

set applicationFolder to path to applications folder as text
tell application (applicationFolder & “Microsoft Office 2004:Microsoft Word”) to launch
set applicationFolder to path to applications folder as text
tell application (applicationFolder & “Microsoft Office 2008:Microsoft Word”) to launch

It tells me the second office 2008 wasn’t found.

Ultimately I want to launch both full suites at the same time (word, excel, powerpoint, entourage). Thank you!

Myst

Also - when I remove the 2004 version call to launch and just leave

set applicationFolder to path to applications folder as text
tell application (applicationFolder & "Microsoft office 2008:Microsoft Word") to launch

I get the following error:

The path name for my 08 version of Word is:

/Applications/Microsoft Office 2008

So I am not clear on how this is ‘not found’ is there something I can look for to have this make sense? Or am I missing something?

Thank you again for any guidance provided.

Myst

Not sure (I’m not on my mac right now), but I guess paths are case-sensitive.
Isn’t your last problem coming from the fact that you wrote “office” instead of “Office”?

AurelienP.

If that was it I was going to bang my head into my desk - I did check and

set applicationFolder to path to applications folder as text
tell application (applicationFolder & "Microsoft Office 2008:Microsoft Word") to launch

gave the following error still

Thank you for the input!

Looks like it should work…

You can try a more indirect route, and let Finder do the opening for you instead of launching the application directly from AS. This seems to work on my system (10.5):

tell application "Finder"
	set officepath to (path to applications folder) & "Microsoft Office 2004:Microsoft Word" as text
	open officepath
	set officepath to (path to applications folder) & "Microsoft Office 2008:Microsoft Word" as text
	open officepath
end tell

nods

Thank you very much Warhaven - the indirect route has worked and I can chain them all together to open both suites at once. Thank you so much - now I need to pick up a book and start from the beginning I think.

Thanks again!

Myst