I need a script to auto load safari then delete itself at boot.

I am working on a project for my company’s HR dept regarding our sexual harassment video. The requirements are that the first time a new employee uses his new computer, a browser will open automatically and display the video’s web page. Here is what i did for the Windows computers:

  1. created a batch file and it is placed in the startup folder for all users
    2)the batch file opens iexplore in kiosk mode so they have to watch the video before they can do anything
    3)the batch file then deletes itself so it wont execute on the next boot

I want the same functionality on the mac computers. I messed around with some Applescript and created one that will open Safari in what Apple calls “full screen” (but I call large windowed) and open the video site. So this accomplishes part of the goal but not all of it.

Can someone help out? I would really appreciate it.

Thanks,
Shane

Hi Shaneweaver,

I don’t think you need to start in a browser. You could use Quicktime or iMovie. It’s not like windows where you use IExplorer.

That wont work. The video is on a site I created and once the video finishes it forwards them to another page with the agreement they digitally sign acknowledging they have watched the video.

Thanks for the reply.

Shane

Ok, so you want to present the movie on a webpage and the video is coming from your site? I don’t know how to do this.

Hi,

maybe this is a starting point

This script activates Safari, make a new document if necessary, opens “macscripter.net” and goes full screen.
The line containing “Enter Full Screen” assumes (US) english language settings


tell application "Safari"
	activate
	if not (exists document 1) then make new document
	set URL of document 1 to "http://macscripter.net"
end tell
tell application "System Events"
	tell process "Safari"
		pick menu item "Enter Full Screen" of menu 1 of menu bar item "View" of menu bar 1
	end tell
end tell

Wow, I didn’t know Safari could go into full screen. Or you could make the movie go into full screen maybe.

Apple has introduced this feature in Lion (AFAIR)

PS: not tested but try the following

Save the script as application named “SafariAutoStart” somewhere and add it to the login items
The additional lines delete the login item and delete the application itself


set pathToMe to (path to me)
tell application "Safari"
	activate
	if not (exists document 1) then make new document
	set URL of document 1 to "http://macscripter.net"
end tell
tell application "System Events"
	tell process "Safari"
		pick menu item "Enter Full Screen" of menu 1 of menu bar item "View" of menu bar 1
	end tell
	delete login item "SafariAutoStart"
end tell
do shell script "rm -r " & quoted form of POSIX path of pathToMe


Thanks for the replies, guys. I’ll try this out today and see if it works!

Shane

Edit: got it working, thanks!!!

shane