[futurebasic] Re: [FB] Check and process Incoming files help with FINDERINFO

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2008 : Group Archive : Group : All Groups

From: "Pierre Zippi" <pierrezippi@...>
Date: Mon, 29 Sep 2008 15:36:03 -0500
Thanks again. I was able to transplant and modify the code. I'm even
starting to catch on to the FSSpec files lingo.

On Mon, Sep 29, 2008 at 2:43 PM, Robert Purves <listrp@...> wrote:
>
> Pierre Zippi wrote:
>
>> This is on the same theme with FSSpec you guys helped me with.
>> Below is the code I used to check for a double-clicked file that
>> launched the app.
>> How should I update this?
>>
>> '--------
>> clear LOCAL                              'checks files passed to us from
>> finder
>> DIM 31 fname$(4)                      'dim arrays to hold incoming
>> DIM type& (4)                             'file information
>> DIM volRefNum% (4)                 'maximum of nine files (0-8)
>> LOCAL FN checkIncomingFiles '<----------------------------
>> DEFSTR LONG
>> doWhat = FINDERINFO (fileCount%, fname$(0), type&(0), volRefNum%(0))
>> fileCount%=1                                           '!!! limit to 1
>> since app has only 1 wnd
>> LONG IF fileCount% > 0                          'if zero then nothing to
>> do
>> IF fileCount% > 8 THEN fileCount% = 8 'constrain to 9 maximum
>> FOR count = 0 TO fileCount% - 1            'count incoming files
>> LONG IF type&(count) = _"TEXT"           ' is it our file type?
>>       'SELECT doWhat                            'ok, what should we do?
>>       'CASE _openFiles
>>       'FN ReadMultiSet(fname$(count),volRefNum%(count))  ' OLD FN
>> FN ReadMultiSet(fname$(count),@fs)                                     '
>> NEW FN
>> FN CalcStats
>> FN PlotBuild
>> FN MakeCharts
>> END IF
>> NEXT
>> END IF
>> END FN
>
>
>
>
> The FB4 'on FinderInfo ...' is illustrated below.
>
> '---------------------
> local fn MyOpenTextFile( f as ^FSSpec )
> '~'1
> dim as FSSpec localCopySpec
>
> BlockMoveData( f, localCopySpec, sizeof( FSSpec ) )
> open "I", 1, @localCopySpec
> //...
> close 1
> end fn
>
> local mode
> local fn MyFinderInfo
> '~'1
> dim as FSSpec f
> dim as OSType @ fType
> dim as short @ count, action, j
>
> count = 0 // set to ask "How many?"
> action = FinderInfo( count, f, fType )
> long if ( count > 0 ) // at least one file wants in
> for j = -1 to -count step -1 // process them all
> action = FinderInfo( j, f, fType )
> long if ( action == _finderInfoOpen )
> select fType
> case _"TEXT" : fn MyOpenTextFile( f )
> //case _"PICT" : fn MyOpenPictFile( f )
> end select
> end if
> next
> fn ClearFinderInfo // in Subs Common.Incl
> end if
> end fn
>
>
> // Main program
> '~'1
> on FinderInfo fn MyFinderInfo
> do
> HandleEvents
> until ( gFBQuit )
> '------------------
>
> Robert P.
>
> --
> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>
>