Wednesday, December 7, 2022

Announcement

MacScripeter.net will transition to a new Discourse server soon. Watch this space for the date and time of the transition. Please expect the site to experience periods of outage during this transition. See this and this for more details.

#1 2009-04-30 12:30:24 pm

Mark Munro
Member
Registered: 2008-01-16
Posts: 175
Website

Finder: Folder Exists Error

Checking the existence of a folder named "01" returns true if there is a folder named "1". 

Example 1: String Path

Applescript:

tell application "Finder"
   set pathToSave to folder of window 1 as string
   set pathToFolder to pathToSave & "01:" as string
   return pathToFolder
   --> pathToFolder = "Macintosh HD:Users:mmunro-wtm:Desktop:TEST FOLDER:01:"
   return pathToFolder exists
   --> true
end tell

Example 2: Alias Path (this converts the "01" to "1" when converting to an alias

Applescript:

tell application "Finder"
   set pathToSave to folder of window 1 as string
   set pathToFolder to pathToSave & "01:" as string
   set pathToFolder to alias pathToFolder
   --> pathToFolder = folder "1" of folder "TEST FOLDER" of folder "Desktop" of folder "mmunro-wtm" of folder "Users" of startup disk of application "Finder"
   return pathToFolder exists
   --> true
end tell

Model: MacBook Pro
AppleScript: 2.0.1
Browser: Safari 525.27.1
Operating System: Mac OS X (10.5)


Filed under: Finder

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)