MoreDesk: Auto-loading Files


<-  prev | index | next ->

Auto-load events can be used to do two things when you enter a desktop:

  1. Run a file (e.g. an obey file, module or a transient utility)
  2. Load a file into an editor (and position the editor window)

Running files can be useful if you have a script of actions that you want to take every time a desktop is entered. For example, you might want to set a system variable, play a sound sample or do some specific sequence of actions with WindOpen commands.

Loading files into an editor is useful if you are using a desktop to do some work and you want to preserve your progress so that next time you enter the desktop, you can continue where you left off. This is particularly useful in conjunction with the auto-open events.

The auto-load sub-window
The “Auto-load” Sub-window

This window works in just the same way as the other desktop automation subwindows. You can drag a file from a Filer window to MoreDesk in order to add or edit an auto-load event associated with it. Or, you can drag the file icon from this window and drop it onto a file that has been loaded into an editor in order to capture the state of that editor window.

As with auto-run events, you can “canonicalise” the name of the file, which will have the same pros and cons as for auto-run events. The file name is case-insensitive.

The reload option
The reload option

You can tell MoreDesk to force the file to be loaded even if it is already loaded. This means that MoreDesk will try to load the file even if there is an editor window already open somewhere for the file - i.e. a window with that file's name in the title bar. Where a file is to be run rather than loaded, this doesn't mean much (unless you also happen to have the file loaded into an editor, in which case you want this option to be ticked or the file won't get run).

The close option
The close option

It is also possible to ask MoreDesk to close the editor window associated with a file when you leave a desktop. Note: if there are multiple windows open for a given file, only one will be closed (the bottom-most). That may not be the one that MoreDesk caused to load. This will only normally happen if you make a specific decision to load the same file multiple times. If the file is to be run rather than loaded into an editor, this option won't be of any use (unless you also happen to have the file loaded into an editor, in which case that window will be closed - so you should probably leave this option unticked!).

The window position
The window position

Finally, you can also specifiy a position for the loaded file to appear on screen. This is optional and can be left blank. When the file is loaded into an editor window, MoreDesk will move the window into the requested position. If the file was already loaded, it will simply ensure that the window is in the correct place. Where a file is run rather than loaded into an editor, the position has no meaning.

Be aware that every time you reenter the desktop, MoreDesk will look through the window stack for the windows you've asked to auto position and ensure that they are repositioned at the co-ordinates you've specified. If you decide to open a new view of a given window (e.g. in Zap using the “new view” ctrl-F4 feature) MoreDesk will only reposition the bottom-most view in the window stack - so be careful to keep the new view(s) higher in your window stack if you want to put them somewhere else or MoreDesk will put them back to the specified co-ordinates on changing back to the original desktop!

If this all sounds a bit complicated, just have a play and you'll soon see what I mean. :)

The format of the position is a space-separated list of OS units, relative to the bottom-left corner of the screen. You can specify the minimum x and y co-ordinates and the maximum x and y co-ordinates of the window's visible area. For example:

  100 200 1280 1024

This would place the bottom-left of the visible area of the window 100 OS units to the left and 200 units up from the origin. The top-right of the window's visible area would be positioned 1280 units left and 1024 units up from the origin (not from the bottom-left corner of the window). Note: values can also be negative.

Run or load?

You are probably wondering how MoreDesk decides whether a file should be run or loaded. It uses exactly the same mechanism as the Filer when you double-click the file, so any auto-load event you have should be thought of as being like you double-clicking that file when you enter the desktop.

In a bit more detail, MoreDesk broadcasts a DataOpen message around all loaded applications to see if any want to load it (into a window, as with an editor). If no application claims the broadcast, the file is run at which point the normal run action for the file is used (which may still load it into an editor, for example with text files). If there is no run action for that file type, you will see an error like: “An application which loads files of this type has not been seen...”. You should ensure that applications which can load/run files in auto-load events have been seen before the event is triggered (possibly by auto-running the application in question).

Note: in order to find a window which represents a file, MoreDesk looks through all open windows that it can see, e.g. that aren't in its Ignore list) from the bottom up for one which has the file's name in its title bar. (MoreDesk also ignores iconised windows, ‘back’ windows and (optionally) ‘pane’ windows.) The file name match is performed using canonicalised file names rather than as an exact match. Some programs (such as some web browsers) don't put the file name in the title bar so MoreDesk will never be able to associate that window with the respective file.

<-  prev | index | next ->

Copyright © 2013, 7th software