Automatic timed screen grab in OS X Tiger !


Ric

Joined
May 14, 2004
Messages
4,260
Reaction score
4
If you need to capture the Screen on your Mac here is one way of doing it...


First, create a folder on your Desktop called captures.

Next we are going to write a shell script...


Open TextEdit and type:


Code:
#!/bin/sh


screencapture -x /Users/[B]computer[/B]/Desktop/captures/`date +%b%d%H:%M:%S`.png
Changing the word 'computer' to your username !



Whats all that code then !!!

Well the first bit tells the Mac what Shell to run the code in. In Tiger the default is 'bash'

The next line...

Code:
screencapture -x
Capture the whole screen without making the camera click sound !

Leave off the -x if you want to hear the camera !

Next bit...

Code:
/Users/computer/Desktop/captures/
This is the 'path' where the screencaptures will be saved, on this Mac my username is 'computer' so the screengrabs will be saved in a folder called 'captures' on my desktop.

You will have to amend this to your own folder, maybe

Code:
/Users/yourUserName/Desktop/
All the files would then go on your Desktop. (remember there will be 20 every hour, so it'll get cluttered !)

The next bit...

Code:
`date +%b%d%H:%M:%S`
This is the unix command 'date' this gets the current date...

June2816/30/23

ie June the 28th 16.30 and 23 seconds.

The next bit...

Code:
.png
The default for Screencapture's via the Terminal is to output a .png file

If you don't have this tagged onto the end of the filename, the files aren't double clickable.


So we now have our Shell Script, do a save as

Code:
screenie.sh
Don't allow TextEdit to add .txt to the end of the name !

Now we need to open Terminal (Applications-->Utilities)

Once Terminal is open then type

Code:
chmod +x
type a space after the x

Don't press return yet...


Find the screenie.sh file and drag it into the terminal so that you get a line similar to this...


Code:
chmod +x /Users/computer/Desktop/screenie.sh

Now you can press the return key !

This line turns screenie.sh into an executable file, ie it's now like a little application that the shell can 'run'.

Now move the screenie.sh file somewhere safe, maybe in the Applications folder if you want.

Now download Launchd editor from here.

This is not technically needed but it makes life easier ! Please pay the Developer if you use the App a lot !

Now have a look in this folder,

Code:
Users/yourusername/Library
Is there a folder called 'LaunchAgents' if there isn't then create one.

Now open up Launchd editor.

We are now going to create the 'Screenie plist file'

Just edit as the screen grabs below...






Changing your path info as neccesary !


On my Mac I have left the screenie.sh file on the Desktop !

In the second pic above the 300 seconds will mean that the Shell Script will run every 5 minutes ! Change to suit your needs !



Now save that file as screenie.plist in the 'LaunchAgents' folder that you created above.

Now back to Terminal and type...

Code:
launchctl load /Users/computer/Library/LaunchAgents/screenie.plist
Again changing the path as necessary !

Now, best to reboot ! You are done !

Every 5 minutes a new screen grab is taken and saved to where you specified...

You can always extend this to then email the Screen Grab...FTP it somewhere what ever you want !

To turn it of...

Code:
launchctl unload /Users/computer/Library/LaunchAgents/screenie.plist
Again replace the path as neccesary !



You should end up with something like this...





regards

Ric
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top