Getting the name of Startup Volume

When you choose a folder using the AppleScript step “choose folder”, AppleScript returns

for an external drive /Volumes/theVolumeName/thePath/
for the Startup Drive /thePath/

For a Startup Drive, AppleScript strips the /Volumes/ header and the volume name from the path it returns.
Is there a different AppleScript call that returns the full path every time? Without going through a lot of contortions, is there an elegant way to build a full path every time my user chooses a folder, whether its her local drive or an external drive?

Mac Pro 2.66GHz, Mac OS X (10.4.10), 2.5GB RAM

Posted on Oct 25, 2007 12:11 PM

Reply
3 replies

Oct 25, 2007 2:07 PM in response to Al Hatch

As per the Subject, either ...

tell application "System Events" to set startup_Disk to (name of startup disk)

... or ...

tell application "Finder" to set startup_Disk to (name of startup disk)

... will return, as a string, the name of the startup drive.

---

choose folder

... returns an alias HFS+ format path of the selected folder; whether on the local or an external volume. For example -...

alias "HD1_160:Applications:"

---

(choose folder) as string

... returns, as a string, the HFS+ format path of the selected folder; whether on the local or an external volume. For example ...

"HD1_160:Applications:"

-----

Referring to - 'For a Startup Drive, AppleScript strips the /Volumes/ header and the volume name from the path it returns'. No.

UNIX identifies the boot volume, as the first '/'. On each boot volume at the root level, '/', is an invisible 'volumes' folder (directory). Inside the '/volumes/' folder are symbolic links to each attached and mounted volume.

Oct 26, 2007 12:46 PM in response to Al Hatch

Simply start your script with:

tell application "System Events"
set theStartupdisk to name of startup disk
set theUser to name of current user
end tell

To guide your script to another folder in your home directory:

set theLocation to theStartupdisk & ":" & "Users" & ":" & theUser & ":--NAME"
--or
set theLocation to theStartupdisk/Users/theUser/--Movies/Etcerea

That's all.

Good luck,
'!' Marcus.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Getting the name of Startup Volume

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.