GraphicConverter & saving files in new places
GraphicConverter & saving files in new places
- Subject: GraphicConverter & saving files in new places
- From: "Geoffrey F. Green" <email@hidden>
- Date: Fri, 08 Nov 2002 21:40:24 -0500
Hello:
I'm a somewhat experienced Applescripter, enough to figure out how to put
together the few scripts I've made, but I've encountered a problem which
seems to be simple but that I just can't figure out.
Here's what I'm trying to do -- I'm opening a graphics file (whether
Photoshop or jpeg) in GraphicConverter. I'm saving the file in a different
location as a jpeg. If the photo doesn't have ".jpg" at the end, then I'm
trying to save it with that suffix. That's it.
But I'm having serious difficulties getting the file to save in a new
location. GraphicConverter seems to want me to provide an alias if I'm
trying to save the file, but since the new file doesn't exist, I can't give
it an alias object. I thought of copying the file to the destination folder
before opening it in GC, but I don't want to screw up GC by adding the
suffix ".jpg" before opening it, and I'm not certain how to change the
file's name afterwards without screwing up GC or maybe the Finder.
Here's the part of my script that sets up the destination folder (and I've
snipped part for brevity's sake, so if something looks like it wouldn't
work, I may have snipped needed parts):
=====
on open these_items
set folder_name to "Photos to e-mail"
set destination to path to "cusr" from user domain
tell application "Finder"
activate
if (exists folder (folder_name) of destination) is false then
make new folder at (destination) with properties
{name:folder_name}
-- snip
set finalDestination to alias ((destination as string) & folder_name)
set secondFolder to currentMonth & " " & currentday & ", " &
currentYear as string
set saveFolder to ((finalDestination as string) & secondFolder)
-- there is some error checking that I've taken out for purposes of this
question
=====
I take the list of files and pass along the proper ones to GC (you'll notice
that some of the code has been cribbed from our friends at Apple)
=====
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 ,
(my check_extension(the name of the item_info) is true))
then
set the_name to the name of item_info
my process_item(this_item, the_name, newSize, saveFolder)
=====
and then, in GC, I try to save the file in a new location
=====
on process_item(this_item, the_name, newSize, saveFolder)
tell application "GraphicConverter"
activate
-- photos manipulations snipped . . .
set JPEG quality of window 1 to 75
if ((name of window 1 ends with ".jpg")) is false then
set name of window 1 to name of window 1 & ".jpg"
end if
save window 1 in saveFolder as JPEG with wwwready
close window 1
end tell
end process_item
======
It seems to succeed until it reaches the "save" command -- the name of the
window indeed does change. But then I'm informed that a type "-1" error
occurred, and that I should go away.
Thanks for everyone's help. I can provide the entire script if anyone
thinks that will prove insightful. I'm running GC 4.4.4, though I don't
think the save functionality had changed before then for a while or has
changed since.
- geoff
_______________________________________________
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.