name load; sub getoption result = dialog("0=quit, 1=box, 2=signature, 3=timestamp",1,"0"); return integer(result.enteredText); endsub which = getoption(); if (which=3 ) or (which=2) macrosHandle = loadscript("c:\robdev\insert04.qsl"); else if (which=1) boxHandle = loadscript("c:\robdev\box.qsl"); endif endif if (which=1) box.make(); -- I turned the mainline into a subr endif -- every if must have an endif, but else shares endif if (which=2) macros.signature (); endif if (which=3) macros.timestamp(); endif if exists(boxHandle) unloadscript(boxHandle); endif if exists(insertHandle) unloadscript(insertHandle); endif << Author: bgreen@robelle.com Date: Nov 4, 1999 revised Web: load.qsl Comments: 1. You will run this script from the Script Menu. 2. Save this script as a local file, load.qsl anywhere on c:\ drive. You will also need to get the box.qsl and insert04.qsl scripts from the QSL Script Library, save them anywhere (they can be on your hard drive, on a network drive, or on any QWIN connection). Modify the Loadscript() calls to point to the location of box.qsl and insert04.qsl. If they are on a connection, change the call to: loadscript(connection: "hpux12", filename: "box.qsl"); 3. Go to Script-ManageScripts dialog. 4. If 'load' is already there, click and Remove it. 5. Click Add and browse to load.qsl file and select it. 6. Click Done to finish ManageScripts dialog. 7. Open any file with some text in it. 8. Select Script-Load to do one of three functions. 9. This script loads and calls box.qsl and insert04.qsl 10. With the Loadscript() call inside this example script, it means that the necessary external script will be reloaded from the QSL file on each run. There is no error message if the script is already loaded (since this script now Unloads them at the end, that may not be likely). On Loadscript() QWIN replaces any currently loaded script with itself again. This is handy when developing the external script - you can make changes to the external script and test them with the loading script, without manually updating the script menu. However, in production you may want to do the loadscript() calls once in a separate auto-rload script; this would give better performance, especially for scripts loaded over the Internet! 11. You cannot call an On block in an external script, only a Sub. Therefore, it is good practice to put the actual logic in Sub and limit the On block to a single sub call. 12. You cannot call the mainline of an external script, since it has no method name. Therefore, it is good practice to put the actual logic of the mainline in a Sub and limit the mainline to a single sub call. 13. Notice the nested If statements above. Each If MUST HAVE EXACTLY ONE Endif and any Else clause shares that Endif. >>