Re: Problem with POSIX paths?
Re: Problem with POSIX paths?
- Subject: Re: Problem with POSIX paths?
- From: Yvan KOENIG <email@hidden>
- Date: Wed, 15 Jun 2016 17:30:30 +0200
Hi All,
Given the following Handlers:
on getPOSIXPathWithMacPath:(theMacPath) set myFullNamePOSIX to the POSIX path of theMacPath return myFullNamePOSIX end getPOSIXPathWithMacPath:
on getMacPathWithPOSIXPath:(thePOSIXPath as text) set myMacPath to thePOSIXPath as POSIX file return myMacPath end getMacPathWithPOSIXPath:
on getActiveDocumentID() tell application id "com.microsoft.Word" set myDocument to the active document set myDocumentFullName to the full name of myDocument if myDocumentFullName does not contain ":" then return myDocumentFullName set myDocumentID to my getPOSIXPathWithMacPath:(myDocumentFullName) end tell return myDocumentID as text end getActiveDocumentID
on getWordDocumentWithDocumentID:(theDocumentID as text) if theDocumentID = missing value then return missing value
if theDocumentID does not contain "/" then tell application id "com.microsoft.Word" set myDocumentList to (every document whose name is theDocumentID) if the count of myDocumentList = 0 then return missing value end if
set myDocument to item 1 of myDocumentList return myDocument end tell end if set myDocumentID to my getMacPathWithPOSIXPath:(theDocumentID) if myDocumentID = missing value then return missing value tell application id "com.microsoft.Word" set myDocumentList to (every document whose full name is myDocumentID) 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:
The above seems to work ok with MS Office 2011, but I’m getting reports of problems in 2016. Can anyone see why the might cause a problem?
This is in an XCode project and is being called from Objective-C using AS-ObjC.
Thanks in advance.
All the Best Dave
Hello Dave
As some of you know I don't use M…soft products so I can't be sure of my thought.
What is sure is that the instruction : set posixFile to posixPath as POSIX file
doesn't return a pathname but a «class furl» object. So I wonder if your problem is that maybe Word can't deal with this kind of object. On my HD I have access to a dictionary from Word whose version is #14.2.4 which say that full name is a text object.
If it's always true I would not be surprised that the instruction : set myDocumentList to (every document whose full name is myDocumentID) fails because it compare a text object (full name) to a «class furl» one (myDocumentID).
Yvan KOENIG running El Capitan 10.11.5 in French (VALLAURIS, France) mercredi 15 juin 2016 17:30:25
|
_______________________________________________
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