Saturday, December 20, 2014

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

Mark Munro
Member
Registered: 2008-01-16
Posts: 167
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

[ Generated in 0.036 seconds, 11 queries executed ]

RSS (new topics) RSS (active topics)