Bellhop finder Extension for Python Reference

 

Overview

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

 

Method List for finder Extension

The following methods are available in the finder extension:

 

Method Descriptions for 'finder' Extension

finder.selectfile(aFile, aPath)
Selects aFile in a Finder window. If aPath is not None, then a new Finder window is created rooted at the path aPath. If it is None, 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).

 

finder.movefiles(someFiles, srcDir, dstDir)
Asks the Finder to move the files in the someFiles list 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 list 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 list 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 list. 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.