Files, Folders and Paths
Files, Folders and Paths
- Subject: Files, Folders and Paths
- From: Gil Dawson via AppleScript-Users <email@hidden>
- Date: Tue, 9 May 2023 10:37:56 -0700
I've been reviewing Apple's documentation
<https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/ReferenceFilesandFolders.html>
on files, folders, paths and such. Several examples surprised me. Here is
one:
Converting a Path to an Alias
The handler in Listing 15-19 converts strings, path objects, POSIX file
objects, Finder paths, and System Events paths to alias format.
Listing 15-19AppleScript: Handler that converts a path to an AppleScript alias
on convertPathToAlias(thePath)
tell application "System Events"
try
return (path of disk item (thePath as string)) as alias
on error
return (path of disk item (path of thePath) as string)
as alias
end try
end tell
end convertPathToAlias
Under what conditions would the first try fail, but the second one succeed?
--Gil
_______________________________________________
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