I need help with an automated script
August 24, 2011 8:32 AM   Subscribe

I need a script that opens a webpage, takes a screenshot, saves it to a file on a network. It has to run every two hours. I've been playing with AutoHotKey but I am not really sure what I'm doing.

Here is the script I have so far (the key delay is to let the website load):
SetKeyDelay [2000, -1, -1]
Run http://www.google.com
Send {PrintScreen}
run winword.exe
send ^v
send ^f
send s

Here's what it does: opens Google in IE, minimizes IE, opens Word, shows a blank page. If I then manually press CTRL + V, it pastes a screenshot of the last window I had open (not Google). There is no save dialog.

This will be run on Windows XP (or possibly Windows 7). I have no choice about this. The end user can handle keyboard shortcuts if they need to do something manually, but I'd prefer this just to run in the background. Most likely this will be run on a spare computer, not one that someone is using for their daily tasks.
posted by desjardins to Computers & Internet (13 answers total) 2 users marked this as a favorite
Site Shooter - http://www.nirsoft.net/utils/web_site_screenshot.html - will make this a lot easier.
posted by mrbill at 8:36 AM on August 24, 2011

Alternately http://www.websitescreenshots.com/ is another utility that does the same thing.
posted by mrbill at 8:38 AM on August 24, 2011

what if it's not a website, just a program running on the screen?
posted by desjardins at 8:40 AM on August 24, 2011

In that case, http://autoscreenshotmaker.com/, http://www.16software.com/icyscreen/, etc.
posted by mrbill at 8:42 AM on August 24, 2011

Haven't used it myself but there's a utility called url2bmp that purports to do this. In the course of searching on that I came across this thread at Stackoverflow about doing this in PHP which might have some other good leads as it mentions url2bmp and other command-line tools.
posted by XMLicious at 8:43 AM on August 24, 2011

For manual screenshots of windows or the whole screen, I love (and use) Greenshot (it's free).
posted by mrbill at 8:43 AM on August 24, 2011

If you are just wanting to take a screenshot every x minutes, this link from Novell has exactly how to do it including a download link at the bottom for the program.
posted by deezil at 8:48 AM on August 24, 2011

Jitbit Macro Recorder. Go through all the steps you want the computer to repeat, then test. Note that this may require a bit of trial and error to make it work :)
posted by chrisinseoul at 10:20 AM on August 24, 2011

Your current script may be snapping the shot before the IE window has loaded. Try grafting in one of these:

Run http://www.google.com
WinWaitActive, ahk_class IEFrame
Send {PrintScreen}

or, a little more robust against IE weirdness:

Run http://www.google.com
Loop, 100
IfWinActive, ahk_class IEFrame, break
Sleep, 50
Send {PrintScreen}

Both of these tell the script to wait until the IE window has appeared before taking the screen shot. (This is for Internet Explorer 8 -- if you're using a different version, use Autohotkey's WindowSpy option to learn what ahk_class text to substitute for "ahk_class IEFrame".

What are you trying to do with the Ctrl-F, S stuff?

Incidentally, Timesnapper does pretty much what you need, though it's only free for the first month.
posted by foursentences at 10:38 AM on August 24, 2011

Also, throw in a Sleep, 5000 before the Ctrl-v, to give Word time to load up.
posted by foursentences at 10:40 AM on August 24, 2011

deezil's answer turned out to be the simplest free program for screenshots. Now to figure out a way to save them to a SharePoint site, which cannot be mapped as a drive or accessed through FTP (as far as I can tell) ....

What are you trying to do with the Ctrl-F, S stuff?

It should have been ALT + F, S to bring up the save dialog box. Typed ^ instead of !
posted by desjardins at 11:09 AM on August 24, 2011

desjadin, you can absolutely map a SharePoint Document Library as a shared drive in most cases. The PC side of this appears to have changed in every version of windows so it is a little tricky. At least in Vista, right clicking in the Network Location section of My Computer gives you the Add Network Location option. Try adding the url http://sp.compname.com/sites/sitename/DocumentLibName/ as where you want to map a drive to.
posted by mmascolino at 11:22 AM on August 24, 2011

Right, I did that, but it does not map it to a drive letter. I can get to it via My Network Places - it shows up as SiteName on moss.mysite.com. However, I can't save image files in it, nor can I navigate to lists & libraries within the site. (I tried to map individual lists or libraries; doesn't work, the OK button is greyed out. Also can't map subsites.)
posted by desjardins at 11:27 AM on August 24, 2011

« Older Lego event for teen youth group?   |   Make three webservices play nice. Newer »
This thread is closed to new comments.