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

Re: Problem with POSIX paths?


  • Subject: Re: Problem with POSIX paths?
  • From: Dave <email@hidden>
  • Date: Thu, 16 Jun 2016 10:30:48 +0100

Hi Again Yvan,

Thanks for taking the time to help out.

I copied the script into Script Editor, but when I run it I got errors. I changed to what I thought the code should be (copied below) and it now runs ok, but none of the following return the document. From the Log:

tell application "Microsoft Word"
	activate
	get every document whose full name = "JaundicedOutlook:Users:Excession:Desktop:TestDocs:Word-Test1.docx"
	(*missing value*)

	get every document whose full name = "JaundicedOutlook:Users:Excession:Desktop:TestDocs:Word-Test1.docx"
	(*missing value*)

	get every document whose full name = "JaundicedOutlook:Users:Excession:Desktop:TestDocs:Word-Test1.docx"
	(*missing value*)

	get every document whose full name = "/Users/Excession/Desktop/TestDocs/Word-Test1.docx"
	(*missing value*)
end tell

I’m not sure if my changes are correct or not?

All the Best
Dave

———————————————————————————————————————————————————

set myDocument to choose file of type {"Doc", "Docx"}

# Initial value is a «class furl» object. Two esay schemes are available
# Scheme 1
tell application "System Events"
	set myDocumentID to path of myDocument
	log myDocumentID
	(*SSD 500:Users:yvankoenig:Desktop:Sans titre.docx*)
end tell
# Scheme 2 (alternate)
set myDocumentIDAlt to myDocument as text
log myDocumentIDAlt
(*SSD 500:Users:yvankoenig:Desktop:Sans titre.docx*)

log myDocumentID & return & myDocumentIDAlt
(*SSD 500:Users:yvankoenig:Desktop:Sans titre.docx
SSD 500:Users:yvankoenig:Desktop:Sans titre.docx*)

set myPosixPath to POSIX path of myDocument

# If the initial value is a POSIX path (we just buitlt one.
# Scheme 1bis

tell application "System Events"
	set myDocumentIDfromPosix to path of disk item myPosixPath  —****************************CHANGED
	log myDocumentIDfromPosix
	(*SSD 500:Users:yvankoenig:Desktop:Sans titre.docx*)
end tell

# Scheme 2bis (alternate)
set myDocumentIDAltFromPosix to myPosixPath as text  --*********************************** CHANGED
log myDocumentIDAltFromPosix
(*/Users/yvankoenig/Desktop/Sans titre.docx*)
log myDocumentID & return & myDocumentIDAlt
(*SSD 500:Users:yvankoenig:Desktop:Sans titre.docx
/Users/yvankoenig/Desktop/Sans titre.docx*)
# I don't know if the second result is OK for Word


tell application id "com.microsoft.Word"
	activate									--*********************************** CHANGED

	set myDocumentList1 to (every document whose full name is myDocumentID)
	log myDocumentList1
	set myDocumentList2 to (every document whose full name is myDocumentIDAlt)
	log myDocumentList2
	set myDocumentList3 to (every document whose full name is myDocumentIDfromPosix)
	log myDocumentList3
	set myDocumentList4 to (every document whose full name is myDocumentIDAltFromPosix)
	log myDocumentList4
end tell



 _______________________________________________
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? SOLVED
      • From: Dave <email@hidden>
    • Re: Problem with POSIX paths?
      • From: Yvan KOENIG <email@hidden>
References: 
 >Problem with POSIX paths? (From: Dave <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: Problem with POSIX paths?
  • Next by thread: Re: Problem with POSIX paths?
  • Index(es):
    • Date
    • Thread