Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Programmable screenshot utilities UNIX
The usual screenshot utilities, both built-in and third-party, never seemed to do what I wanted. Fortunately, Apple has provided three command-line utilities, screencapture, sips, and pbcopy, which can be combined in scripts to do exactly what I want.

An example script--which takes a screenshot (window, selection rectangle, or entire screen), resizes it to a given size or scale, saves it with a given filename, uploads it via FTP to a specified site, and puts the new file's URL on the clipboard--is described on this page.

[kirkmc adds: We've covered these command line utilities in various tips here in the past: screencapture, sips, and pbcopy, if you're interested in seeing what else you might do with them.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[6,461 views]  

Programmable screenshot utilities | 1 comments | Create New Account
Click here to return to the 'Programmable screenshot utilities' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Programmable screenshot utilities
Authored by: Little Neddy on Apr 24, '06 02:37:11PM
I use freesnap and threw in a crude applescript. I wanted an hour by hour snap of the screen and rather than "freesnap 034" I wanted "20060424 1423" (YYYYMMDD HHMM) and thus this script was developed. I also wanted the files saved "out of the way", so they are placed in the pictures folder.As it was for personal use, I haven't tarted it up (eg the saving directory is hard-wired), but someone out there might make use of it... =-=-=-=-=-=-=-=-=-=-=-===-=-=-

repeat with shotcount from 1 to 1000000 -- crude huh? 
	
	tell application "FreeSnap"
		activate
		change destination to file
		change format to TIF
		-- change location capture boundaries to x 850, y 700, width 600, height 233
		snap fixed selection -- can use any of freesnaps capture methods here
	end tell
	
	-- convert the system date and time so that 
	-- YYYYmmDD HHmm
	
	
	-- firstly, YYYYmmDD
	set yy to year of (current date) as string
	set mm to month of (current date) as integer
	if mm < 10 then set mm to "0" & mm
	set dd to day of (current date) as integer
	if dd < 10 then set dd to "0" & dd
	set tt to time of (current date) as integer
	
	-- now HHmm
	set hh to tt div hours
	if hh < 10 then set hh to "0" & hh
	set tt to tt mod hours
	
	set min to tt div minutes
	if min < 10 then set min to "0" & min
	
	-- make the YYYYmmDD HHss
	set new_date_format to yy & mm & dd & " " & hh & min
	
	-- this is to be the new file name
	set new_picture_name to new_date_format
	
	tell application "Finder"
		
		-- get all the files in the pictures directory
		try
			set filestring to entire contents of folder ("Little Neddy:Users:lugly:Pictures:") as string
		end try
	end tell
	
	-- pull out the last file from that directory
	set text item delimiters to ":"
	set last_text_item to the last text item of filestring
	
	-- put this value in a string
	set old_picture_name to "Little Neddy:Users:lugly:Pictures:" & last_text_item
	
	-- tell finder to change the name
	tell application "Finder"
		set name of file old_picture_name to new_picture_name
	end tell
	
	delay (60 * 60) -- delay one hour
end repeat
-=-=-=-=-=-=-=

[ Reply to This | # ]