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


Click here to return to the 'A script to create uniquely-named screenshots' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to create uniquely-named screenshots
Authored by: macsadmn on Oct 06, '06 09:25:22PM

luomat - Thanks for the script! I've been wanting to do something like this for a long time, but didn't know how to go about it. I've always wanted to be able to name my screen shots at the time they are taken. Your script really got my wheels to turning... So, I modified it a bit and hope you don't mind. Below is my AppleScript "tweak" on your already well written script.

AppleScript starts below this line:


-- This script was written by user macsadmn on macosxhints.com and is a
-- modification of a script originally designed by luomat on macosxhints.com

-- Prompt for the new screenshot name
display dialog "Name for screenshot: " default answer "" buttons {"OK"} default button 1

-- assign the variable pic_name the string value entered by the user
set pic_name to text returned of the result

do shell script "

# If you want to change the filename format,
# do so by changing the .png to some other extension. Also note,
# that if you change the extension, then you need to
# change the format from PNG
# using the -t flag of screencapture (next to last line).

FILENAME=\"" & pic_name & ".png\"

# This is where files will be moved to
TARGET_DIR=\"$HOME/Desktop\"

# Line 1: Like cmd+shift+4, offer a crosshairs to select what will be captured
# and save it as a PNG
# Line 2: By default, the file gets saved to the top level of
# the users home directory. So, since we want it on
# the desktop, we move it to the TARGET_DIR as defined above.
# We use mv -n to NOT overwrite existing files.

/usr/sbin/screencapture -tpng -i \"$FILENAME\" &&
/bin/mv -n \"$FILENAME\" \"$TARGET_DIR/\"
"



[ Reply to This | # ]