Problem with POSIX paths?
Problem with POSIX paths?
- Subject: Problem with POSIX paths?
- From: Dave <email@hidden>
- Date: Wed, 15 Jun 2016 14:58:18 +0100
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
_______________________________________________
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