• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Targetting a specific Word version
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Targetting a specific Word version


  • Subject: Re: Targetting a specific Word version
  • From: Sjur Moshagen <email@hidden>
  • Date: Thu, 29 May 2008 12:46:16 +0300

Den 28. mai. 2008 kl. 18.04 skrev email@hidden:

At 6:01 PM +0300 5/28/08, Sjur Moshagen wrote:
Hello,

I have both MS Office 2004 and Office 2008 installed on my Mac, and need to programmatically target one of the Word applications in a tell statement, but have so far not been able to find a working solution.
...

I think you can just use the app's path, tell application "Macintosh HD:Applications:etc:Microsoft Word" etc. Maybe you have to explicitly write the ".app" suffix whenever it makes sense.

Thanks - that helped:)

The following code works fine:

on run
tell application "Macintosh HD:Applications:Microsoft Office 2004:Microsoft Word"
set MSWordVersion2004 to application version
end tell
tell application "Macintosh HD:Applications:Microsoft Office 2008:Microsoft Word.app"
set MSWordVersion2008 to application version
end tell
display dialog "MSWord 2004 version:" & MSWordVersion2004 & return & return & "MSWord 2008 version: " & MSWordVersion2008 & return & return & Word2004
end run


Now, if I replace the string with a variable, like "tell application TheRequestedWordVersion ...", to cater for different names of the startup disk, it does NOT work anymore:(

I have tried something like:

on run
set HDname to (path to startup disk as text)
set Word2004 to HDname & "Applications:Microsoft Office 2004:Microsoft Word" as string -- 'as string' is probably superfluous
tell application Word2004
set MSWordVersion2004 to application version
end tell
tell application "Macintosh HD:Applications:Microsoft Office 2008:Microsoft Word.app"
set MSWordVersion2008 to application version
end tell
display dialog "MSWord 2004 version:" & MSWordVersion2004 & return & return & "MSWord 2008 version: " & MSWordVersion2008 & return & return & Word2004
end run


This gives me an error saying that the variable MSWordVersion2004 is not defined. It IS, but only inside the tell block targetting the application whose pathname is given in a variable, instead of being hard-coded...

Best regards,
Sjur
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Targetting a specific Word version
      • From: email@hidden
References: 
 >Targetting a specific Word version (From: Sjur Moshagen <email@hidden>)
 >Re: Targetting a specific Word version (From: email@hidden)

  • Prev by Date: Re: as alias bug?
  • Next by Date: Create Incopy assignment
  • Previous by thread: Re: Targetting a specific Word version
  • Next by thread: Re: Targetting a specific Word version
  • Index(es):
    • Date
    • Thread