Referencing general folders without knowing disk and user names

I know how to reference files and folders using relative and absolute referencing, but I am developing a generic utility and I want to be able to save files directly on to the desktop without knowing the drive name. I know this is possible but I don’t know how it is done.

e.g. In the following script I move a folder from a relative loaction ‘sounds’ to the start up disk, but I would rather move it to the desktop without having to specify the disk name and user name.


tell application "Finder"
	activate
	move file "Test.mp3" of folder "sounds" of startup disk to startup disk
end tell

Any help would be appreciated.

Hi, TerribleToll.

The Finder has its own keyword for the current desktop:

tell application "Finder"
	activate
	move file "Test.mp3" of folder "sounds" of startup disk to desktop
end tell

Otherwise, there’s the ‘path to’ command, which can return the path to the desktop or to certain other special folders:

set desktopPath to (path to desktop as Unicode text)

tell application "Finder"
	activate
	move file "Test.mp3" of folder "sounds" of startup disk to folder desktopPath
end tell

Thanks for that - I knew it was something really straight-forward, but I couldn’t find a reference to it in any of the AppleScript documentation.

Tol