Bellhop Ruby Extensions Reference

 

Overview

The built-in Bellhop Ruby Execution Context plug-in uses a custom Ruby extension that contains three modules that are automatically made available to your Ruby services: Pasteboard, Panel and Finder. You do not have to do anything special to use the methods in these modules. Each of these modules allow your services to interact with the Mac OS X services system from within your scripts. You can use them as you would any other Ruby module.

 

The Pasteboard Module

The Pasteboard module defines functions and constants that allow you to query the services pasteboard for its contents, as well as put data back onto it. It mimics the methods of NSPasteboard class in the Cocoa frameworks, with some differences. The most notable difference is that all methods in the module take the name of the pasteboard that is to be queried or altered. Additionally, all of the global constants that are used to define pasteboard types are available to your Ruby scripts using the same symbolic names as defined in the Cocoa frameworks (e.g. NSStringPboardType).

 

The Panel Module

The Panel module defines functions that you can use to display various GUI panels to users. You can choose from prompt panels, alert panels, list panels and file open/save panels. In addition to the functions to create the panels, there are a few global constants that are defined to indicate the return values for some of the dialog box panels. These constants mimic those defined in the Cocoa frameworks (e.g. NSAlertDefaultReturn).

 

The Finder Module

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.