Lister title bar clock

I was bored and didn't realize that tbone had already made such a script, so I've made an Add-In which displays time in the titlebars of the Opus Listers. I'm posting this only because it's slightly different due to me reinventing the wheel from scratch; it has formatting options and once installed, this Add-In runs automatically (no need to press buttons or anything to activate it).


By default it looks like this, but there are formatting options.

Note: due to way automatic startup & self-refresh is achieved, you'll have to restart the Opus (from tray or Exit menu) whenever you change the settings of this Add-In. More information is below.

Installation

  1. download the Lister Title Clock.js.txt file attached below
  2. in your Directory Opus go to Settings > Preferences... then Toolbars > Scripts
  3. now simply drag & drop downloaded Lister Title Clock.js.txt to the Preferences window
  4. restart Directory Opus (to properly restart the Directory Opus, please go to the File menu and select "Exit Directory Opus").

Settings
Following settings are available:

  • 24-hour time (default): Set this to False to have the time displayed in the 12-hour AM/PM style.

  • Lister title format textbox: %REALTIME is additional token used by this Add-In. See the SET LISTERTITLE in Opus docs for the list of tokens you can combine with %REALTIME. Note: %REALTIME token not available globally outside Add-In options.

  • Prepare for removal: Resets the title changes done by this Add-In. Set this to True and restart the Opus before removal of this Add-In.

Important -- Uninstallation
To properly uninstall this Add-In (i.e., reset the title bar changes), please go to the Add-In's Options and enable the "Prepare for removal" option. Then restart Opus, and you can then remove the Add-In.

If you neglected to do this before removing this Add-In, you can easily reset the titlebar manually:

  1. Restart the Opus (assuming you've already removed the Add-In)
  2. press > on your keyboard and enter this command: set listertitle

Important information to consider
This Add-In achieves auto-startup and autonomous periodic refresh (every half second) by means of a loop in the OnStartup callback. While this doesn't seem to affect Opus in any (negative) way, GPSoftware didn't design the scripting API with this in mind, so long-term reliable operation of (Opus and) this Add-In cannot be guaranteed.


GPSoftware note: We recommend against using scripts that have commands or event handlers which never return. While they may seem to work OK, they could cause problems now or in the future, such as other script event failing to run, windows freezing or the program not exiting or updating properly, due to waiting for the event to complete.


Download
Version 1.0 -- 2016-09-04
Lister Title Clock.js.txt (3.93 KB)

I've just realized that the time is updated only in the active Lister. Not very useful Add-In, but somebody new to Opus scripting could find the portions of code useful for making more exotic Add-Ins which have to independently self-update in the background.