code:<pre style="font-size:x-small; font-family: monospace;">
(*
Before running this script create a folder named ScreenCapture in
your Document Folder of you Home Directory. If you place or name
this directory to something else you will need to change the
script on several places to make it work
The is based in use if imageMagic 5.1.1 that is free download
from http://www.apple.com/downloads/macosx/unix_op...
You also will need to download and install GhostScript from
EPS Ghostscript 7.05.5
http://gimp-print.sourceforge.net/MacOSX.php3
Without GhostScript convert will not be able to handle the PDF format.
Due to that we do not want to use a visual terminal we need to use
the "do shell script" command from AppleScript. However this has one
limitation. The "do shell script" has no knowledge about our environment.
Therefore you will need to create a shell script that sets up the environment.
Without this shell script convert will not be able to find Ghost Script.
Paste this code into your favorite terminal editor like pico,vi or emacs.
Save it as convert.sh and move it to /usr/local/bin
Note: The shell script is based on a screen solution of 1024x768
With other screen solution like 800x600 you will need to
modify the shell script. One idea could also be to send
the solution as a parameter to the shell script directly
from AppleScript.
--------- convert.sh -------------
PATH=$PATH:/usr/local/bin:/usr/local/share; export PATH
/usr/local/bin/convert -page 1024x768 $1 -resize 1024x768 $2
----------------------------------
Before moving it to /usr/local/bin set the execution permissons on the script
by from the terminal do:
chmod 755 convert.sh
You will unless you run as root (? guess not) use sudo to be able to move the
file to /usr/local/bin by
sudo mv convert.sh /usr/local/bin
cd /usr/local/bin
ls -l convert.sh
Check that permission for convert.sh is
-rwxr-xr-x
That is all folks! Hopefully you know could save the AppleScript in your
/Library/Scripts folder and use he Script Menu to access the script whenever
you feel you need a ScreenShot in jpg format instead of as per default in PDF
*)
tell application "Finder"
(* Change uhellstr to you own Home folder name *)
count files in folder "ScreenCapture" in folder "Documents" in folder "uhellstr" in folder "Users" of startup disk
set i to result
end tell
set i to i + 1
set temp to i as string
set pdfnamn to temp & ".pdf"
set utfor to "screencapture -m -x ~/Documents/ScreenCapture/" & pdfnamn
do shell script utfor
set jpegnamn to temp & ".jpg"
set del1 to "/usr/local/bin/convert.sh ~/Documents/ScreenCapture/" & pdfnamn
(* It is very important the following row starts with an space immediate after " e.g "<space>~ *)
set del2 to " ~/Documents/ScreenCapture/" & jpegnamn
set utfor to del1 & del2
do shell script utfor
set utfor to "rm ~/Documents/ScreenCapture/" & pdfnamn
do shell script utfor</pre>