Qedit for Windows Scripting Language

Frequently Asked Questions

Qedit For Windows has a powerful Scripting Language: QSL. This FAQ answer questions we commonly hear about QSL and has links to other QSL resources.


Why would I want to use scripts?

QSL is a general-purpose programming language like Visual Basic or C. It is built around the text manipulating functions of Qedit. For numerous examples of what you can do with QSL, visit the Script Library. Here are some ideas:
  1. Customize Qedit for Windows for your specific environment.
  2. Automate tasks that involve text documents and multiple machines.
  3. Extend Qedit for Windows (add new useful features).
And here are some examples:

How Are QSL scripts stored?

Each QSL script is its own file, either on the local PC or on a host connection. Qedit for Windows reads the script and "compiles" it into an internal representation. Then it can execute it. Scripts can call other scripts.

Who is QSL designed for? End-users? Programmers?

QSL will benefit both programmers and end users. The target audience for programming QSL is a system operator or application programmer, just like Qedit itself, but one QSL programmer can write many QSL scripts that are automatically loaded and available for users.

We do not expect many end users will write scripts, however users that are capable of writing VBScript should have no trouble with QSL. QSL is easier to code than Visual Basic (although it lacks the VB screen controls) or the host Qedit command language.

How can I learn QSL?

Dive right in. You need a Qedit for Windows client with scripting enabled (email to support@robelle.com if you are an existing user who is interested in testing the new scripting language).

The client comes with full QSL documentation in the help file. Just select the Scripting on the Help menu.

Run Qedit for Windows and Open a new file, either on the local machine or on the host. Type

     result=dialog("Hello world");
and Alt-S-R to run it!

Next, consult the QSL documentation tips and study the on-line sample QSL scripts.

Then download and print the Scripting Manual in PDF format. You will need the Adobe Acrobat Reader to print the PDF file.

Finally, we are even developing structured training materials for QSL. Contact support@robelle.com if you would like to try them.

How much of Qedit for Windows functionality is available in QSL?

QSL supports most Qedit for Windows "objects". You can check if something has been done yet by consulting the QSL Reference Manual or the online help (see the Scripting command on the Help menu). Look for the chapter on Object Properties and Methods.

Is QSL compiled or interpreted?

Both. Your script is compiled into an internal object code which is executed by the Qedit for Windows Virtual Machine (VM). The VM has no knowledge of specific Qedit for Windows objects. It does know how to invoke objects described in a special internal language (readers do not have to know how this works -- just that it does work).

What QSL development tools are available?

Select the Control Panel command on the Script menu. You should see four buttons and two text windows.

Control Panel

The buttons are: Go, Pause, Stop and SingleStep. When you Pause or SingleStep a script, you will see the current line of source code in the bottom text window. Anything your script logs with Writelog() will appear in the upper text window. Both text windows can be expanded by clicking yellow arrows that point to them. And you can keep the Script Control Panel and the Qedit for Windows text window active on the desktop at the same time, allowing you to see the results of your script and the script itself, all in real time.

Where do QSL Scripts live? On the Host? Client?

Any document can be a script, whether on the host of the client. You can load either local scripts or remote scripts. When a script filename is required, you can specify a script on a host by preceding the filename with the Connection name and a colon (ex, uxhost:homepage.html.

By convention, we have been naming script source files with the extension ".QSL ", but this is not required. You might also run into scripts with a ".QSC" extension. These are pre-compiled scripts. They are created with the Save compiled script command of the Script menu.

Scripts can even be in new files which have not been saved as yet.

Are Scripts sharable between users?

Yes, just open the script file with read access before executing it.

How do I see load/unload/manage my script?

Use the Manage Scripts command on the Scripts menu. This allows you to Add and Remove scripts, plus see what scripts you have loaded and their callable functions (aka "methods").

Script Manager

Is it possible to define where scripts live?

Yes, there are defined directories for Robelle-supplied scripts, your company-wide scripts, and your private scripts. And each of these directories may contain an Autoload sub-directory. Qedit for Windows will automatically load any scripts in those directories and add them to the script menu, if applicable.

How can I ensure that my personal scripts don't get lost when I get a new PC?

Keep them in a host directory. If you keep them in a local Windows directory, you can't be sure they won't be lost. Just like any Windows app, you lose all your context when you get a new PC. Be sure to make backups.

How are scripts invoked?

In quite a few flexible ways:

Can a script be associated with a "shortcut" key sequence?

Yes. When a script is "loaded", it appears on the Script menu, which Alt-S brings up. You can define the next key in your shortcut sequence using & in the On Command statement of QSL. For example, to define S as the shortcut key for a function named "Sort", use On Command "&Sort".

Can a script run Host Applications?

Yes, through the HostCommand method. However, this is limited to batch-type operations where all inputs are prepared in advance.

Can a script invoke new document Windows?

Yes, use the Newfile method.

Can a script invoke other scripts?

Yes. Either use the Invoke method, or call any method of a loaded script as an external method using the script name, a dot, and the method name.

How do I input parameter values into a script?

Use the Dialog built-in function to prompt the user.

Can a script invoke Host Commands?

Yes, the HostCommand method allows you to execute commands on a host connection and receive the results back.

Can a script be interrupted? Aborted? Paused?

Yes, see the Control Panel dialog box above. It can be used to Pause, Abort, or SingleStep a script.

Is there a file extension for scripts?

QSL is the recommended file extension for script source files. QSC is used for pre-compiled scripts.

Are changes made by scripts added to the undo/redo stacks?

Yes and no. The individual changes are added to the undo/redo stack. The script programmer is responsible for how the user may view this. For example, if you make numerous changes to a document, each change will be a single "undo". If you want the entire script to be undone in a single operation, you must do something like make all of the changes on a copy then copy and paste the changes back to the original document. An example of this can be seen in the Sortlines example (see the section on design for how undo was handled in this script).

Are there sample scripts to get me started?

Yes. See Sample Scripts page and feel free to submit your own for addition.