set HD to ""
set Gig to (1024 * 1024 * 1024)
tell application "Finder"
set diskList to every disk whose local volume is true
repeat with diskRef in diskList
set HD to HD & return
set {name:diskName, free space:freeSpace, capacity:totalSpace} to contents of diskRef
set usedSpace to totalSpace - freeSpace
set perc to usedSpace / totalSpace
set HD to HD & diskName & ": " & characters 1 thru 4 of ((totalSpace / Gig) as text) & " GB " & characters 1 thru 4 of ((100 * perc) as text) & "% used."
end repeat
end tell
Hello,
Any ideas why the above code returns the (correct) output of ‘MacBook Air HD: 74.2 GB 63.1% used.’ when run in script editor, but returns “MacBook Air HD: -1.7 GB 64.5% used.” when run from xcode?
Thanks for your help,
Joe