Hey guys, could use a little help here. Basically, what im trying to do is have a script that sends me an email whenever a file is added to the LaunchAgents or Launch Daemons folders on our workstations. I had this working all through applescript but it was using the mail.app to send the email and i can’t have that because i want it to be invisible to the user.
So what im trying to do, is have the applescript output the information to a text file rather than email, then i will write a shell script to send me an email so this whole process will be invisible to the user so it will not interrupt their work. I cannot get the output to write to the file. Hopefully you can help, here is what i have:
on adding folder items to this_folder after receiving added_items
set added_Items_List to {}
repeat with oneItem in added_items
set end of added_Items_List to name of (info for oneItem)
end repeat
set {TID, text item delimiters} to {text item delimiters, ", "}
set added_Items_List to added_Items_List as text
set text item delimiters to TID
set dateString to (current date) as string
set theBody to "These items have been added to folder " & name of (info for this_folder) & " on " & computer name of (system info) & ":" & return & return & added_Items_List as string
set outputFile to ((("/Users/david/Desktop/") as string) & "LaunchAgent_Alert.txt") as file specification
try
open for access outputFile with write permission
write theBody to outputFile as string
close access outputFile
end try
end adding folder items to
Let me know what you guys think. If you know of a way for this to send an email without using the mail.app too, that would be great, just can’t have mail opening when they are in the middle of their work.
thanks!!