Selecting Scripts

    The lower section of the Event Editor lets you define what script will be run by the Event.

    Note: iDo Script Scheduler can run AppleScripts which have been saved as "compiled scripts" and "applications" or "applets". See troubleshooting tips for more details.

    In Mac OS X, iDo Script Scheduler can also run Unix shell, Perl, Python, Ruby and Tcl/Tk scripts. In order to recognize them, these scripts must be saved with filenames ending with ".sh", ".pl", ".py", ".rb" and ".tcl" extensions, respectively.

    Click the "Choose..." button to choose which script to run, or drag a script from a Finder window into this area.

    The "Edit..." button gives you a convenient way to edit your script. Clicking this button opens the chosen script in the appropriate application (usually Script Editor for AppleScripts, or TextEdit for Unix scripts).

    Note: The "Edit..." button is disabled for AppleScripts saved as applications. To edit these scripts, drag them onto the Script Editor or use the Script Editor's "Open Script..." command.

Parameters

    You may type a line of parameters to be passed to your script. With AppleScripts, you can pass any number of parameters separated by commas. With Unix scripts, the parameters are separated by spaces. String parameters which contain spaces or commas must be enclosed in quotation marks.

    AppleScripts
    To use parameters with AppleScripts, your script must be saved as a "compiled script", and the code must be enclosed in a "run" handler which includes a list of parameters. For example, a simple AppleScript which plays a "beep" sound could be told the number of times to play this sound as follows:

       on run (theCount)
          repeat theCount times
             beep
          end repeat
       end run

    To use this script, create an event and put any number into the parameter field.

    Unix scripts
    To use parameters with shell, Perl, Python, Ruby and Tcl/Tk scripts, your script uses the same methods as if they were entered from the command line. For example, a simple shell script that adds a message to the system log could be told the message to display as follows:

       #!/bin/tcsh
       logger $1

    To use this script, create an iDo Script Scheduler event and put any text message into the parameter field. (If the desired message includes spaces, it must be enclosed in quotation marks, or "$1" will only return the first word.)

Related topic


Table of contents