Re: Error with GURL/GURL
Re: Error with GURL/GURL
- Subject: Re: Error with GURL/GURL
- From: Bernard Desgraupes <email@hidden>
- Date: Mon, 21 Jun 2004 20:23:25 +0200
Christopher Nebel wrote:
tell application "Finder"
open location "http://sourceforge.net/projects/rezilla"
end tell
I get an error, something like "Some data do not have the correct type"
Specifically, it thinks it should handle it as a WebDAV mount, which
of course it isn't, hence the error. In general, telling a particular
application to "open location" will not do what you want, unless what
you wanted was *that particular application* to open it.
If you're doing this from C, then you should be aware that "open
location" is really just a wrapper around LSOpenCFURLRef, which would
be much more efficient and will always open the URL in the preferred
application for "http" URLs no matter what weird GURLGURL handlers are
lurking about.
Thanks for the explanation. I'll use LSOpenCFURLRef as you suggest. I
was not aware it would open the preferred browser automatically.
If you're writing in C, calling AppleScript is usually not the right
thing to do unless you're actually trying to run a non-trivial script.
In fact I was not using AppleScript. This AppleScript was just a way for
me to test why I did not get what I want. I was using an AppleEvent
directly (but wrongly targetting the Finder instead of System Events).
My code, which works now, is basically like this
OSType theSignature = 'sevs';
error = AEBuildAppleEvent(
'GURL', 'GURL',
typeApplSignature, &theSignature, sizeof(OSType),
kAutoGenerateReturnID, kAnyTransactionID,
&theEvent,
NULL,
"'----':'TEXT'(@)", urlCString);
Anyway LSOpenCFURLRef() sounds great.
Thanks
Bernard
_______________________________________________
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.