Re: Problem with POSIX paths? SOLVED
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