Finder Module Reference

 

Overview

The Finder module defines functions that you can use to interact with the Finder in a limited fashion. It defines functions to select files, launch applications, open documents and URLs, and move/copy files.

 

Finder Module Method List

The following methods are available in the Pasteboard module:

 

Finder Module Method Descriptions

Finder.selectFile(aFile, aPath)
Selects aFile in a Finder window. If aPath is non-nil, then a new Finder window is created rooted at the path aPath. If it is nil, then the main Finder window is used. Returns true if the operation was successful, false otherwise.

 

Finder.openFile(aFile, anApp)
Asks the Finder to open aFile (which should be a fullpath to a file) using the application identified by anApp. anApp need not be a full path to an application, nor does it have to have the ".app" extension. Returns true if the operation was successful, false otherwise.

 

Finder.openURL(aURL)
Asks the Finder to open aURL. Returns true if the operation was successful, false otherwise. Note that you can specify any type of URL (e.g. a "mailto" url will open the user's mailer to send an email). Returns true if the operation was successful, false otherwise.

 

Finder.moveFiles(someFiles, srcDir, dstDir)
Asks the Finder to move the files in the someFiles array from the source directory srcDir to the destination directory dstDir, both of which are specified as strings. Note that the filenames should be given relative to the source directory, and the destination directory must already exist. Returns true if the operation was successful, false otherwise.

 

Finder.copyFiles(someFiles, srcDir, dstDir)
Asks the Finder to copy the files specified in the someFiles array from the source directory srcDir to the destination directory dstDir, both of which are specified as strings. Note that the filenames should be given relative to the source directory, and the destination directory must already exist. Returns true if the operation was successful, false otherwise.

 

Finder.recycleFiles(someFiles, srcDir)
Asks the Finder to move the files specified in the someFiles array to the trash. The files should be given relative to the source directory srcDir. Returns true if the operation was successful, false otherwise.

 

Finder.deleteFiles(someFiles, srcDir)
Asks the Finder to permanently delete the files specified in the someFiles array. The files should be given relative to the source directory srcDir. Returns true if the operation was successful, false otherwise. Note that this operation is immediate, and cannot be undone.

 

Finder.launchApplication(anApp)
Asks the Finder to launch the application anApp. anApp does not have to be a full path, nor does it need the ".app" extension. Returns true if the operation was successful, false otherwise.