FutureBasic Logo

<<    Index    >> FutureBasic 5

FinderInfo   function



Syntax:
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:
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:

action constantDescription
_finderInfoOpen (0)This file should be opened
_finderInfoPrint (1)This file should be printed
_finderInfoErr (2)An error occurred. One possible reason is that the program attempted to retrieve an indexed item that was out of range.

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

countVarDescription
< zeroAn index into the list. The first item is -1, the next is -2, etc.
zeroThe return value will be placed in countVar. It will be the total number of items available. This is reset to zero when you call Fn ClearFinderInfo.
> zeroIn this case, countVar indicates the maximum number of entries that your program can accept. If you dimension an array to hold 10 elements, then the maximum would be 11 (10 + element zero). If you use 1, then the information can be placed in simple variables.

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."

nameVar$$This must be a "short string" simple variable or array element.

If you specify a maximum greater than 1 in countVar%, then you must specify an array element in nameVar$, and the array must be dimensioned at exactly 31 characters per string. The names of the documents are returned into consecutive elements in the array, starting at the element you specify.

If you specify 1 in countVar%, then you can use a simple string variable for nameVar$, dimensioned to at least 31 characters. The name of the document is returned in this variable.
typeVar&This must be a long integer simple variable or array element.

If you specify a maximum greater than 1 in countVar%, then you must specify an array element in typeVar&. The 4-byte document type codes are returned into consecutive elements in the array, starting at the element you specify.

If you specify 1 in countVar%, then you can use a simple long integer variable for typeVar&. The type code of the document is returned in this variable.
dirRefNumVar%This must be a short integer simple variable or array element.

If you specify a maximum greater than 1 in countVar%, then you must specify an array element in dirRefNumVar%. The directory reference numbers for the documents are returned into consecutive elements in the array, starting at the element you specify.

If you specify 1 in countVar%, then you can use a simple short integer variable for dirRefNumVar%. The directory reference number for the document is returned in this variable.

A document's directory reference number indicates what directory the document is in. This will either be a volume reference number (in which case the document is in the volume's root directory), or a working directory reference number.

Note:
Before your application can support Finder-launched documents, you need to set up certain special tags in the "Info.plist" file in your application's bundle.

See Also:
on FinderInfo