Q:

Applescript Droplet to Droplet Communication

I've created two droplets, one to rename files, another to print files. They are more complicated than that, but this is the essence. Sometimes we need to just rename them, sometimes just print them, and on occasion do both. I'd prefer to keep the two droplets separate because of extensive customization required for each user.
Desired workflow: drag file to RenameMe droplet, if command key is held down then pass the renamed file to the PrintMe droplet.
With the help of the checkModifierKeys script (sorry, don't have the citation handy) I can check to see if the command key is pressed, so that part of the script is taken care of. The problem is how to trigger the second droplet from the first. I've tried the opening the file with the second droplet as the application (as in the code below) but get a communication error.
Any ideas?
--Alex
Sample code:
on open the_Droppings
set flPth to POSIX path of (path to me) & "Contents/MacOS/checkModifierKeys"
set cmdPressed to (do shell script (quoted form of flPth & " command")) as integer as boolean

repeat with i from 1 to (count of items in the_Droppings)
    set file_name to "NEW NAME FROM SCRIPT" #actual script that generates name isn't relevant
    tell application "Finder"
        set name of file (item i of the_Droppings) to file_name
    end tell

    if cmdPressed is true then
        #pass the file to the PrintMe droplet       
        tell application "PrintMe"
            open (item i of the_Droppings)
        end tell
    end if
end repeat
end open

A:

You can add an explicit run handler to PrintMe, which will allow you two different entry points into the script. Both of which take arguments. I've set it up here with one file being passed to the run handler, and a list being passed to the open handler, but if you wanted you could pass a list to the run handler and repeat the same way you do in open.
In RenameMe:
if cmdPressed is true then
    #pass the file to the PrintMe droplet       
    run script (load script file "path:to:PrintMe.app") with parameters (item i of the_Droppings)
end if

In Print Me:
on open the_droppings
    repeat with i from 1 to (count the_droppings)
        process(item i of the_droppings)
    end repeat
end open

on run the_file
    process(the_file)
end run

on process(the_file)
    // Code for printing files goes here
end process

