• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Does a NSURL Have a Valid Target
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Does a NSURL Have a Valid Target


  • Subject: Does a NSURL Have a Valid Target
  • From: Christopher Stone <email@hidden>
  • Date: Thu, 02 Mar 2017 12:47:15 -0600

Hey Folks,

Shane gave me another useful tidbit yesterday.

checkResourceIsReachableAndReturnError

-------------------------------------------------------------------------------------------
# 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

-------------------------------------------------------------------------------------------

--
Best Regards,
Chris

 _______________________________________________
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

  • Follow-Ups:
    • Re: Does a NSURL Have a Valid Target
      • From: Jim Underwood <email@hidden>
  • Prev by Date: Re: Resize and scale ID images in Photoshop
  • Next by Date: Re: Does a NSURL Have a Valid Target
  • Previous by thread: Re: Stupid Finder, or is it me?
  • Next by thread: Re: Does a NSURL Have a Valid Target
  • Index(es):
    • Date
    • Thread