• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Droplet W/Changed Creator...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Droplet W/Changed Creator...


  • Subject: RE: Droplet W/Changed Creator...
  • From: Joe Kelly <email@hidden>
  • Date: Thu, 27 Dec 2001 15:49:37 -0800

You can change the applet's creator back to 'dplt' and it should work fine.
Otherwise, you could open each droplet with Script Editor, re-compile them,
and save (to re-compile, type a key and then delete it, press save, and
voila).

A suggestion: to make your life much easier, try something like:


property pAppList : {
{app:"BBEdit",creator:"R*ch"},
{app:"Compress", creator:"DStf"},
...
{app:"XYZ Application",
creator:"XYZA"}
}

Now you have only one table and you can replace all the conditionals with a
couple lines of logic. Since this list is sorted on the app field, lookups
on that field can be optimized by doing a binary search. Of course, you'll
need to modify how you choose from a list (records get really ugly) --
create a list of app names, choose from list, then reverse lookup the chosen
name from the main list? Backwards but effective:

on AskUserForCreatorCode()
set choiceList to {}
repeat with i in pAppList
set end of choiceList to (app of i)
end
set myChoice to choose from list choiceList without multiple
selections allowed
if (class of myChoice is list) then -- otherwise = false = user
canceled
repeat with i in pAppList -- ASS backwards : )
if (application of i is item 1 of myChoice) then
return creator of i
end if
end repeat
end if
return ""
end

So the first half of your script could be re-written:

set the_creator to AskUserForCreatorCode()
if (the_creator is not "")
-- do your thing!
end if

What a difference, eh.

joe



> -----Original Message-----
> From: Peter Bunn [mailto:email@hidden]
> Sent: Thursday, December 27, 2001 2:47 PM
> To: AppleScript Users Mailing List
> Subject: Droplet W/Changed Creator...
>
>
> Hello:
>
> I'm hoping someone can tell me how to 'restore' drag and drop
> capability to a script droplet ('dplt') whose creator type
> has been changed.
>
> I'm trying to write a desktop droplet script (see below) to
> handle a variety of file and creator types... directing files
> to the applications I want... and opening them using
> application file id "abcd"... but 're-creatored' script apps
> refuse to co-operate... will not handle the files passed to
> them... as dropped or even when scripted to do so.
>
> Suggestions on how to correct this or clean up the following
> script - setting initial properties or otherwise - would also
> be welcome. As can be seen, I'm locked into defining a
> never-ending set of 'conditionals' at present.
>
> Any Ideas & Thanks In Advance...
>
> Peter B.
>
> -----
>
> on open (the_selection)
> with timeout of 600 seconds
> tell application "Finder"
> set the_creator to the creator type of
> the selection as text
>
> if exists application file id the_creator then
> set the_name to the name of
> application file id the_creator
> else
> set the_name to ""
>
> choose from list {"BBEdit",
> "Compress", "Dreamweaver", "Editor", "Expand", "IconFix",
> "Missing Link", "MoviePlayer", "Netscape", "Photoshop",
> "ResEdit", "Script Editor", "SimpleText", "SoundApp",
> "Type/Creator"} with prompt ""
>
> if the result is false then
> return
> tell me to quit
> else
> set the_app_name to the
> result as text
> end if
>
> if the_app_name = "BBEdit" then
> set the_creator to "R*ch"
> end if
>
> if the_app_name = "Compress" then
> set the_creator to "DStf"
> end if
>
> if the_app_name = "Dreamweaver" then
> set the_creator to "DmWr"
> end if
>
> if the_app_name = "Editor" then
> set the_creator to "BOBO"
> end if
>
> if the_app_name = "Expand" then
> set the_creator to "SITx"
> end if
>
> if the_app_name = "IconFix" then
> set the_creator to "eIFx"
> end if
>
> if the_app_name = "Missing Link" then
> set the_creator to "ML01"
> end if
>
> if the_app_name = "MoviePlayer" then
> set the_creator to "TVOD"
> end if
>
> if the_app_name = "Netscape" then
> set the_creator to "MOSS"
> end if
>
> if the_app_name = "Photoshop" then
> set the_creator to "8BIM"
> end if
>
> if the_app_name = "ResEdit" then
> set the_creator to "RSED"
> end if
>
> if the_app_name = "Script Editor" then
> set the_creator to "ToyS"
> end if
>
> if the_app_name = "SimpleText" then
> set the_creator to "ttxt"
> end if
>
> if the_app_name = "SoundApp" then
> set the_creator to "SCPL"
> end if
>
> if the_app_name = "Type/Creator" then
> set the_creator to "TYCR"
> end if
>
> open the selection using
> application file id the_creator
>
> end if
>
> if the_name is not "" then
>
> display dialog "Use \"" &
> the_name & "\" To Open This File?" & return & return ,
> buttons {"Cancel", "Use
> Other...", "OK"} default button 3
>
> copy the result as list to
> {the_button_pressed}
>
> if the result is false then
> return
> tell me to quit
> end if
>
> if the_button_pressed is "Use
> Other..." then
>
> choose from list
> {"BBEdit", "Compress", "Dreamweaver", "Editor", "Expand",
> "IconFix", "Missing Link", "MoviePlayer", "Netscape",
> "Photoshop", "ResEdit", "Script Editor", "SimpleText",
> "SoundApp", "Type/Creator"} with prompt ""
>
> if the result is false then
> return
> tell me to quit
> else
> set
> the_app_name to the result as text
> end if
>
> if the_app_name = "BBEdit" then
> set the_creator
> to "R*ch"
> end if
>
> if the_app_name =
> "Compress" then
> set the_creator
> to "DStf"
> end if
>
> if the_app_name =
> "Dreamweaver" then
> set the_creator
> to "DmWr"
> end if
>
> if the_app_name = "Editor" then
> set the_creator
> to "BOBO"
> end if
>
> if the_app_name = "Expand" then
> set the_creator
> to "SITx"
> end if
>
> if the_app_name = "IconFix" then
> set the_creator
> to "eIFx"
> end if
>
> if the_app_name =
> "Missing Link" then
> set the_creator
> to "ML01"
> end if
>
> if the_app_name =
> "MoviePlayer" then
> set the_creator
> to "TVOD"
> end if
>
> if the_app_name =
> "Netscape" then
> set the_creator
> to "MOSS"
> end if
>
> if the_app_name =
> "Photoshop" then
> set the_creator
> to "8BIM"
> end if
>
> if the_app_name = "ResEdit" then
> set the_creator
> to "RSED"
> end if
>
> if the_app_name =
> "SimpleText" then
> set the_creator
> to "ttxt"
> end if
>
> if the_app_name =
> "Script Editor" then
> set the_creator
> to "ToyS"
> end if
>
> if the_app_name =
> "SoundApp" then
> set the_creator
> to "SCPL"
> end if
>
> if the_app_name =
> "Type/Creator" then
> set the_creator
> to "TYCR"
> end if
>
> open the selection
> using application file id the_creator
>
> else
>
> open the selection
> using application file id the_creator
>
> end if
> end if
>
> end tell
> end timeout
> end open
>
> ----------
> _______________________________________________
> 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.


  • Prev by Date: Re: How do we make a simple open folder script?
  • Next by Date: Re: OS 9.2.2 and AppleScript
  • Previous by thread: RE: How do we make a simple open folder script?
  • Next by thread: Scripts edited in X ask for finder.app when run under 9
  • Index(es):
    • Date
    • Thread