Re: Re: Droplet W/Changed Creator... (Solved, In Part)
Re: Re: Droplet W/Changed Creator... (Solved, In Part)
- Subject: Re: Re: Droplet W/Changed Creator... (Solved, In Part)
- From: macgix <email@hidden>
- Date: Sat, 29 Dec 2001 14:35:47 +0100
am 29.12.2001 06:11 Uhr schrieb email@hidden
unter email@hidden:
>
>
For what it's worth, I discovered (or re-discovered? I disremember) how
>
to restore drag and drop ability to an AS droplet whose creator has been
>
changed...
>
>
Simply match the BNDL signature to the new creator type in ResEdit. (A
>
desktop rebuild {or a pass through AKUA's 'IconFix'} may also be required
>
before the droplet can be used.)
>
>
The re-creatored droplet can now be used normally, but more importantly,
>
now I can 'ask' a script app with a unique creator to (for instance):
>
>
open this_item using application file id "WXYZ"
>
>
...rather than specifying the disk location of the script app as a 'dplt'.
>
>
So it's old news for most of you. I was pleased.
>
>
Peter B.
With the following script modified and haveing a ResEdit ressource file
prepared already and placed within the same folder as the script (saved as
an droplet) you may automate the setting of the BNDL ressource and of your
custom icon (needs Ressource Utilities and BetterInfoFor OSAXes):
on run
set xa to (choose file)
mvRes(xa)
end run
--
on open xa
repeat with b in xa
my mvRes(b)
set x to b as text
set BundleBitInfo to bi_HasBundle of (betterInfoFor x returning
{bi_HasBundle:1})
if BundleBitInfo then
setBetterInfoFor x setting {bi_HasBundle:false}
else
setBetterInfoFor x setting {bi_HasBundle:true}
end if
end repeat
end open
end open
--
on mvRes(x)
set x to x as text
set tRef to my GetParFolPath(path to me as text) & "Langler_build.rsrc"
set rf to res open tRef
try
set tRes4 to res get rf id 128 type "icl4"
set tRes5 to res get rf id 128 type "icl8"
set tRes6 to res get rf id 128 type "ICN#"
set tRes7 to res get rf id 128 type "ics#"
set tRes8 to res get rf id 128 type "ics4"
set tRes9 to res get rf id 128 type "ics8"
set tRes11 to res get rf id 1 type "vers"
set tRes1 to res get rf id 128 type "BNDL"
on error number n
res close rf
error number n
end try
res close rf
set LanglerRef to res open x with write permission
try
try
res delete LanglerRef id 128 type "BNDL"
res delete LanglerRef type "vers"
end try
res put LanglerRef type "icl4" id 128 data tRes4
res put LanglerRef type "icl8" id 128 data tRes5
res put LanglerRef type "ICN#" id 128 data tRes6
res put LanglerRef type "ics#" id 128 data tRes7
res put LanglerRef type "ics4" id 128 data tRes8
res put LanglerRef type "ics8" id 128 data tRes9
res put LanglerRef type "vers" id 1 data tRes11
res put LanglerRef type "BNDL" id 128 data tRes1
on error number n
res close LanglerRef
error number n
end try
res close LanglerRef
tell application "Finder" to set creator type of file x to "MGX4"
end mvRes
--
on GetParFolPath(the_filepath)
set the_filepath to the_filepath as text
set x to the offset of ":" in (reverse of every character of
the_filepath) as string
set the_filepath to (characters 1 thru -(x) of the_filepath) as text
end GetParFolPath
--
on getFileName(the_filepath)
set the_filepath to the_filepath as text
set x to the offset of ":" in (reverse of every character of
the_filepath) as string
return ((characters -(x - 1) thru -1 of the_filepath) as text)
end getFileName
--
Thomas
____________________________________
Thomas Johannes Matthias Kuehner
<email@hidden>
<
http://www.macgix.de>