[LogoShip]

Home

Daqarta for DOS Contents

Introduction

Downloads

Free Registration

Contact Us
Daqarta for DOS
Data AcQuisition And Real-Time Analysis
Shareware for Legacy Systems
(Use Daqarta for Windows with modern systems)

From the Daqarta for DOS Help system:
 

NESTED KEY MACROS (SUBROUTINES):

It is perfectly acceptable to create Key Macros that invoke other previously-defined Key Macros. This can not only save a lot of keystrokes if you find yourself using the same basic sequences in different macros, but it likewise saves those keystrokes from being repeatedly stored in macro memory. In this respect, Key Macros behave more like the subroutine calls of a high-level programming language, rather than the language "macros" that just insert the same sequence at each use.

You can "nest" macros up to 16 levels deep. In other words, you could create a macro

    that calls a macro
        that calls a macro
            that calls a macro
                ...
                    ...
up to 16 levels total. This is most likely WAY more than you will ever need. Note that there is no specific limit (other than available macro memory) on the number of macro calls made by a single macro, only their maximum depth. So you can have a macro that
                 then             then             ...
    calls a macro     calls a macro    calls a macro
until you run out of memory.

If, while you are storing a Key Macro with KeySt, you try to invoke the same ID you are storing, you will get an alert and an error message that says:

    'N KeySt in progress... no KeyRn reentry.'
where 'N' is the macro ID. This prevents a "recursive" macro that would call itself in an endless loop.


AUTO-REPEAT KEY MACROS (Loop):

One you have created a Key Macro using KeySt, you can run it a predetermined number of times with the Loop command. Hit SHIFT-L and you will be prompted with:
    'Key Macro Loop count:'
Enter a value from 2 through 65534, and as soon as you hit ENTER you will see the normal KeyRn prompt:
    'Run Key Macro:'
Hit the ID key for the desired macro and Daqarta will immediately execute it the specified number of times.

If you enter a Loop count of 0 or 1, the macro will run only once, so there is no point in using the Loop command.

If you enter a Loop count of 65535, or any negative value, the macro will not stop after 65535 repetitions, but will repeat indefinitely until an error condition or a manual ESC key is encountered. This allows you to print all the files in a series, for example, regardless of the exact number. You would first create a macro that reads a file with InDat and executes PrintScreen. Then you would run it in an indefinite Loop with IncNm active to print all the remaining files. As soon as InDat tried to read a non-existent file, the loop would exit on the 'File not found' error.

A Loop macro may be invoked from within another that you are defining with KeySt. During the definition entry, you might not want to wait for the specified count of Loop passes, especially if it is very large. In this case, conclude the count value entry with SHIFT-ENTER instead of a simple ENTER, and just for the KeySt you will get only a single run of the selected Loop macro. When you later run the new macro with KeyRn, the embedded Loop macro will run the specified number of times.

Indefinite Loops (negative or 65535 count) always run only a single time during KeySt, whether you use SHIFT-ENTER or not.

Loop macros may be nested just like any other Key Macro, up to 16 levels deep. This is ideal for collecting data in multiple variable series, like stimulus frequency and level. Here is a typical strategy outline for collecting data at X levels for each of Y different frequencies:

  • Define macro C to:
  • Define macro I which will:
    • Increment the stimulus level.
    • Collect and save data with macro C.
  • Define macro L which will:
    • Set a base stimulus Level.
    • Collect and save data with macro C.
    • Loop X-1 times on macro I to increment and collect.
  • Define macro F to:
    • Increment the stimulus Frequency.
    • Loop Y-1 times on macro L to collect X Levels.
  • Define macro E to run the whole Experiment:
    • Collect X levels at the base frequency with macro L.
    • Use macro F to collect X levels at each of the remaining Y-1 frequencies.

In actual use, you would first set a base frequency, then run macro E to do all the work. For a standard test series, you could define macro S to do the entire Setup, including the base frequency, and then run macro E automatically.

USING Quit IN KEY MACROS:

The Quit key is valid for use use in Key Macros. This is actually more useful than it may first appear, since in conjunction with the Auto-Initialization Key Macro it allows completely automated operation of Daqarta from a batch file. This allows you to run another program after Daqarta, without user intervention.

For example, you might want Daqarta to collect DDisk data to files on a RAM drive for speed, then Quit and copy those files to permanent storage on your hard drive using DOS.

Or you might have your system on a timer to start Daqarta at 2:00 AM, collect spectra of nocturnal animal calls, save them to text files, Quit, and then invoke a communications program to Email them to another location.

FORCING A KEY MACRO OPTION STATE (KeyOn):

Suppose you want to create a general-purpose Key Macro that sets Daqarta to the PSD mode. Starting from the initial waveform display mode, you record the keystrokes you need: F-key to go to FFT mode, Y-key to go to Y-log power spectrum mode, and SHIFT-P to go to PSD mode. But what if you later want to use this and you are NOT in the waveform mode? If you were already in FFT mode, for instance, this macro would flip back to waveform mode when the F-key was invoked, and it would exit with an
 'Option not enabled... Key Macro terminated'
message when it encountered the Y-key since that option is locked out for waveform mode.

The problem is that most Daqarta key options are toggle types, designed for speed and ease of use with manual operation: Hit the key (or run it from a macro) and the option changes state. But if it is ALREADY in the desired state, it changes to the wrong one! How do you force Daqarta to go to the state you want, regardless of the current state? The answer is the ALT-K KeyOn option. Hitting ALT-K tells Daqarta that the next key you hit should go ON, no matter what state it is in at the present moment. If the next key option happens to be off, it will be toggled on, as desired. If it is already on, Daqarta will just leave it on.

If you want to create a macro that forces an option OFF, just force it ON first with KeyOn (to get a known state), then toggle it off normally.

The KeyOn option will stay active until the next toggle key is hit, after which KeyOn is inactivated. So, for instance, if you use KeyOn but then hit a cursor key, the KeyOn option is kept active... there is no ON state for cursor motion. Also, there are a number of key options that KeyOn ignores for safety and common sense reasons: You can't use KeyOn with any file access, memory, or Key Macro operations, or with Edit... nor is it likely you will ever need to. KeyOn is ignored by all CTRL-menu invocations and XCurs cursor Xpand, since these are not on-off toggle operations. It is also ignored by all Help system keys.

If you hit ALT-K by mistake, you can just hit it again to turn off the KeyOn option before you hit another key.

KeyOn also works with Line and Number of points N keys, even though they are not simple On-Off options. KeyOn will force Line1 or N 256, and you can use normal key hits after that to get to the one you want.

In addition to the displayed key options, KeyOn applies to the "sticky shift" toggle invoked by Scroll Lock. If you are running Daqarta on a PC or XT (which doesn't support a Scroll Lock LED on the keyboard itself), there is no visible way to tell which state this is in. In this case, you might want to use KeyOn with Scroll Lock even when you are not recording a Key Macro, just to make sure the Scroll Lock state is what you intend it to be.

KeyOn may also be used with Control Menu options that don't allow direct value entry, only cursor control. These include options that produce a change as soon as you hit ENTER, and those that change to the double-headed adjust arrow cursor upon ENTER. In either case, hit ALT-K just before you hit ENTER, and the KeyOn state will be selected. For simple toggle items like Window BW Correction or Shape View, the KeyOn state is the On or highlighted state.

For toggle-type items that have more than 2 states, the assigned KeyOn state will appear as soon as you hit ENTER after first hitting ALT-K. Then you just hit ENTER as needed to advance to the desired state. For example, if you want to set the DDisk Readout Units to SECS you would hit ALT-K and ENTER, and the Readout Units would show the KeyOn state of BYTES. Then hit ENTER again and the state toggles to H:M:S and hit it once more to get SECS. (This is much easier to do than to read about.)

Similarly, for cursor-only menu items that show double-headed adjust arrows (like Virtual Source WAVE), you hit ALT-K and then ENTER to force the KeyOn state. The item will remain highlighted. Then use the up or down cursor keys to get to the desired state, and hit ENTER to accept that state and remove the highlight.

For Control Menu options that allow direct entry (where the cursor changes to double triangles on ENTER), you should use that method instead of KeyOn to insure a known starting value. KeyOn will have no effect on these options.

GO:

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
25 Years of Innovative Instrumentation
© Copyright 1999 - 2006 by Interstellar Research