I’m looking for help with a problem I’ve been working on:
I want to write a script which will:
prevent a specific application from launching while the script is running
run continuously (loop)
be invisible in the dock
be invisible in the finder
be launchable via remote access
Now maybe there’s already a product out there which will do this, but I’m not aware of it.
I’d use the capability of Remote Access to send a terminal command to accomplish this, but I’m not sure how that could be done without knowing the process id.
Any help in finding a solution would be really appreciated.
Thanks.
Not sure how you’d do everything you want with an applescript but I think the following bash script does what you want. It will kill all instances of the application every second. If it’s an application that for some reason ignores kill you could use kill -9 but you probably don’t want to if you can avoid it. Just put it in a text file, and use “chmod 700 filename” then “./filename” if you’re trying to stop any user from running the application you will have to use root.
If you want to run it remotely it will quit when you logout, if you don’t want it to quit you should look up the command screen.
#!/bin/bash
while [ 1 ]
do
# replace “application” and “name” with a each word in the
# application’s name. Where $11 is the first word, $12 the second
# etc.
Try replacing the first line with one of the following:
#!/bin/sh
or
#!/bin/tcsh
Also there were a couple of typoes in the version of the script I posted which I have fixed. Make sure in the one you have that there are the same number of {s as there are }, and that you use == not = after the if.
All you would have to do to keep the app from running is this:
repeat
tell application "System Events"
if some_application is in name of processes then
tell application some_application
quit
end tell
end tell
end repeat
to make an app’s icon not appear on your dock when it runs,
edit the Info.plist file inside the Contents directory inside the .app file.
before the “” tag, add:
LSUIElement
1
save changes, and then from the terminal put in:
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f (Path to your application)