Help With Applescript
Im having trouble making this applescript work. Im trying to get it to detect an app runing and then send an email along with quiting the app and displaying a dialog. It also does not detect apps not downloaded from the app store. Any help is greatly appreciated
Here is the script
tell (get system info)
set longName to long user name
set shortName to short user name
end tell
set badApps to {"Messages", "Safari"}
repeat
repeat with badApp in badApps
if application badApp is running then
tell applicationbadApp to quit
display dialog "The Game " & badApp & " is not allowed during school hours please report to I.T. by the end of the day. A log of your activities has also been sent to I.T." buttons {"Report To I.T."} default button 1 cancel button 1 with title "Gaming Alert" with icon stop
end if
end repeat
end repeat
repeat with badApp in badApps
if application badApp is running then
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"[" & longName & "] ,Gaming Alert", content:"[" & longName & "] has been gaming, he is to report to I.T. by the end of the day", visible:true}
tell theNewMessage
makenewto recipientat end of to recipientswith properties {address:"example@example.com"}
send
end tell
end tell
end if
end repeat
end
return 10
MacBook, Mac OS X (10.7.2), Using iTunes