[futurebasic] Re: [FB] AppleEvent OpenDoc (folder)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2003 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Fri, 16 May 2003 16:25:23 -0400
Thanks Alain. The counting section works, however, as is my problem 
before, AEGetNthPtr does not work. Argh.

Folder or PICT, no luck.

CLEAR LOCAL FN AEReadFile
'~'9
DIM AS INT     i
DIM AS AEDesc  AEDesc
DIM AS FSSpec  fSpec
DIM AS LONG @  count, actualSize, keyWord, rtnType
DIM AS FInfo   info
DIM AS BOOLEAN OKToGo

LONG IF FN AEGetParamDesc( gFBAEEvent, _keyDirectObject, _typeAEList, 
AEDesc ) = _noErr
Stop "Got 1" // Stops here
LONG IF FN AECountItems( AEDesc, count ) = _noErr' how many files were 
dropped?
Stop "Got 2 "+STR$(count) // Stops here, shows count of 1 (which is 
correct, in this case the file is a PICT)
FOR i = 1 TO count
OKToGo = _false
LONG IF FN AEGetNthPtr( AEDesc, i, _typeFSS, keyWord, rtnType, @fSpec, 
SIZEOF(FSSpec), actualSize ) = _noErr
Stop "Got 3 " // Not ever stopping or getting in here it would seem 
here.
LONG IF FN FSpGetFInfo( fSpec, info ) = _noErr
Stop STR$(info.fdType) // and of course not here thusly.
//OKToGo = info.fdType == _"fold"//  Right for a folder?
END IF
IF OKToGo THEN Stop "We OK!"//FN ReadFile( fSpec )
END IF
NEXT
END IF
i = FN AEDisposeDesc( AEDesc )
END IF

END FN

On Friday, May 16, 2003, at 03:24  PM, Alain Pastor wrote:

>
>
> Robert Covington wrote:
>> In Slide Freebie, I have always used FinderInfo to open folders 
>> dragged onto the app icon rather than AppleEvents.
>> However a user has pointed out that AEOpenDoc doesn't work (Ah, 
>> nothing there, was harder to do back then. :) )
>> So I need to implement this so they can run the thing with an 
>> Applescript telling it which folder to open, getting away from 
>> FinderInfo.
>> Example script :
>> Tell Application "Slide Freebie v2.3"
>>  Activate
>>  Open "Test Slides"
>> End Tell
>> Test Slides is a folder. But I can't seem to get that info from the 
>> Apple event for sending on to my search FN.
>> Here's my AEReadDocList, which is called in AEOpenDocument. But I 
>> can't see that I get to the interior portion ever, via AppleScript.
>> Any clarifications or existing examples welcomed.
>
>
> I don't know if that will answer your question but here is what I do 
> in Code Styler (actually I don't know if that works, I don't remember 
> having tested). First you must do this:
>
> KILL APPLEEVENT _kRequiredEventClass, _kAEOpenDocuments
> ON APPLEEVENT ( _kRequiredEventClass, _kAEOpenDocuments ) FN AEReadFile
>
> this installs your own vector.
>
> Then I have this that I have slightly edited to make it clearer. I 
> check the incoming files with their creator code an file type, your 
> test may be different.
>
> CLEAR LOCAL FN AEReadFile
> '~'9
> DIM AS INT     i
> DIM AS AEDesc  AEDesc
> DIM AS FSSpec  fSpec
> DIM AS LONG @  count, actualSize, keyWord, rtnType
> DIM AS FInfo   info
> DIM AS BOOLEAN OKToGo
>
> LONG IF FN AEGetParamDesc( gFBAEEvent, _keyDirectObject, _typeAEList, 
> AEDesc ) = _noErr
> LONG IF FN AECountItems( AEDesc, count ) = _noErr' how many files were 
> dropped?
> FOR i = 1 TO count
> OKToGo = _false
> LONG IF FN AEGetNthPtr( AEDesc, i, _typeFSS, keyWord, rtnType, @fSpec, 
> SIZEOF(FSSpec), actualSize ) = _noErr
> LONG IF FN FSpGetFInfo( fSpec, info ) = _noErr
> OKToGo = ( info.fdType == _"TYPE" AND info.fdCreator == _"CREA")
> END IF
> IF OKToGo THEN FN ReadFile( fSpec )
> END IF
> NEXT
> END IF
> i = FN AEDisposeDesc( AEDesc )
> END IF
>
> END FN
>
> Alain
>
>
>
> --
> To unsubscribe, send ANY message to 
> <futurebasic-unsubscribe@...>
>