UPDATE: So far I have:
set (procs) to (do shell script "ps -c -U USER")
Replace USER with your usrname and run. It outputs what ps would output, but it only shows the processes for the user specified, which is what I want. But I need to figure out a way to strip away all the information except for the command name (in the far right column).
I want to write a script for school exams. This is what it is going to do:
- When run, the script gets a list of currently running processes and stores them in memory.
- Preiodically, the script gets a new list of currently running processes and checks them against those in memory. If it finds new proccesses, it checks them against a list that is has stored in the actual script of programs that can be opened. If the new proccesses do not match up with the list of permitted applications, the program does something (maybe send a message to the administrator over ARD or something).
I’m not worrying about what the program does when it finds a new application that’s not on the list has been opened. I just don’t know how to do two things:
- Get a list of currently running processes (is there a way to output the terminal command ps to applescript’s memory?
- Take the list of processes and turn them into an array that can be compared to another array to looke for changes.
If anyone has any idea on how to do any part of this, please let me know. When I’m done with the script I’ll post the full code here as well for anyone who would like to use it.
- Black Leopard
P.S. I know OSX has parental controls, but this script would be much easier to run over ARD then to have to sit down at every computer and reconfigure it for exams.
Model: Powerbook G4
AppleScript: 2.1.1 (81)
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)