• 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: Problem with POSIX paths? SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with POSIX paths? SOLVED


  • Subject: Re: Problem with POSIX paths? SOLVED
  • From: Dave <email@hidden>
  • Date: Thu, 16 Jun 2016 11:24:54 +0100

Hi Yvan,

I think I’ve solved the problem. When I looked in the Dictionary for Word 2016, I see that MS have added a "posix full name” property.

So the following works:


on getActiveDocumentID()
	tell application id "com.microsoft.Word"
		set myDocument to the active document
		if myDocument is missing value then return missing value

		set myDocumentID to the posix full name of myDocument
	end tell

	return myDocumentID as text
end getActiveDocumentID

on getWordDocumentWithDocumentID:(theDocumentID as text)
	if theDocumentID = missing value then return missing value

	tell application id "com.microsoft.Word"
		set myDocumentList to (every document whose posix full name is theDocumentID)
		if the (count of myDocumentList) = 0 then
			return missing value
		end if

		set myDocument to item 1 of myDocumentList
	end tell

	return myDocument
end getWordDocumentWithDocumentID:

on run
	tell application id "com.microsoft.Word"
		activate
	end tell

	set myDocumentID to my getActiveDocumentID()
	set myDocument to my getWordDocumentWithDocumentID:(myDocumentID)
end run


Using the new property makes it much simpler and bomb proof.

Thanks for your help on this.

All the Best
Dave


 _______________________________________________
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


References: 
 >Problem with POSIX paths? (From: Dave <email@hidden>)
 >Re: Problem with POSIX paths? (From: Yvan KOENIG <email@hidden>)
 >Re: Problem with POSIX paths? (From: Dave <email@hidden>)

  • Prev by Date: Re: Problem with POSIX paths?
  • Next by Date: Re: Problem with POSIX paths?
  • Previous by thread: Re: Problem with POSIX paths?
  • Next by thread: Script Debugger 6 Officially Released
  • Index(es):
    • Date
    • Thread