Re: Scripting dropping a file onto a droplet
Re: Scripting dropping a file onto a droplet
- Subject: Re: Scripting dropping a file onto a droplet
- From: Brian <email@hidden>
- Date: Fri, 13 Apr 2001 09:52:22 -0400
>
On 4/11/01 12:39 PM, Jesse Proudman (Lists Account)
>
<email@hidden>
>
wrote:
>
>
> I have an Adobe Image ready droplet and a file. I want to write a
>
> script
>
> that will take the image file and drop it onto the droplet, thus
>
> evoking the
>
> droplet's action. Now, I can't get it to work.
>
>
<snip>...
>
>
Michelle Steiner wrote:
>
>
Why not just incorporate the functionality of the droplet into the
>
script
>
itself? It should be a simple copy-and-paste with a little touch-up.
My response:
Disclaimer -- I'm no expert on Applescript but I've received some great help
from this list recently and in the interest of being a contributing
member and not just a mooch I'll see if I can lend any help - I've seen the
recent threads at alt.comp.lang.applescript.
Michelle - Image Ready droplets are slightly different animals than
Applescript droplets which I think confused things here. IR droplets
are basically self-contained executable <do script: some action>
Photoshop/Imageready commands that can be activated by dropping files on
their icon - no applescript needed.
Jesse- below is a bit of code I'm still working on but may give give
you the nudge you need to get going. Note it's not perfect - I can't get
files to close after they've been processed....
(*
save as a compiled script and attach to an open folder into which you
can
drop image files instead of dropping them on the droplet
*)
on adding folder items to this_folder after receiving added_items
tell application "Finder"
--changes creator code of files so they open in IR as opposed to Photoshop
select (every file of this_folder whose creator type is not "MeSa")
set Not_IR_Files to every file of selection
repeat with this_item in Not_IR_Files
set the creator type of this_item to "MeSa"
end repeat
(*I used a label conditional to separate new stuff from previously
dropped
stuff*)
set ToDo_list to every item of this_folder whose label index is not 3
tell application "Adobe ImageReady 3.0"
repeat with i in ToDo_list
open i
do script "YOUR ACTION HERE"
end repeat
end tell
set the label index of every item of this_folder to 3
end tell
end adding folder items to
This script is designed to be attached as a folder action and when files are
dropped into the folder to which it's attached it launches Image Ready
and runs your action (basically the same thing the IR droplet does).
Now the downside - I can't figure out how to close the files after the
action is completed, so after a few runs you'll have lots of images
open. Ugly to be sure, but I'm stumped. No massaging of a close command
seems to work....
My original idea was to use something more like this, but it doesn't seem
to work at all - Image Ready opens and then just sits there...
--this doesn't work at all, sorry to say
on adding folder items to this_folder after receiving added_items
tell application "Finder"
set ToDo_list to every item of this_folder whose label index is not 3
tell application "batch process"
repeat with i in ToDo_list
open i
end repeat
end tell
set the label index of every item of this_folder to 3
end tell
end adding folder items to
Hope this helps and if anyone has suggestions on how to make this work
better I'd love to hear them I'd very much like to use a script like
this
myself.
Brian