AppleScript Studio: Creating a Droplet Application

These are some sample steps for creating a Droplet application in AppleScript Studio. This application will examine the file information for any files dropped on it and display a dialog containing some of it. Begin your project with an AppleScript droplet. You can add an 'on launched' handler to your script. In Interface Builder deselect "Visible at launch time" (for your main window) in the info palette. If the droplet is double clicked, the InternList will be empty and your main window be shown. If something is dropped on the script, the variable InternList is not empty any longer and the main window stays hidden.

-- Application.applescript
propertyInternList:{}
propertytheTotal:""
onidle
(* Add any idle time processing here. *)
endidle

onopennames
repeatwitha_fileinnames
settheTotaltocountofnames
tellapplication"Finder"
copypropertiesoffilea_filetotheendofInternList
endtell
endrepeat
repeatwithifrom1totheTotal
display dialog"FileName: "&(displayed nameofitemiofInternListasstring)&"
Created: "&(creation dateofitemiofInternListasstring)&"
File Size:"&(round(sizeofitemiofInternListasinteger))&" File Type:"&(file typeofitemiofInternListasstring)
endrepeat
-- Remove the following line if you want the application to stay open.
quit
endopen

on launched
if InternList is {} then
set visible of window "main" to true
end if

end launched

Studio Log

Back