Scripting and Host Commands have been introduced in Qedit for Windows 4.9. If you do not see Script in the menu of your copy of the PC client, you do not have scripting. Contact your site administrator or email@example.com for an upgrade.
There are a number of ways to run a QSL script:
Scripts that are loaded onto the menu can be organized into
groups and assigned shortcut
keys. See the
Name script attribute in the QSL Reference Manual
for more details.
The Manage Scripts dialog box currently only supports browsing and loading
scripts from local files, but it is possible to also
have host files on the Script menu by using the
Loadscript script statement.
Loadscriptstatement. Once a script is dynamically loaded, it is treated just the same as the scripts which are loaded into other ways. That is, you can invoke it manually from the Script menu or from other scripts (see below).
Propertykeyword in the target script.
InvokeQSL statement to transfer control to a script. This script must have mainline code to execute. The syntax of the
Invokestatement calls for a string containing the file name or a connection name and a filename:
invoke "script name"
C:\ROBELLE\QEDIT\qwin32.exe -r myscript.qsl
Qedit executes the script specified on the command line
after it has finished loading all of the scripts in the two
default script directories, but before it opens any text files
specified in the command. If the command-line script doesn't call the
Exit application method, Qedit remains open after the script terminates.
Use the Control Panel command on the Script menu and click the Red round stop icon. If a script is not executing, the icon will be grey.
functions to trace execution and show variable values.
check for spelling errors. Tthe variable that doesn't seem right
may come up undefined, which is what happens when you spell
the name slightly differently from the real variable -- you just
created a new variable, but one without a type because you haven't
used it yet!
Turn on the Ruler and Showinvisibles, using the corresponding commands on the View menu or directly from the script, when debugging a script that deals with Tabs and other non-printing characters:
qedit.userulerbar = true; fileA = newfile(); fileA.showinvisibles = true;
Enable the Script Control Panel either manually or from a QSL script:
qedit.showscp = true;For example, try this script:
repeat for inx from 1 to 10 writelog(string(inx)); endrepeat qedit.showscp = true;
If you have a reasonable size display, try the following:
If you do much scripting you will find yourself reusing the same support Subs in many scripts. You can put all of these in a single support script and then load it in one of the various ways, thus making the Subs available as utility methods in all other scripts.
And if a script has no
On Command blocks and no mainline,
it does not even appear on the Script menu, even though
it is loaded and accessible from other scripts!