Associating filetypes (was: Making a 'droplet' application?)

Ian Wood ian at azurevision.co.uk
Mon Feb 23 06:44:54 EST 2004


Thanks for that, I've managed to get the filepath of the JPEG used to 
launch my app, but I had to use "open with".

Having read the docs & archives on file associations, I altered the 
.plist file to add image file associations (only JPEG so far), but was 
stumped for awhile, as the association didn't kick in until I copied 
the standalone to another computer, where the application prebindings 
were presumably updated on the spot.  Oddly enough, dumping the 
standalone in the Trash and then moving it back out did the job on the 
original computer...

For anyone else trying this on OS X, the relevant part of the .plist is:

	<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeExtensions</key>
			<array>
				<string>jpg</string>
				<string>jpeg</string>
			</array>
			<key>CFBundleTypeIconFile</key>
			<string>RevolutionDoc.icns</string>
			<key>CFBundleTypeMIMETypes</key>
			<string></string>
			<key>CFBundleTypeName</key>
			<string>JPEG image</string>
			<key>CFBundleTypeOSTypes</key>
			<array>
				<string>JPEG</string>
			</array>
			<key>CFBundleTypeRole</key>
			<array>
				<string>image/jpeg</string>
			</array>
		</dict>
-- You can add another <dict></dict> set of tags at this point for 
other filetypes.
	</array>

The handler in the stack script used to catch the AppleEvent was:

on AppleEvent
	request appleEvent ID
	if it = "odoc" then
		request appleEvent data
		put it into aeFilePath
	end if
	pass appleEvent
end appleEvent

Ian

On 23 Feb 2004, at 03:41, Sarah Reichelt wrote:

> You will need to set up an AppleEvent handler in your stack script 
> that recognises when a document is dropped on it, gets the name of the 
> document(s) and processes them. You may also need to set up a defined 
> file type. I think there have been discussions about this on the list 
> in the past, so search the archives as well as checking the docs for 
> AppleEvent.
>
> Cheers,
> Sarah
>
<snip>
>> What I would like to do is make this even more transparent by 
>> dropping files onto the app icon, in the same way that you can with 
>> AppleScript droplets.  I can't see anything in the docs or list about 
>> this, and am wondering if it is even possible with Rev 2.1.2.
>>
>> Workaround- make an AppleScript droplet that takes the list of 
>> dropped files and launches the Rev app, but this is kind of 
>> inelegant...
>>
>> Ian



More information about the use-livecode mailing list