Hello Mark,
Thank you very much for your input. I am trying to make it work, but it seems not a simple thing.
And Hello Chris,
On Feb 10, 2012, at 3:07 PM, Christopher Stone wrote:
> What are you trying to accomplish?
>
> What application do you want to open them in?
>
> Do you want them to open at the same time or just open when you drop them?
>
> Please be more specific.
Well, I have an excellent shell script that used to work inside a droplet made with DropScript (it was a very useful utility: see <http://www.wsanchez.net/papers/DropScript/>). As I upgraded to Lion recently, DropScript which was a PowerPC application stopped to work. I wanted to put that shell script inside an AppleScript droplet.
The shell script (which was written by a friend, and which I do not understand fully...) takes two arguments -- two files. DropScript applications normally used to accept files which are dropped on them at once, which means that these files were in the same folder. But it seems they could stay running, and accept other files dropped afterward. The shell script is written so that the two files paths are written in two temporary files, that it refers afterward.
I wanted to imitate this behavior -- but if it is too difficult, I think the following can be an alternative.
on open (droppedItemsList)
if (number of droppedItemsList) ≥ 3 then
display dialog "This droplet accepts two files"
return
else if (number of droppedItemsList) = 1 then
set file_1 to first item of (droppedItemsList)
set file_1 to POSIX path of file_1
set file_2 to choose file with prompt "Please choose a file to compare..." of type {"txt", "rtf", "doc", "docx", "odf", "html", "xml"}
set file_2 to POSIX path of file_2
else if (number of droppedItemsList) = 2 then
set file_1 to first item of (droppedItemsList)
set file_1 to POSIX path of file_1
set file_2 to second item of (droppedItemsList)
set file_2 to POSIX path of file_2
end if
if file_1 = file_2 then
display dialog "You have chosen the same file; please choose another one..."
set file_2 to choose file with prompt "Please choose a file to compare... The first file is " & file_1 & "..." of type {"txt", "rtf", "doc", "docx", "odf", "html", "xml"}
set file_2 to POSIX path of file_2
end if
if file_1 = file_2 then
display dialog "You have chosen the same file. Quitting..."
return
end if
display dialog file_1 & return & " compared with " & return & file_2
return
end open
Best regard,
Nobumi Iyanaga
Tokyo,
Japan
|