Logo2
Logo
bigstockphoto_Businesswoman_Sit_With_Noteboo_227734
 

Infos

The Scripts Editor

Scripts are a new feature for Opus 5.5. A Script is a special type of
Opus button which is invoked when a specific event occurs. As
with Opus buttons, menus and hotkeys, Scripts may define a set
of instructions which include any mix of AmigaDOS, Workbench,
ARexx, script or internal Opus 5 commands.
Opus can call a Script whenever any of the following system
events occur:-
Bad disk inserted: Activated whenever a disk of unknown
format is inserted into any floppy drive. As an example, this
Script could be used to prompt the user to format the disk.
Close buttons: Activated whenever a Button Bank is closed.
Close group: Activated whenever a Group window is closed.
Close lister: Activated whenever any Lister is closed.
Disk inserted: Activated whenever a disk of known format is
inserted into any floppy drive. As an example, this Script
could be used to play a sound file or make a beep when you
insert a disk. Alternatively it could automatically open a lister
and display the contents of the inserted disk. Or even both?
Disk removed: Activated when a disk is removed from any
floppy drive. Maybe use this to play a different sound?
Double-click: Activated when the LMB is double-clicked on
any clear part of the Opus 5 Main Window, but it is not
activated when the mouse is over any other Opus element such
as a lister or button bank etc. One handy use for this Script is
to open a new lister or device list as shown below.
Hide: Activated when Opus 5 is iconified.
Middle double-click: Activated whenever the MMB is doubleclicked
providing the mouse is not over any button which has a
MMB function defined. This Script will even be activated if
Directory Opus is not the active process.
Open buttons: Activated whenever any Button Bank is
opened.
Open group: Activated whenever any Group window is
opened.
Open lister: Activated whenever a Lister is opened.
Reveal: Activated when Opus is de-iconified, by pressing the
hot key combination, Ctrl + lshift + lAlt, for example.
Right double-click: Activated whenever the RMB is doubleclicked
and the mouse is not in a position which would
normally activate a menu or a RMB function for any button.
Shutdown: Is executed immediately before Opus 5 quits.
Startup: Is executed when Opus 5 is first started.

The Editor

The Script Editor displays the names of all of the events supported
by Opus and allows you to add, edit or delete the command
instructions attached to each event. An event which has attached
commands is shown in white (Colour 1), while events with no
defined commands is shown in black (Colour 2).
Scripts: Displays names of the available Scripts. Scripts which
have functions attached are shown in a highlighted colour.
Delete: Deletes the function associated with the selected
Script.
Edit: Allows you to edit the functions attached to the selected
Script with the Opus Function Editor. The Function Editor can
also be opened by double-clicking on the desired Script.
Save: Saves the currently displayed Scripts to disk and
updates those currently used by Opus. Note that this saves the
Scripts using the 'current' filename, that is, the name under
which the Scripts were loaded. Any previous file of this name
will be overwritten.
Use: Updates the Scripts currently used by Opus but does not
save them to disk.
Cancel: Cancels all changes you have made to the Scripts.

The Script Editor Menus

As with the other editors in Opus 5, there are extra options
provided by menus. These are:-

The Project Menu
New: Creates a new blank Script list.
Open: Displays a file requester allowing you to load a new set
of Scripts.
When first run, Opus uses a default filename for the Scripts
file. Once you load a new set of Scripts using a different name,
this new name will be kept and used internally as the reference
to those Scripts. If you subsequently save the particular set of
Scripts, they will be saved under this name unless you use the
SaveAS option. If you save the Environment, this 'new'
filename will be stored with the environment.
Save: Saves the displayed Scripts to disk under the current
name.
SaveAs: Saves the current Scripts but allows you to select a
new filename.
Quit: Same as Cancel above.

The Edit Menu
Reset to Defaults: Resets the Scripts to the default set as
defined when you installed Directory Opus 5. Because there
are many settings, these defaults are not actually built-in to
Opus 5, instead Opus will look for and load a special default
file.
Last Saved: Reloads and installs the last saved set of Scripts.
Restore: Abandons any changes you have made and restores
the Scripts to the state as when you first opened the Script
Editor.

Sample Scripts
Opus 5.5 comes with just two simple Scripts installed. These are :-
Double-Click: This is set to call the command 'DeviceList NEW'
which will open a new Lister whenever you double-click the
LMB on the Opus Main Window.
Middle Double-Click: Runs the AmigaDos command
NewShell to open a new Shell window on either your Opus
screen, if it has been set to Default Public Screen, or the
Workbench screen.
There are many easy and simple uses for Scripts. Try the
following for the disk inserted and disk removed Scripts. Add the
command, 'PLAY QUIET <sound>' where <sound> is the full file
path to a favourite sound effect.

Scripts

The Opus scripts system provides the ability to monitor certain system events and execute an Opus function or command batch when the event occurs. In Magellan-II, we have expanded the Scripts system with more user features plus we give you the ability to globally replace many internal Opus commands with relative ease. (This could be done in earlier versions but only by using ARexx.)

Command Replacement Scripts

To support this feature we have added several new internal script events for:-

     AnsiRead  HexRead
     IconInfo  Play
     Print  Read
     Show   SmartRead

These scripts let you override the internal commands of the same name. For instance, you could define a function for the Show event so that whenever the internal command Show is called, your function would be run instead. A typical example of this may be on an RTG system where you have a preferred viewer which displays pictures on the default screen in a window.

Custom Scripts

To provide for future expansion, we have added the new ability to define additional scripts for integration with the Opus script interface.

To add a script, create a file in the DOpus5:System/Scripts directory. The name of the file does not matter, but it must have a '.scp' suffix. The file can contain an unlimited number of script names, one on each line.

The format of the file is:

  <Script Name>,<Flags>

Flags is optional. At the moment, the only flag defined is 1, which causes Opus not to lock the current source Lister when the script is executed. For example,

  FTP Finished,1
  FTP Connect,1

If you have added or edited script files, you will need to restart Opus for the new script definition file to be noticed. When you do, the names of your scripts will appear in the script configuration list.

--> The new OpusFTP scripts you see in the Scripts editor are actually added in this manner.

There is also a new ARexx command for triggering both internal and custom scripts.

  dopus script <name> <data>

<name> is the name of the script (not case sensitive), and <data> is an optional string that is passed to the script function in the {Qa} parameter. See ARexx.

Command Replacement Scripts

The following commands are supported by a new internal script event which lets you override the internal command. If you define a function for the any of these commands, whenever the internal
command is called, your function would be run instead. The commands and templates are as follows:-

 Ansiread  NAME/F, WAIT/S
 Hexread  NAME/F, WAIT/S
 Iconinfo  NAME/F, WAIT/S
 Play   NAME, WAIT=SYNC/S, QUIET/S, ICON/S,
       VOLUME=VOL/K/N
 Print   NAME/F, WAIT/S
 Read   NAME/F, WAIT/S
 Show   NAME/F, WAIT/S
 Smartread  NAME/F, WAIT/S

See also Scripts