• 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
Path to Document in Script Editor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Path to Document in Script Editor


  • Subject: Path to Document in Script Editor
  • From: Luther Fuller <email@hidden>
  • Date: Sat, 15 Mar 2008 16:15:43 -0500

I've just noticed that this code in Script Editor ...

	set docPath to path of (document of window 1)

returns a path of the form ...

	/Volumes/diskName/folderName1/folderName2/...

EXCEPT when folderName1 is on the startup disk.
In this case, the path returned is ...

	/folderName1/folderName2/...

Surely there is a reason for this, but I have failed to find it.
(Anyone know? bug?)

I worked-around with this code ...

	set AppleScript's text item delimiters to {"/"}
	set nameList to (text items of docPath) as list
	set AppleScript's text item delimiters to {":"}
	if (item 1 of nameList) = "Volumes" then
		set docPath to (items 3 thru -1 of nameList) as text
	else
		tell application "Finder" to (name of startup disk) as text
		set docPath to the result & nameList as text
	end if
	set docAlias to the result as alias

But is there more to this problem than I have yet seen?

_______________________________________________
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: Path to Document in Script Editor
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: 10.4.9 versus 10.4.10
  • Next by Date: Re: Path to Document in Script Editor
  • Previous by thread: Re: Search/replace
  • Next by thread: Re: Path to Document in Script Editor
  • Index(es):
    • Date
    • Thread