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

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


  • Follow-Ups:
    • Re: Problem with POSIX paths?
      • From: Yvan KOENIG <email@hidden>
    • Re: Problem with POSIX paths?
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: How Do I Create class HTML to put on Clipboard?
  • Next by Date: Re: Problem with POSIX paths?
  • Previous by thread: Re: How Do I Create class HTML to put on Clipboard?
  • Next by thread: Re: Problem with POSIX paths?
  • Index(es):
    • Date
    • Thread