Futurebasic/Language/Reference/finderinfo

From Wikibooks, open books for an open world
Jump to navigation Jump to search

FINDERINFO function[edit | edit source]

FINDERINFO[edit | edit source]

Function[edit | edit source]

✔ Appearance ✔ Standard ✔ Console

Syntax[edit | edit source]

Move all waiting items to arrays or simple variables

countVar = maxAcceptableentries
action = ¬
  FINDERINFO(countVar%, nameVar$, typeVar&, dirRefNumVar%)

Find out how many items are waiting to be picked up

countVar = 0
action = ¬
  FINDERINFO(countVar%, nameVar$, typeVar&, dirRefNumVar%)

Pick up an indexed item from the list

countVar = negativeIndex
action = ¬
  FINDERINFO(countVar%, nameVar$, typeVar&, dirRefNumVar%)

Gather a list of file spec records

countVar = maxAcceptableentries
action = ¬
  FINDERINFO(countVar%, @FSSpec[(array)],@OSType&[(array)], dirRefNumVar%)

Clear the list

FN CLEARFINDERINFO

Description[edit | edit source]

If the user launched your application by double-clicking a document icon, or by dragging document icon(s) to your application's icon, or by selecting document icon(s) and then selecting "Open" or "Print" from the Finder's "File" menu, then you can use the FINDERINFO function to determine which document file(s) were involved, and whether they should be opened or printed.

You should call FINDERINFO once, soon after your program starts. You should also check during null events to see if additional files have been added to the list. This can take place when an _openDoc event is sent from another application or when the user drags a file onto the icon of your running application.

action - The result of the FINDERINFO function is one of the following:

Image was here.

countVar - This variable is used to send a value to and receive a result from FINDERINFO

Image was here.

The parameters for FINDERINFO are used to both send and receive values. In order to send a value of "1" for the count, you must first set the variable, then check it on return.

count% = 0
action = FINDERINFO(count%,fName$,fType&,vRefNum%)
PRINT "There are" count%" files in the queue."

Image was here.

Note:
Before your application can support Finder-launched documents, you need to set up certain special resources (BNDL and FREF) in your application's resource fork. Also, FINDERINFO will not work unless the "High-level event aware" flag is turned on in your application's SIZE resource #-1. See the "Finder Interface" chapter in Macintosh Toolbox Essentials for more information.