# Auth: Christopher Stone { Heavy Lifting by Shane Stanley }
# dCre: 2017/03/02 11:31
# dMod: 2017/03/02 11:33
# Appl: AppleScriptObjC
# Task: Determine whether a NSURL has a valid target.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Test, @NSURL, @Valid, @Target
-------------------------------------------------------------------------------------------
use AppleScript version "2.4" -- Yosemite (10.10) or later -- I'm not sure about os versions...
use framework "Foundation"
use scripting additions
-------------------------------------------------------------------------------------------
set folderPathExisting to POSIX path of (path to downloads folder)
set folderPathNotExisting to POSIX path of (path to downloads folder) & "Nuts!"
set theNSURL to current application's |NSURL|'s fileURLWithPath:folderPathExisting
set folderPathNotExistingBool to (theNSURL's checkResourceIsReachableAndReturnError:(missing value)) as boolean
set theNSURL to current application's |NSURL|'s fileURLWithPath:folderPathNotExisting
set folderPathExistingBool to (theNSURL's checkResourceIsReachableAndReturnError:(missing value)) as boolean
-------------------------------------------------------------------------------------------