Re: Simple Pict conversion help
Re: Simple Pict conversion help
- Subject: Re: Simple Pict conversion help
- From: Dave Groover <email@hidden>
- Date: Mon, 24 Mar 2003 17:59:21 -0500
>
Hello Dave,
>
The JPG to TIFF script from the Apple site compiles fine for me and
>
works without error in converting any images I've dropped on it.
>
>
I did notice that one character seems wrong (at least, on the
>
version you sent me) at the point where it stops compiling for you.
>
The fourth word of that line should be "Export..." In words, that's
>
Export followed by three "and so on" dots produced by typing option
>
semicolon, the whole thing in quotes.
>
>
Here's hoping,
>
RW
I appreciate the idea. But I found my example exactly as you were
describing it as non error. SO I may not have understood what you
were saying. My 4th word, I think, is as you described. Certainly
that is next to the point of the error.
Here is the actual script copied from Apple's page with all the
errors I was mentioning. The last error, which you were trying to
point out, is still there...
Dave
property type_list : {"JPEG"}
property extension_list : {"jpg", "jpeg"}
global destination_path
on run
display dialog "Export JPEG to TIFF" & return & return & ,
"Drag JPEG images onto this droplet to export TIFF copies of them
from the Preview application." buttons {"Done"} default button 1
end run
-- This droplet processes files dropped onto the applet
on open these_items
set the image_list to {}
repeat with ifrom 1to the count of these_items
set this_item to item iof these_items
set the item_info to info for this_item
if (folder of the item_info is false) and ,
(alias of the item_info is false) and ,
(( the file type of the item_info is in the type_list ) or ,
the name extension of the item_info is in the extension_list )then
set the end of the image_list to this_item
end if
end repeat
if the image_list is {} then
display dialog "The dragged-on items contained no JPEG images."
buttons {"Cancel"} default button 1
end if
-- prompt the user for a new destination folder
set the destination_path to ,
(choose file name with prompt "Enter the name and location for a new
destination folder:" default name "Exported Images") as string
set AppleScript's text item delimiters to ":"
set the parent_folder to ((text items 1 thru -2 of the
destination_path )as string) & ":"
set the destination_foldername to the last text item of the destination_path
set AppleScript's text item delimiters to ""
tell application "Finder"
set the destination_folder to (make new folder at folder
parent_folder with properties {name: destination_foldername }) as
alias
end tell
-- convert the folder reference to a POSIX path
set the destination_path to the POSIX path of destination_folder
-- process the images
repeat with ifrom 1to the count of image_list
set this_item to item iof the image_list
process_item (this_item )
end repeat
end open
-- this sub-routine processes files
on process_item (this_item )
try
-- NOTE that the variable this_item is a file refernce in alias format
-- FILE PROCESSING STATEMENTS GOES HERE
tell application "Preview"
activate
open this_item
end tell
delay 2
tell application "System Events"
tell process "Preview"
click menu item "Export
" of menu "File" of menu bar 1
delay 1
tell sheet 1 of window 1
tell pop up button 1
click
delay 1
tell menu 1
set the menu_options to the name of every menu item
if the menu_options contains "TIFF" then
click menu item "TIFF"
delay 1
else
error "Cannot convert this image to TIFF format."
end if
end tell
end tell
click button "Options..."
end tell
tell window "TIFF Options"
tell pop up button 1
click
delay 1
tell menu 1
click menu item "None"
delay 1
end tell
end tell
tell pop up button 2
click
delay 1
tell menu 1
click menu item "Best Depth"
delay 1
end tell
end tell
if the value of check box 1 is not 0then
click check box 1
delay 1
end if
end tell
keystroke return
tell window 1
tell sheet 1
tell group 2
tell group 1
tell text field 1
set the new_imagename to the value
set the value to the destination_path &new_imagename
delay 1
end tell
end tell
end tell
end tell
end tell
keystroke return
delay 2
keystroke "w" with command down
end tell
end tell
on error the error_message number the error_number
display dialog the error_message buttons {"Cancel"} default button 1
end try
end process_item
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.