realbasic-nug
[Top] [All Lists]

Re: Appleevent stumped

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Appleevent stumped
From: James Sentman <james at sentman dot com>
Date: Thu, 31 May 2007 09:28:08 -0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <465EA0B8 dot 2060306 at communication-unltd dot com>
Are you compiling for Intel of PPC? I have had considerable problems  
bringing my apple event handling code over to Intel. It's not really  
REAL's fault except for not giving us enough event support so that we  
have to resort to declares to do all this. One thing that comes to  
mind is that some OSType values you use for keys are backwards on  
Intel builds. So when you're plugging them into a memory block or an  
OSType field for creating a aedesc or trying to find out the type of  
an aedesc you have to check the BigEndian constant and reverse bytes  
if it's Intel. But check to see what is returned first, do some debug  
output as I'm not sure they ALL are backwards yet. Also getting other  
endian specific data, like dates or numbers out of an aedesc by using  
a memory block you have to endian flip them, or just tell the memory  
block that it's not bigEndian before reading. Again, experimentation  
will be necessary.

I notice also that you're checking for err <> 0, but then you go  
right on to use the created aedesc, you just dont call growlmess().  
Is it possible that your call to AECreateDesc is failing and that  
you're then passing a memory block full of nulls to  
AEPutAttributeDesc? That would also cause a crash of the program.

Some debugging output to a log or the console or something might help  
figure out where things are going south, but there are some non  
trivial things to sort out here if you're compiling for Intel...

  James


On May 31, 2007, at 6:17 AM, Fred Step wrote:

> Hi,
> I've just run into a problem that has me stumped. My program runs fine
> when compiled with 5.5. I've just moved up to 2007 r2. The program  
> runs
> fine when compiled with 2007 r2 as long as I don't use my "remote
> appleevents". As soon as I try and use "remote" appleevents" my POP  
> and
> SMTP stuff goes haywire. For instance I get "-ERR NUll Command "
> followed by the complete email in the server error.
> Here's the code that I use to convert a normal local appleevent into a
> remote
> Sub AEConvertRoutine(anEPPC as string, byref ae as appleevent)
>   dim err as Integer
>   dim aedesc as MemoryBlock
>   dim i as integer
>   dim aeptrx as integer
>   dim list as appleeventdescList
>   dim processid as integer
>
>
>   ae.timeout=15
>
>
>
>   Declare Function AECreateDesc Lib "Carbon" (typeCode as OSType,
> dataPtr as CString, dataSize as Integer, result as Ptr) as Integer
>
>
>   aedesc = NewMemoryBlock(8)
>
>   err = AECreateDesc("aprl", anEPPC, lenb(anEPPC), aedesc)
>   if err <> 0 then
>     growlmess(true,"AEConvertRoutine", str(err))
>   end if
>
>
>
>   Declare Function AEPutAttributeDesc Lib "Carbon" (theAppleEvent as
> integer, theAEKeyword as OSType, theAEDesc as Ptr) as Integer
>
>
>
>   aeptrx = ae.ptr
>   i = AEPutAttributeDesc( aeptrx, "addr", aedesc)
>   if i <> 0 then
>     growlmess(true,"AEConvertRoutine", "Put desc returned "+ str(i))
>   end if
> // growlmess is just a message to Growl
> End Sub
>
> Does anyone have a pointer for me as to what could be going wrong??
>
> Thanks
>
> Fred
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>