Making a script invisible

I have written a script for a school environment what it does is every time a student tries to open the application “Photo Booth” during after-school hours it will quit. I written it, but cannot figure out how to make the icon not appear in the dock at all. Could somebody help me out with this?


on idle
	set right_now to (current date)'s time --Get the time...
	if right_now > 50400 and right_now < 57600 then -- If the time is between 2 and 4 PM
		tell application "Photobooth"
			quit
		end tell
	end if
	return 1 -- this is 1 seconds 
end idle

Model: Intel and PPC iMacs
AppleScript: 2.1.1
Operating System: Mac OS X (10.4)

  1. Save the script as application bundle
  2. Right-click the newly created bundle and choose “Show Package Contents”.
  3. Then browse to “YourApp.app/Resources/Contents/Info.plist” and open it
  4. Add a boolean item called LSUIElement with the value "true"and save it.
    In plaintext this would look like:
  1. This might need a logout to take effect in some cases.

Ok I will try it. What I am aiming for is an application or something similar to launch after a student logs on to the computer it will launch automatically.

simply write the script, save as an application, then open system prefs, go to accounts then click the login items tab and check off your application.

i know that. I want to make the application invisible to the finder. I do not want a dock icon for it. I know it is possible to do because I have an application called TigerLaunch that does not need a dock icon, it appears in the MenuBar instead I was wondering if there was a way to make it similar in that respect, perferably without any sort of icon at all, but I can live with a menubar icon if necessary.

I believe the answer was already given to you.

Then just add the app bundle to the login items and when you log in it will run without being shown in the dock.

You might also consider a launchd agent running in the background as well. Unless a user understands how launchd operates, it will be nearly impossible to outsmart. This article has some basics on how it works, and there are other links in there as well for more details.

You could simply set the agent to run every second or two of the day, and call this modification of your original script:


set right_now to (current date)'s time --Get the time...
if right_now > 50400 and right_now < 57600 then -- If the time is between 2 and 4 PM
	try --Just in case it is not running
		tell application "Photobooth" to quit
	end try
end if

Good luck,

I don’t think a launchd agent is really what you need here. It will work but it’s not really necessary . Since it is in a school enviroment you being an administrator of some sort can make sure that they can’t uncheck it in system preferences. My only concern is that they could just find the application and delete it by doing a quick spotlight search.

The student accounts do not have access to any of the System Preferences. Also I do not want this to eat CPU power, I want this to be a backround task. I might just go with the application bundle method if it works. Thanks for the help. If I have any further questions I will keep you informed.

OK, I have tried to do what hendo13 suggested, but that does not seem to work I go to the allowed applications for the student and it says that the student cannot use the application because it does not work with the current limitations of the account. I do not want to be installing new software onto all of the computers. Is there another way?

Are you saying, if you save it as an app. bundle, you get this message, or are you saying actually you can not run any new app, or any type of Applescript app?

The application bundle worked, but when I tried to allow it on the other account it said that it could not beused because of the current limitations of the account. Could I allow it any other way?

I suggest you talk to the admin of the computers?, They should be able to enable the app to be used

Does anyone else find this funny considering his username is ‘Root’?

AppleScripts saved as an application bundle can not be added as an allowable application for Parental Controls. (However, AppleScript Studio apps work fine.)

Edit: Tiger restricting Application Bundle for Managed Account?

Open the Info.plist file for the bundle.

Substitute a four character something/anything in place of ‘aplt’.

CFBundleSignature
aplt

Close and save the Info.plist.

Zip the bundle and throw away the original. Empty the trash.

Place bets on whether it will work.

Unzip the bundle and use the app under Parental Controls.

Peter B.


Technical Q&A QA1373: CFBundleIdentifier and user application access

Um, I work for the admin of computers and have full access to the administrator account that is what I am using to do this. I am going to try to do the CFBundleSignature and see how that works.

Ok I just tried that and it still says that the Application does not comply with the limitation on that account when I try to add it through system preferences to the list of applications the student account can open.

Ok,

If I have read right, I see that Bruce has tried it and has no problems,

Have you tried it on a New or different account?

yes I did. I did the changes but now the script does not work. i set it as a login item and it did not launch like it was suppose to.