Description: This script will create a img tag from selected image, alternative as a link. One deactivated section will process the image in GraphicConverter.
Requirement: Mac OS 10.3.x
-- Script Start (* Simple script to create a img tag from selected image 2004-06-30 by Fredrik Jonsson <mailto(colon)fredrik(at)combonet(dot)se> home page <http://xdeb.org/wiki/AppleScript> *) property img_url : "http://domain.tld/" property img_path : "path/to/images/" property img_hspace : "5" property img_vspace : "5" property img_align : "right" property img_border : "0" set this_file to choose file set destFldr to (path to (desktop) as string) set img_title to (display dialog "Title text for image (if empty file name):" buttons {"Cancel", "OK"} with icon 1 default button 2 default answer "") if the button returned of the img_title is "Cancel" then return set img_title to text returned of the img_title as string set img_link to (display dialog "URL for image link (if empty no link):" buttons {"Cancel", "OK"} with icon 1 default button 2 default answer "") if the button returned of the img_link is "Cancel" then return set img_link to text returned of the img_link as string try tell application "Image Events" launch -- open the image file set this_image to open this_file -- extract the info copy the name of this_image to img_name copy the dimensions of this_image to {ximg, yimg} -- purge the open image data close this_image end tell (* tell application "GraphicConverter" activate open this_file tell window 1 unsharp mask radius 1 amount 60 threshold 1 save in (destFldr & img_name) as JPEG with wwwready close end tell end tell *) set img_width to (text 1 thru -3 of (ximg as string)) set img_height to (text 1 thru -3 of (yimg as string)) if img_title = "" then set img_title to img_name end if set img_tag to "<img src=\"" & img_url & img_path & img_name & "\" width=\"" & img_width & "\" height=\"" & img_height & "\" hspace=\"" & img_hspace & "\" vspace=\"" & img_vspace & "\" align=\"" & img_align & "\" border=\"" & img_border & "\" alt=\"" & img_title & "\" title=\"" & img_title & "\" />" if img_link ? "" then set img_tag to "<a href=\"" & img_link & "\">" & img_tag & "</a>" end if on error error_message display dialog error_message end try tell application "TextEdit" activate set UnixDir to POSIX path of destFldr do shell script "echo '" & img_tag & "' >> " & UnixDir & "img_tag.txt" do shell script "open -e '" & UnixDir & "img_tag.txt'" end tell -- Script Stop