I’m trying to convert an AS application (droplet) to an ASStudio app.
This loads a movie into the movieView if I drop a file on the imageView in the app, but I would like to know how to get it to work by dropping a file on the application’s icon itself. Is there a good example somewhere of how to do that?
on drop theObject drag info dragInfo
set dataTypes to types of pasteboard of dragInfo
if "file names" is in dataTypes then
set preferred type of pasteboard of dragInfo to "file names"
set thePaths to contents of pasteboard of dragInfo
set theSound to (item 1 of thePaths)
set movie of movie view "audioController" of window "main" to load movie theSound
Is the problem you’re having that the application icon won’t “highlight” or accept files that you want to drop onto it?
If so, the difference is in the Document settings of the Info.plist of the Target executable (or something like that). Open a new ASStudio droplet project, a new ASStudio application project, and then hit Command-Shift-E for each one. Click on the “Info.plist Entries” for each one and compare the differences (specifically the “Document Types” entries). You’ll have to copy and paste the Document Type from the droplet project over to the application project for that one to register dropped-on files.
Also, I just recently discovered an incredible time saver. The “templates” that Xcode uses for projects are located in
/Library/Application Support/Apple/Developer Tools/Project Templates/Application/
If you’d like to make all ASStudio application projects have that “droplet-type” setting, just duplicate the existing “AppleScript Application” folder, open the project inside it, and customize all the settings in it to suit you for your default project settings. Most settings are saved like window size, which disclosure triangles are expanded, etc.
Hope this helps…
That does allow me to have the icon hilight when a file is dropped on it, but it doesn’t help to get that(those) files opened in the program for processing.
Do you know what that code would look like? Any examples of this anywhere?
Thanks again, Jim
Ahh, that’s right, lol. I guess I went off on that “customizing” tangent and forgot all about the script. Wait a sec, you’re converting your regular AppleScript droplet to an AppleScript Studio droplet? I guess that’s where I got mixed up. It’s actually fairly easy, and I’m in the midst of doing the same thing with an application of mine.
You use the “on open” event handler for the “File’s Owner” that you select in Interface Builder. The code then should probably be quite similar to the “on open” code of your regular AS droplet. Be sure to include a “return true” at the end of it so it doesn’t crash on you.
The “on open” receives (I think) the files in a colon-style path as opposed to a POSIX-form like the Cocoa objects do. So if you want to load the dropped-on movie into a movie view (which needs POSIX-style paths), you might have to use “POSIX path of” on the dropped on file.
Hope this helps…