Re: Add Droplet functionality to Applet...
Re: Add Droplet functionality to Applet...
- Subject: Re: Add Droplet functionality to Applet...
- From: Tim Bumgarner <email@hidden>
- Date: Mon, 5 Jan 2004 20:08:25 -0500
Hi Matthew,
The problem with the droplet not accepting the drops is likely due to
the fact that your droplet is not set to accept every file type. If you
look at a project that is created as an AppleScript Droplet and you
double click on the target icon which opens the target editor you will
find that under the Document Types section the following entry:
Name: DocumentType
Extensions: "****"
MIME Types:
OS Types: "****"
Icon File:
Document Class:
The "****" entry is a wild card for all file types. If you wanted your
droplet to only accept say image files, you could change the extension
to "jpg" or "jpg", "gif" and that will filter what is allowed as a
drop.
So, you will need to add that entry to your project in order to get
this to work. Once you build the application, you may need to log out
and back in to the system in order for the Finder to pick up this
change.
Hopefully this makes sense.
Tim Bumgarner
AppleScript Engineering
P.S. I believe that if you hold the Option and Command keys down while
dragging the item in the Finder to your application that it will force
the application to accept the drop.
On Jan 5, 2004, at 4:20 PM, Matthew Broms wrote:
Dratz, dratz, DRATZ! I was sure your advice was right on the money,
Tim
(thanks), something I had definitely missed. But alas, still no worky.
This is really driving me nuts - something so seemingly simple taking
a day
to figure out. At this point it would be easier to just start a new
droplet
(that I know will work) and copy over all my code, but I don't know
how to
move my MainMenu.nib file over to a new project with all the hook-ups
being
correct (don9t' want to redesign it). <end venting>
I turned this on as described, recompiled, and no go (I figured you
meant
'not'). Then I turned it off, deleted the 'on open' and 'on idle'
handlers
I had created prior, saved everything, then went back and turned on the
'open' and the 'idle' knowing that it would auto-enter the code it
wants
into my script, and added the inside code so it all looks like this
now:
on open theObject
display dialog "theObject: " & theObject as string
processUpdates(these_items)
end open
-- I assume I don't need this, but put it here just in case it was
-- required (a desparate effort) since the Assistant sets you up with
one
-- when creating a droplet.
on idle theObject
display dialog "I am idle"
end idle
on processUpdates(theFilePath)
display dialog "I'm updating --> theFilePath = " & theFilePath as
string
end processUpdates
I saved everything and even did a 'Clean All Targets'. Despite all of
this,
I cannot drag a file onto the newly compiled applet and have it
highlight
(indicating it will launch with that item). The icon doesn't show the
down
arrow either. The only thing I can think of is that I created this
original project in Xcode 1.x or that the 'on launch' causes some sort
of
conflict?
Something I notice too is that instead of 'on open these_items' as I'm
quite
use to seeing, Xcode enters it as 'on open theObject'. If I could get
it
running, I could figure out the differences.
FYI - I'm on Panther 10.3.1 using AS 1.9.3 and Xcode v1.1.
Matt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: Tim Bumgarner <email@hidden>
Date: Mon, 5 Jan 2004 14:54:44 -0500
To: Matthew Broms <email@hidden>
Cc: AppleScript-Users list <email@hidden>
Subject: Re: Add Droplet functionality to Applet...
Hi Matthew,
You need to make sure you open your MainMenu.nib, select the File's
Owner icon (which represents the application) and go to the
AppleScript
inspector panel and check the "open" event handler. Until that it is
done, the event handler won't execute. That is true for any event
handlers within Studio. Simply having the event handler in the script
is enough, the event handler has to be hooked up to the object in
Interface Builder.
Tim Bumgarner
AppleScript Engineering
On Jan 5, 2004, at 1:40 PM, Matthew Broms wrote:
Thanks for the reply and link to droplets, Gary. I looked over the
whole
page and I'm still a bit confused since it appears that this is
exactly what
I am doing, yet it still doesn't work. Here's my code:
on open these_items
processUpdates(these_items)
end open
on processUpdates(theFilePath)
display dialog "I'm updating --> theFilePath = " & theFilePath as
string
end processUpdates
Nothing to complex here. What's confusing me isn't necessarily that
my code
is wrong, but after compiling an applet and having Xcode "reveal in
Finder"
the applet still doesn't highlight when I drag a text document on top
of it
(as did my simple little test droplet below). I'm OK trying to debug
the
thing, but I can't get it to even trigger the event and launch the
applet/droplet. I've even put in an 'on idle' handler in an effort
to
mimic
what the assistant sets a project up with (had no effect).
Matt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: Gary Lists <email@hidden>
Date: Mon, 05 Jan 2004 12:16:21 -0500
To: AppleScript Users <email@hidden>
Subject: Re: Add Droplet functionality to Applet...
Matthew Broms wrote [01-05-04 10:49 AM]:
Can this be done - can an Applet also be a Droplet?
Matt
Hi Matt. Sure it can. You're on the right track with 'on open', so
it must
be a matter of what you have in that handler. It won't be exactly
the same
as your 'on run' handler (or the main script if you didn't include
'on
run').
Here is a short page from Apple where the droplet shell is shown.
You can
add your specific code as needed.
<http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.09.htm>
Best,
--
Gary
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.