AppleEvents Question 
Author Message
 AppleEvents Question

Hi, I'm trying to hand a URL off to another "helper" Application.

I used AE Tracker to see what the AppleEvent looks like when Netscape
does it & then I looked at mine and they're close but of course mine
doesn't work yet.

My RB Code looks like this

Sub LinkClicked(URl as string)
   Dim a as AppleEvent

   a = NewAppleEvent("SMPc", "SURL", "SNdp")
   a.stringParam("----")=URL
End Sub

The AppleEvent That Nestcape sends (working) Looks like this:

Netscape Communicator  at TickCount: $000205B5
AECreateDesc
Descriptor Type:sign
The Data :  $534E 6470
In ASCII :  SNdp
Results returned....
Descriptor data;
Descriptor Type:sign
The Data :  $534E 6470
In ASCII :  SNdp

Netscape Communicator  at TickCount: $000205B5
AECreateAppleEvent
Creating    Class:  SMPc ID: SURL return ID:  $FFFF transaction ID
:$00000000

Netscape Communicator  at TickCount: $000205B5
AEPutKeyPtr
Descriptor Type:TEXT Key Type :  ----
The Data :  $6874 7470 3A2F 2F32 3038 2E33 372E 3431 2E34 302F
5346 5846 2F44 4158 3033 3032 2D30 335F 3932 5F4A

In ASCII :   http://www.*-*-*.com/

Netscape Communicator  at TickCount: $000205B5
AESend
Send mode:  $00000051 Priority :  $0000Timeout:$FFFFFFFF
The Data :  $6165 7674 21E2 A120
In ASCII :  aevt!

Netscape Communicator  at TickCount: $000205B6
AEDisposeDesc
Descriptor Type:sign

Netscape Communicator  at TickCount: $000205B6
AEDisposeDesc
Descriptor Type:aevt

Netscape Communicator  at TickCount: $000205B6
AEDisposeDesc
Descriptor Type:null

SoundMachine Pro 1.0d132 at TickCount: $000205D5
AEProcessAppleEvent
Class:  SMPc ID: SURL
//////////////////////////////////////////////////

The AppleEvent that my code generates (not working) Looks like this:

REALbasic 3.2.1 PPC at TickCount: $0001ECD4
AECreateDesc
Descriptor Type:sign
The Data :  $534E 6470
In ASCII :  SNdp
Results returned....
Descriptor data;
Descriptor Type:sign
The Data :  $534E 6470
In ASCII :  SNdp

REALbasic 3.2.1 PPC at TickCount: $0001ECD8
AECreateAppleEvent
Creating    Class:  SMPc ID: SURL return ID:  $FFFF transaction ID
:$00000000

REALbasic 3.2.1 PPC at TickCount: $0001ECDD
AEDisposeDesc
Descriptor Type:sign

REALbasic 3.2.1 PPC at TickCount: $0001ECE1
AEPutKeyPtr
Descriptor Type:TEXT Key Type :  ----
The Data :  $6874 7470 3A2F 2F32 3038 2E33 372E 3431 2E34 302F
5346 5846 2F44 4158 3033 3032 2D30 335F 3932 5F4A

In ASCII :   http://www.*-*-*.com/

REALbasic 3.2.1 PPC at TickCount: $0001ECE6
AEDisposeDesc
Descriptor Type:aevt

REALbasic 3.2.1 PPC at TickCount: $0001ECEA
AEDisposeDesc
Descriptor Type:
///////////////////////////////////////////////////////

I don't know where I'm going wrong, perhaps I shouldn't be using
StringParam ?

Any help will be appreciated.

Thanks

Remove "remove" to reply by e-mail



Sat, 31 Jan 2004 13:38:02 GMT  
 AppleEvents Question

Quote:

> Hi, I'm trying to hand a URL off to another "helper" Application.

> I used AE Tracker to see what the AppleEvent looks like when Netscape
> does it & then I looked at mine and they're close but of course mine
> doesn't work yet.

> My RB Code looks like this

> Sub LinkClicked(URl as string)
>    Dim a as AppleEvent

>    a = NewAppleEvent("SMPc", "SURL", "SNdp")
>    a.stringParam("----")=URL
> End Sub

Firstly, you can use RB's native ShowURL method, as in:

ShowURL("http://www.mile23.com/")

This does all the work for you; you just hand it a URL, and it launches
whichever helper app is needed for it, and tells it to go to that URL
with a GetURL AppleEvent ('GURL').

Secondly, the GetURL event itself works like this:

        ae = newAppleEvent("GURL","GURL",MacCreator)
        ae.StringParam("----") = url
        if tofile <> nil then
          ae.FolderItemParam("to  ") = tofile
        end if
        if not ae.Send then
          // something bad happened
        end if

You have to specify which app to send the event to with the MacCreator,
and then fill in your URL. You can optionally specify a file for
downloading with the 'to  ' parameter. If you do this, you end up
telling the target app to get the url data and store it in the 'to  '
file, which it may or may not actually be able to do.

HTH.

--
"In a world full of lies/That tug at the truth
 I'm taking no sides/Now I recognize you.." --DS



Sat, 31 Jan 2004 14:38:42 GMT  
 AppleEvents Question

Quote:


> > Hi, I'm trying to hand a URL off to another "helper" Application.

> > I used AE Tracker to see what the AppleEvent looks like when Netscape
> > does it & then I looked at mine and they're close but of course mine
> > doesn't work yet.

> > My RB Code looks like this

> > Sub LinkClicked(URl as string)
> >    Dim a as AppleEvent

> >    a = NewAppleEvent("SMPc", "SURL", "SNdp")
> >    a.stringParam("----")=URL
> > End Sub

> Firstly, you can use RB's native ShowURL method, as in:

> ShowURL("http://www.mile23.com/")

> This does all the work for you; you just hand it a URL, and it launches
> whichever helper app is needed for it, and tells it to go to that URL
> with a GetURL AppleEvent ('GURL').
> Secondly, the GetURL event itself works like this:

>         ae = newAppleEvent("GURL","GURL",MacCreator)
>         ae.StringParam("----") = url
>         if tofile <> nil then
>           ae.FolderItemParam("to  ") = tofile
>         end if
>         if not ae.Send then
>           // something bad happened
>         end if

I had ShowURL working, but it seemed that it always wanted to involve
the browser. I guess I wasn't clear in my first message. I want to send
these URLs specifically to the one app with the creator SNdp. Not to a
whole host of different helper apps. I want it to work on every users
machine without having to mess with that awful, buggy Internet control
panel.

Can this be done? Was I close with my original code?

On further ispection it looks like my method wasn't issuing the AESend.

I got that SURL AppleEvent from the author of the program I'm trying to
communicate with, that is how he told me to send URLS to his program, I
don't think he implemented GetURL. Or I'm not yet understanding how
GetUrl works.

Thanks



Sat, 31 Jan 2004 23:21:40 GMT  
 AppleEvents Question

Quote:

> Sub LinkClicked(URl as string)
>    Dim a as AppleEvent

>    a = NewAppleEvent("SMPc", "SURL", "SNdp")
>    a.stringParam("----")=URL
> End Sub
> I don't know where I'm going wrong

Well, did you want to *send* this Apple event? It isn't going to do
anything until you send it. Right now, you're just forming it and then
throwing it away. m.

--

*** REALbasic, The Definitive Guide! ***
http://www.oreilly.com/catalog/realbasic/



Sat, 31 Jan 2004 23:30:28 GMT  
 AppleEvents Question

[..]

Quote:
> On further ispection it looks like my method wasn't issuing the AESend.

ae.send is kinda important. :-)

--
"In a world full of lies/That tug at the truth
 I'm taking no sides/Now I recognize you.." --DS



Sun, 01 Feb 2004 02:39:14 GMT  
 AppleEvents Question
In article

Quote:



> > Sub LinkClicked(URl as string)
> >    Dim a as AppleEvent

> >    a = NewAppleEvent("SMPc", "SURL", "SNdp")
> >    a.stringParam("----")=URL
> > End Sub
> > I don't know where I'm going wrong

> Well, did you want to *send* this Apple event? It isn't going to do
> anything until you send it. Right now, you're just forming it and then
> throwing it away. m.

Yup, i did indeeed want to send it, just for the benefit of anyone else
who's listening. I thought that

"if not a.send Then"

that I saw in the examples was just a tally to see if it was sent, I
didn't understand that it did the sending, but as soon as I added it it
worked. This part of the documentation is sketchy

Thanks



Sun, 01 Feb 2004 04:23:44 GMT  
 AppleEvents Question

Quote:

> worked. This part of the documentation is sketchy

Not if you're looking at chapter 31 if my book. (Sorry, couldn't resist.
Okay, I'll shut up now. Sort of.) m.

--

*** REALbasic, The Definitive Guide! ***
http://www.oreilly.com/catalog/realbasic/



Sun, 01 Feb 2004 05:43:24 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. AppleEvents, how ???

2. Error Codes of AppleEvents

3. AppleEvents

4. Appleevents Object Specifier Problem

5. AppleEvents for XML-RPC & SOAP

6. capture AppleEvents in MacOS X

7. AppleEvents

8. Appleevents in RB, help with subj;

9. Builing some AppleEvents

10. launching an RB app from another RB app - appleevents

11. AppleEvents objects...

12. no PictParam for AppleEvents?

 

 
Powered by phpBB® Forum Software