Switcher 1.10 ------------- By: Khalid Aldoseri. Switcher's job is to provide you with a list of the current screens existing on the system and then allow you to select which screen you want to switch to. Running Switcher: To run it, just execute it from a CLI. It takes no CLI arguments. e.g.: Switcher (Make sure it only is run once. It will not appear in the 'status' command since it detaches itself.) Also, copy the Switcher.config file to S: after modifying it to your requirements. (Read section of configuration file.) Using Switcher: At any time just hit both mouse buttons at the same time. (You won't get a response until you release the buttons.) The way to do this it to click the right button first, then the left button, then release the left, the release the right. (sounds complicated, but it isn't). You will then get a window with the list of the screens in the system, except the one you are currently one. So, if there are 3 screens, the Switcher window will show you two. Note: If you have a 3 button mouse, you can use the middle mouse button as the trigger to bring up Switcher instead of hitting the left and right mouse buttons. This is always active unless you use the -2 option, which disables it. The -3 option disables the left+right button sequence and allows only the middle button sequence. (Read the section on configuation file.) You can also call up Switcher by hitting the RAmiga-RShift-TAB key combination. Once you get the Switcher window you can select the screen to go to by clicking the left mouse button when it is highlighted. Switcher will then close its window and bring the selected screen to the front. If you use the right mouse button instead of the left one, then the selected screen will come to the front, but Switcher will then again bring up its window on that screen and allow you to select another screen. To abort the screen selection, just click on any other window, or move the mouse away above or below Switcher's window so that nothing is highlighted, and then hit the right mouse button. The Switcher's window will disappear on its own if: a. The mouse or keyboard aren't used for 30 seconds. b. Any other window is activated by the user. If the screen that Switcher's window is supposed to show up on cannot automatically restore its contents after Switcher has gone, then Switcher will temporarily blank out that screen and bring up its window on a blank screen. In this case, the screen that you were on will show up in the Switcher list. (It will always be the first in the list.) If a program suddenly decides to close its screen which Switcher's window is on it, Switcher will automatically recover and show up again on the new front screen. Also, Switcher checks for the screen's existance just before bringing it to the front in order to be 100% sure that the screen wasn't closed down in the time between the last time that the screen list was updated (16 times a second) and the time the user clicked on a selection. (Being real paranoid here, but I'll do anything to avoid a guru! :-) You can drag Switcher's window around. The drag bar is the top title line. At the bottom of the window there are six gadgets. To use those, just click in the gadget with the left mouse button. The following is what each gadget does: Remove: This will quit Switcher. It will disappear and will unload itself. Cycle : This will show you all the screens in the system one by one. To stop the cycling, just hold the right mouse button. You can also use the middle mouse button or both left and right buttons to both cancel the cycling and bring Switcher's window up on the screen you stopped the cycling at. Help : Brings up a help screen that shows all the keyboard shortcuts allowable. Save : Save current screen. Read below. Window: Screen: These are both one gadget that changes text based on the current Switcher mode. The normal is Screen mode. If you click on this gadget, the mode will change to Window mode, where the normal list gets replaced with the list of the windows in the current screen allowing you to select a window that will be brought to the front, or even cycle the windows. The window list will only contains windows that can be brought to front. Windows that are backdrops (such as the Workbench window) or those that do not have depth arrangement gadgets will not show up on the list. The window that is brought to front is also activated. This gadget toggles back and forth between Screen and Window modes. You can also click the right mouse button when you are on the top (drag) strip in order to switch modes. Switch: The 'Switch' gadget is a small, one character gadget at the end of the gadget strip. It allows you to switch between strips of gadgets. The first strip has the 5 gadgets mentioned above. Then there are up to 8 more strips each containing up to 5 user defined gadgets. The Switch gadget itself contains the strip number of the current strip, from 1 to 9. You can also click the right mouse button when you are on any gadget in the gadget strip in order to switch strips. Some gadgets will disappear in certain cases, not allowing you to select them. For example, if the screen list has no entries, the 'Cycle' gadget will disappear. Or, if there are no user defined gadgets then the Switch gadget will not appear. CONFIGURATION FILE: ------------------- Switcher reads in a configuration file that controls how Switcher works. This file is always placed in the S: directory as S:Switcher.config The example Switcher.config file provided has all the details on how to write the config file. COMMAND GADGETS: ---------------- The second set of gadgets contain 5 user definable gadgets that execute any normal CLI command. You need to define those gadgets in the config file: e.g.: DSD DSD Prefs SYS:Preferences/Prefs AMon utils:AmigaMonitor Shell NewShell "CON:0/0/640/200/My Shell!" You can specify upto 40 gadgets. Look at the provided example Switcher.config file to see the remaining details. SAVE GADGET: ------------ The 'Save' gadget will save the screen you were on to a file. The file name will be: RAM:screenname.PIC Where screenname is the name of the screen that was saved. Switcher's window will go away immediately after selecting 'Save' and it will start saving the screen. I would advise that you don't change anything in the screen while it is being saved. (this takes from 1 to 10 seconds) Note: screenname will always be truncated to a maximum of 26 characters. The filename for the Save will be checked for illegal filename characters and these will be replaced by other characters as follows: From To ---- -- : | / \ " ' # @ ? ! * X Important: To use this function you must copy the 'pic.library' file to your LIBS: directory. This library was written by Christian Weber of Zurich, Switzerland as 'iff.library'. I have, however, changed its name to 'pic.library' since there were several different 'iff.library' files out there, and the potential for a big mess was present. The 'Save' function can save any screen including HAM screens. Window Save: If Switcher is in 'Window' mode, then it will attempt to save the window that was active right before Switcher was activated, or the last window selected via Switcher. This will save the part of the screen that corresponds to the active window's location and size. However, due to the way the Amiga graphics work, the left edge and width of the window can only be saved to a precision or +/- 8 pixels. Because of this, the window save might be as much as +15 pixels in width more than it should be. Note: Switcher will attempt to open the 'pic.library' as soon as it loads. If it can't find the library, it will disable the 'Save' gadget and that gadget will never appear. Another note: While Switcher is doing the save its priority is bumped up temporarily to +4. This allows it to get done with the save a bit faster if there are other programs doing lots of work at the same time. KEYBOARD SHORTCUTS: ------------------- When Switcher's window is active you can use the keyboard to issue some commands. The following is the list of these keyboard shortcuts: c Toggle between single and 2 color mode. v Save (either Screen or Window depending on current mode) m Toggle between Screen and Window modes. s Switch to Screen mode. w Switch to Window mode. y Cycle. q Quit. (only closes window, doesn't remove Switcher) Does the same job as 'q'. (so does and ) ! Remove. (unloads Switcher) 1-9,0 This will bring the specified screen/window to front. The number corresponds to the serial number of the screen/window. E.g. hitting '5' will bring up the fifth screen/window in the list to the front. '0' will bring up the 10th screen/window. If the requested number doesn't exist, the command will be ignored. Switcher's window will come back up on the new screen. Use 'q' or or to get rid of it. + or = This allows the above keys (1-9,0) to select the first ten or second ten screens. When you hit the + or = for the first time, the second ten screens/windows will be marked with a '+' sign. Hitting + or = again will cancel that. E.g. to select the 13th screen/window, hit + or = then 3. The marker is reset whenever Switcher's window is closed. If the number of screens/windows is less than 11 this command has no effect. A-Z This will trigger one of the user-defined commands. The 'A' stands for the first user-defined command, and the 'Z' stands for the 26th one. (get it?) Note: Use the shift-letter. Hitting the space bar increments the strip number and updates the strip display. h Brings up a help screen that lists what each of the above keys do, and also lists the first 26 user-defined commands and the shift-letter key that would trigger each command. F1-F5 Trigger gadget 1 to 5 from bottom gadget strip. HOTKEYS: -------- Hotkeys are keys that are active even if the Switcher window is not up. - RightShift/RightAmiga/TAB: This hotkey will bring up the Switcher window if it isn't active. - Control/LeftShift/Letter: This will trigger one of the user defined commands. 'a' stands for the first command until 'z', which is the 26th command defined. e.g. To execute the fourth user command, hit control/leftshift/d Happy Switching! Please report any bugs, comments, etc. to me on CIS 75166,2531. Khalid Aldoseri. Now for the serious stuff: This program and all the accompanying files are freely distributable. You can spread them around as much as you like as long as you do it in the original LHARC file form or, if not, as the full package. You many NOT sell the program itself or any of the accompanying files. If you would like to include it with any commercial package please contact me first. All the files are (c) 1990-92 by Khalid Aldoseri, except pic.library, which was originally named iff.library and was written by Christian Weber of Zurich, Switzerland. I am not responsible for any thing that you do with Switcher, including ruining your mouse by clicking on both buttons too much. (grin) /-------------------\ | Khalid Aldoseri | | P.O. Box 3300 | | Manama, Bahrain. | | Fax: (973) 694777 | \-------------------/ Compuserve 75166,2531 Copyright 1990-92 Khalid Aldoseri. 3 May 1992.