I have a question. How can I make a action with Automator to do this. I want to go to Google or Yahoo or MSN do a search for a keyword than take a snapshot of the page and save it to a folder. Than use iCal to have the action happen daily. This might be easy to make, but I am new to this program. Can someone help me out?
Yes, it can, with a caveat. Create a workflow with the following actions: Get Specified URLs
In this action, enter the url of the site you wish to image, and be sure the box is checked. Display Webpages Take Screenshot
This action is a little irritating. You cannot simply choose a folder for all your screenshots, you must actually choose a filename in any location you wish. Therefore, every time you run the workflow, the file will be over-written with the new data. Also, I put a delay of 5 seconds into the action as well, just to be sure.
What you may need to do is create a Folder Action on the folder that contains your screenshot to rename or move your fresh screen shot. You could also modify this workflow so that the first action in the workflow moves or renames the screenshot file already present.
I am pretty sure that once the workflow is saved as an application, iCal can fire it every day. I will check into that.
EDIT
Once the workflow is functioning as you desire, navigate to Automator’s File menu, and choose Save As Plug-in… Then, select iCal Alarm, and modify the settings however you wish for regular triggers.
**EDITchanged the first action New Text (found under the variables Tab, Drag the New Text from the variable actions column, and drop it on to the workflow area, It will show up as a get Value of variable)
As you do this a Variable info Pane should rise up at the bottom of the workflow window.
With a blue New Text label inside. Double click its value area and paste in: http://www.google.com/search?hl=en&client=safari&rls=en-us&q=YOUR QUERY in the Value.
Display Webpages Take Screenshot (set to Full Screen) New Shell Script (found under the variables Tab)
Drag the New Shell Script from the variable actions column, and drop it on to the Save to Drop down menu in the Take Screenshot panel.
It will stick to it.
Now click it, and you will see a sub menu arrow to the right. Pointing to Edit…
Select Edit…
And Paste : sleep 10;date “+/Users/USERNAME/Desktop/Screen_Grab_%m%d%y_%H_%M_%S”
into the Scritp Box.
You will need to change the: /Users/USERNAME/Desktop to the path you want to save the images.
And Screen_Grab_ to the start of the file name you want.
The %m%d%y_%H_%M_%S will give you a time stamp which will give a unique filename.
The sleep 10 isfor a ten second delay, because the loading of the page may take some time.
Craig and Mark, Thanks for the reply.
Is there a way to get a full shot of a webpage. (Everything blow the fold) I found a applescript for Paparazzi but I don’t know how to use it with without over writing the file from the day before. Anyone know how I can use this?
set myLink to "http://www.apple.com"
tell application "Paparazzi!"
activate
capture myLink
repeat
delay 1
if not busy then exit repeat
end repeat
save as JPEG in (((path to desktop) as text) & "myImage.jpeg")
end tell
Walter, all you need is a method (similar to mark’s shell method) that will generate a unique filename every time the script is triggered. I am not well versed in using shell scripts for that (perhaps mark can post his solution, it is bound to be a bit more elegant than this), but here is one way to do it in AS:
set myLink to "http://www.mrcodeboy.com/pages/applications.html"
set file_Name to my MakeTodayFileName()
tell application "Paparazzi!"
activate
capture myLink
repeat
delay 1
if not busy then exit repeat
end repeat
save as JPEG in (((path to desktop) as text) & file_Name)
end tell
to MakeTodayFileName()
set right_now to (current date)
return "myImage" & (right_now's day as text) & (right_now's month as text) & (right_now's year as text) & ".jpeg"
end MakeTodayFileName
As long as this script is only run once daily, all the filenames will be unique. If you plan to run it more than once daily, we should add a timestamp to the filename as well.
At this point, Automator becomes moot; the script alone can deliver what you need, and can be triggered by either launchd or iCal. Of course, you can simply copy this into a Run AppleScript action, and still save it as an iCal plug-in for regular launching.
property http : "http://www.engadget.com/search/?q=" --Page to be loaded
property QUERY : "applescript" -- QUERY to search for
property timeout_value : 20 -- no load time out - so repeat loop stops if problem
property format : "jpg" -- format of capture file
property fPATH : "/Users/USERNAME/Desktop/" -- path for file to be saved
property fileStart : "Screen_Grab" --first part of name for file to be saved as.
set loaded to false
tell application "Finder"
set dt to bounds of window of desktop -- get the size of your screen
end tell
tell application "Safari"
activate
open location (http & QUERY)
my page_loaded(timeout_value, loaded) -- try to wait until page loads
set bounds of window 1 to dt -- expand the safari window to full screen
do shell script "GrabName=`date \"+" & fPATH & fileStart & "_%m%d%y_%H_%M_%S\"`;screencapture -m -t" & format & " $GrabName." & format (* Do a screen capture *)
end tell
on page_loaded(timeout_value, loaded)
delay 2 -- first delay stops false reading of the javascript
set counter to 0
repeat until counter is timeout_value or loaded
tell application "Safari"
if (do JavaScript "document.readyState" in document 1) is "complete" then
log (do JavaScript "document.readyState" in document 1)
set loaded to true
else
delay 2
set counter to counter + 2
end if
end tell
end repeat
delay 1
end page_loaded
The Paparazzi application captures the entire webpage as an image, not just a screenshot. I had never heard of it until this post, but it is pretty cool, if one needs something like that.
I found out that you can set the file format to add Month, Day, Year, Hour, ect. under preferences. Didn’t realize you could do this with Paparazzi. Thanks for both of your help.