Code gives different results in my xcode project

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

I just tried this and got the same result in Script Editor as I got in XCode.

Is there more to your script that could be changing the value of the variable?

Model: PowerPC G5 Tower
AppleScript: XCode 2.5
Browser: Safari 419.3
Operating System: Mac OS X (10.4)