I work at a edu. facility. and I need to make a applescript that check the size of the users “home” folder at login. I have tried with the following script. I run it from the login items in the system pref. But something is wrong, can you please help…
try
tell application “Finder”
activate
set username to name of home
set using to round ((physical size of home) / 1024 / 1024)
tell application “Finder”
if using > “4000” then
display dialog ("Hey… " & username & " You use too much diskspace! You use " & using & “MB your quota are 4000MB”) with icon stop buttons (“ok”)
else
display dialog “welcome”
end if
end tell
No great differences… It is calling two “standard additions”’ commands: “path to” and “info for”.
Actually I prefer this mode because I’ve been having some problems with the Finder and I like avoid “tell” blocks allways I can… But your version works also fine:
tell application "Finder" to set using to round ((physical size of home) / 1024 / 1024)
if using > 4000 then --> compare number better than string
display dialog "Hey!"
else
display dialog "Hi!"
end if