Applescript droplet With an interface

I have created the following using xcode:
A New Applescript droplet called “InterfaceDroplet”
I then created a window with a single button called “goButton” which i have activated to look at the application.applescript on action>clicked

the applescript is as follows:

on idle
	(* Add any idle time processing here. *)
end idle

on open names
	(* Add your script to process the names here. *)
	
	-- Remove the following line if you want the application to stay open.
	quit
end open

on clicked theObject
	(*Add your script here.*)
end clicked

can anyone please tell me the appropriate way of setting up this application so that:
a.) the window is displayed when files are dragged and dropped onto the droplet
b.) when the droplet is just clicked and opened it displays a dialog box saying “please drag and drop files onto the droplet” instead of opening the window.
c.) when the goButton is clicked display a count of how many files were dropped onto the app.

Thanks in advance :slight_smile:

Hi,

for this purpose an AppleScript Studio application is oversized
This does what you want, using plain AppleScript, save the script as application


on open names
	display dialog "Display number of dropped files" buttons {"Cancel", "goButton"} default button 2
	display dialog (count names) as text
end open

on run
	display dialog "Please drag and drop files onto the droplet" buttons {"OK"} default button 1 giving up after 3
end run

Hi Stefank
Thanks for the reply!
I agree with you entirely!

Unfortunately I am just using this as an example of the problem I am experiencing. I have tried to simplify the problem to make it a bit easier and more self-evident, rather than copying and pasting my whole big mess of an application into this forum. Also as my menu is quite complicated it would be much better to use xcode.

I think the main problem might even be narrowed down to how can i keep the variable names (the images that were dragged and dropped on the droplet) and use this variable when a button is clicked?

Thanks :smiley:

ok i was able to get around this problem by creating a hidden junk text field in my interface and setting it’s contents to names on open names. you can then access this data when you click the button…