From: Yvon T. <tho...@fr...> - 2006-03-06 09:25:25
|
Hey all, i want to use the Apple Event Manager iget URL. i've allready started to implement the "(void)handleGetURLEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent" in ruby. This method is called when a type-in something like : bmkm:0000000000 in the url field of Safaro or Firefox. the ADC page on that subject says : > Listing 3 Implementation of a get URL Apple event handler > > - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event > withReplyEvent:(NSAppleEventDescriptor *)replyEvent > > { > > // Extract the URL from the Apple event and handle it here. > > } which is a bit short and doen't explain at all how to extract the Url. after some expiremntal work, i've found i've to look at "OSX::NSAppleEventDescriptor.data", it's where i am. if i print-out the event.data.class i get : OSX::OCObject. then, if i print-out it's value i get (shorted) : <646c6532 00000000 61657674 00000138 00000000 00000000 [...] 626d6b6d 3a303030 30303030 30303000 > after i typed in safari "bmkm:0000000000" (ten zeros) the ten lasts "30" is the hex code of the ascii char "0" (zero). i've verified typing-in ten "1" and getting back ten "31". how could i recover my string "bmkm:0000000000" from the above returned value ? i think i have something to do with unpack ? Yvon the full returned "value" : <646c6532 00000000 61657674 00000138 00000000 00000000 0000011c 00000004 00000001 00000000 00000000 00000000 4755524c 4755524c 3d06029f 0000a601 0000a601 00722858 048e8d30 00000000 007908bc 00000000 00000001 001683f7 04ee497b 00000000 04ee7c00 00000014 03a40538 00000001 048e8d60 0000a601 0000a601 00722858 048e8d70 00000000 61657674 00010001 7472616e 6c6f6e67 00000004 00000000 61646472 70736e20 00000008 00000000 024e0001 74627363 70736e20 00000008 00000000 00000000 696e7465 6c6f6e67 00000004 00000070 72657071 6c6f6e67 00000004 00000000 74627363 70736e20 00000008 00000000 00000000 72656d6f 6c6f6e67 00000004 00000000 66726f6d 70736e20 00000008 00000000 024e0001 3b3b3b3b 2d2d2d2d 54455854 0000000f 626d6b6d 3a303030 30303030 30303000 > |