[ SOLVED ] Getting mad with simple applescript handling (kAEGetURL)
[ SOLVED ] Getting mad with simple applescript handling (kAEGetURL)
- Subject: [ SOLVED ] Getting mad with simple applescript handling (kAEGetURL)
- From: Yann Bizeul <email@hidden>
- Date: Wed, 18 Jun 2003 09:37:48 +0200
Thanks to Stiphane and Greg that solved my problem, and thanks to
others for their help !
Note to Stiphane : keyDirectObject is a constant for '----'
So, the simple way to get the URL when your application is launched as
a helper is to register for the applevent :
[[ NSAppleEventManager sharedAppleEventManager ]
setEventHandler: self
andSelector: @selector(getUrl:withReplyEvent:)
forEventClass: kInternetEventClass
andEventID: kAEGetURL ];
And get the url in :
- (void)getUrl:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
with:
NSString *url = [[ event paramDescriptorForKeyword: keyDirectObject ]
stringValue ];
Applescript logic is a bit clearer for me, but sill confusing...
Le mardi, 17 juin 2003, ` 21:01 Europe/Paris, Greg Robbins a icrit :
>
At 4:54 PM +0200 6/17/03, Yann Bizeul wrote:
>
> - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:
>
> (NSAppleEventDescriptor *)replyEvent;
>
> ....can somebody tell me where to get the URL ?
>
>
Try
>
>
NSString* url = [[event descriptorForKeyword:keyDirectObject]
>
stringValue];
>
>
per <http://www.scripting.com/midas/geturl.html>:
>
>
---
>
Suite name: URL Suite
>
Suite description: Standard suite for Uniform Resource Locators
>
Suite code: 'GURL'
>
>
The geturl Event
>
>
geturl: Get a URL and display it in a window or save it to a file
>
geturl string -- the URL
>
[to <file>] -- destination file
>
Result: small integer -- result code
>
>
Event class: 'GURL'
>
Event id: 'GURL'
>
Direct object parameter type: 'TEXT' (typeChar)
>
Optional destination file parameter:
>
keyword: 'dest'
>
type: 'fss ' (typeFSS)
>
Result type: 'shor' (typeShortInteger)
>
---
>
>
Greg Robbins
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
>
>
--
Yann Bizeul
TYNSOE.ORG -
http://www.tynsoe.org/
Site technique consacri ` MacOS X
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.