• 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
Re: Addressing disk problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Addressing disk problem


  • Subject: Re: Addressing disk problem
  • From: Shane Stanley <email@hidden>
  • Date: Thu, 14 May 2015 17:26:27 +1000

On 14 May 2015, at 4:45 pm, Brian Christmas <email@hidden> wrote:

I built a small app to test my code, and it worked.

FWIW, your app is likely to be much more reliable if you stop relying on the Finder for this sort of thing. It's AppleScriptObjC -- use the ObjC part:

set anNSURL to (current application's |NSURL|'s fileURLWithPath:"/Volumes")'s URLByAppendingPathComponent:serverName
set theResult to (anNSURL's checkResourceIsReachableAndReturnError:(missing value)) as boolean
if not theResult then
-- not mounted, so handle error
end if
set {theResult, theSpare} to anNSURL's getResourceValue:(reference) forKey:(current application's NSURLVolumeAvailableCapacityKey) |error|:(missing value)
if theResult as boolean then
set spareString to (current application's NSByteCountFormatter's stringFromByteCount:theSpare countStyle:(current application's NSByteCountFormatterCountStyleFile)) as text
else
-- couldn't get the value, so handle error
end if


-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Addressing disk problem (From: Brian Christmas <email@hidden>)
 >Re: Addressing disk problem (From: Shane Stanley <email@hidden>)
 >Re: Addressing disk problem (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: Addressing disk problem
  • Next by Date: Re: Spurious Messages from "email@hidden”
  • Previous by thread: Re: Addressing disk problem
  • Next by thread: Scriptability of ASObjC Cocoa applications
  • Index(es):
    • Date
    • Thread