Postponing droplet actions

Hi All,

I am trying to create a droplet in AS Studio. Creating the droplet is not a problem. What I could not figure out is how to postpone the action of the droplet so that the main window could come out first to let me select some tasks that the droplet would perform on the dropped folder or multiple items dragged onto it.

I have tried using “with timeout…” and “ignoring application responses” but they woud not work. From my limited tests, when I use them in the “on open handler”, the main window would open but as soon as it opens, the script drops down to the next code (outside the “with timeout…” or “ignoring…”) and does not wait until work on the main window is completed.

Any technique to get around this problem? I tried to search this forum but could not find any thread that could give me an idea.

Thanks. Your kind help is much appreciated.

archseed :slight_smile:

When the ‘on open’ handler is fired by dropping something on it, capture the dropped files into a property variable. Then, open up your window. In the window, place a control (like a button), that triggers the action you wish to perform on the dropped files and read them back from your property variable to use them…

property theDroppedItems : {}

on open names
	set theDroppedItems to names --> Capture the drop items
	show window "DropletWindow"
end open

on clicked theObject
	if name of theObject is "Continue" then
		log theDroppedItems --> Do something with the files

		set theDroppedItems to {} --> Clean up
		hide window "DropletWindow"
	end if
end clicked



Many thanks, jobu.

That’s a very logical approach and for sure, will work. In retrospect, I was thinking along that line but was not too sure how to store the dropped items temporarily. Gosh! I should have thought of an empty list.

Another thing that I was contemplating is creating a separate script that can be loaded to show the main window, work on it and then continue on to the “on open” handler to trigger the action on dropped items - but I wasn’t sure if it would work or not.

Thanks once more for saving the day.


archseed :smiley: