Functions Provided by the Processes Plugin
The following functions are provided by this plugin (click on one to jump to its documentation):
Returns a FolderItem for the frontmost process, the application which is currently active
on the user's desktop.
Example:
Dim f as FolderItem
f = GetFrontProcess( )
MsgBox f.AbsolutePath
This function is most useful when your application is not in the foreground,
but needs to monitor the frontmost application for any reason.
Back to top.
Returns a FolderItem for your application.
Example:
Dim f as FolderItem
f = GetMyProcess( )
MsgBox "My name is " + f.name
Back to top.
Returns a count of all of the processes running at the moment it is called. Includes
both visible and invisible (faceless) processes.
Example:
Dim ct as Integer
ct = CountProcesses( )
MsgBox "There are " + Str( ct ) + " processes running at this time."
This function is frequently combined with the next one, for gathering an array of
folder items, one for every process.
Back to top.
Returns a FolderItem for the Nth process, where n is an Integer between 1 and
the total number of processes running at the time it's called.
Example:
Dim f as FolderItem
Dim n, ct as Integer
ct = CountProcesses( )
n = Rnd * ct
f = GetNthProcess( n )
MsgBox "Process " + Str( n ) + " was launched from " + f.AbsolutePath
Back to top.
Brings the nth process to the front. Usually used in conjunction with GetNthProcess.
Example:
Sub ActivateProcessByCreator( CreatorType as String )
Dim f as FolderItem
Dim n, ct as Integer
ct = CountProcesses( )
for n = 1 to ct
f = GetNthProcess( n )
if ( f.MacCreator = CreatorType ) then
if ( not ActivateNthProcess( n ) ) then
Beep
MsgBox "The application could not be activated."
else
return
end if
end if
next
end sub
Back to top.
Brings the process, whose name you specify, to the front. The name must be as it appears
in the Application Menu (top right corner of the screen). The name is case sensitive.
Example:
if ( not ActivateNamedProcess( "Finder" ) ) then
MsgBox "Surprisingly, the Finder could not be activated. Seth thought this always worked!"
end if
Back to top.
Finds the application with the Creator (app signature) that you specify. Follows the same
basic procedure that the Finder uses when searching for an application to open a file with.
Example:
Dim f as FolderItem
f = FindApplication( "MOSS" )
if ( f <> Nil ) then
f.launch
end if
This example launches Netscape, just as if you'd run the following line of AppleScript (which
can not be reproduced with RB's AppleEvents.
tell application "Finder" to open application file id "MOSS"
Back to top.