Who are we? Acrasoft Homepage Contact Us! What's New?
LogWatcher
AutoPilot
MessagePad
GroundControl

Product Suite Information
Upgrade Policy
System Requirements
Credit Card
Purchase Order
Check/Money Order

Price List
LogWatcher
AutoPilot
MessagePad
GroundControl
Contact
Purchase
Credit Card
Purchase Order
Check/Money Order

Support
LogWatcher
AutoPilot
MessagePad
GroundControl
Product Suite Information
Upgrade Policy

Download
LogWatcher
AutoPilot
MessagePad
GroundControl


Product Support

LogWatcher

AutoPilot

MessagePad

GroundControl


Installation Support


Site Map

 

   


GroundControl FAQ


Frequently Asked Questions
Can I compile GroundControl macros? What kind of directory searches are supported?
How do I register GroundControl? What are all those SendKeys functions?
What can I use GroundControl for? What about screen savers?
Can I run DOS commands and batch files? How do I run my new macro?
Does GroundControl use the registry? How do I use variables?
Does GroundControl support long filenames? How do I start another program?
How interactive is GroundControl? Can I ask the user for something, and make a decision on it?
Can GroundControl read the Clipboard? How do I check for disk space and other sytem informations items?
How do I interactively fill out a dialog box? How do I make a choice based on the result of a function?
How do I move windows around? How do I use DDE effectively?
How do I write a Do-While loop? How do I write a For-Next loop?
How do I write text to a file? Does GroundControl wait for substrings to finish before continuing with the main script?
Does GroundControl treat variables in sub strings that have the same name as main string variables seperately?
 
Can GroundControl run as a service?
Can GroundControl UnLock a Locked workstation? How can I use a variable as part of a parameter?

Can I compile GroundControl macros?
GroundControl is a scripting utility for automating tasks. It was designed primarily as a tool to be used either stand alone, or with a task scheduler to automate common tasks easily without a lot of complicated programming. In it you will find functions to perform operations such as running a program, executing a DOS command and sending keys to a running application. You will also find functions for checking conditions such as if a file exists or when disk space is low.

GroundControl is not a programming language for compiling your own programs for distribution, such as Visual Basic or C++. It is a tool for editing and executing your own macro/script files that you build from GroundControl's command set, but you must have a copy of GroundControl installed on each machine that you wish to execute those scripts on. You cannot turn those scripts into exe files for distribution. If what you are looking for is a tool that you can use to quickly and easily build scripts to perform tasks then check out GroundControl.

Back to Top

How do I register GroundControl?
After you have evaluated GroundControl and you have decided to purchase a license, choose one of the ordering options in the "Ordering Information " section of the GroundControl help file or at our order page. After we receive your order information, we willl send you a registration name and number via e-mail. Once you receive your registration name and number,start GroundControl, you will be presented with a dialog that has a "Register" button. Click this button and enter the registration name and number.  After entering this information, hit the OK button. If you entered the information correctly, you will have successfully registered the product.  Keep this information in a safe place. If you ever move GroundControl to another PC, you will have to re-enter this information. Next time you run GroundControl.
Back to Top

What can I use GroundControl for?
GroundControl is a scripting utility for automating tasks. It was designed primarily as a tool to be used either stand alone, or with a task scheduler to automate common tasks easily without a lot of complicated programming. In it you will find functions to perform operations such as running a program , executing a DOS command and sending keys to a running application. You will also find functions for checking conditions such as if a file exists or when disk space is low.

GroundControl is not designed for any specific purpose, but it provides a wide range of functionality through its command set. It is up to you to apply it to whatever ends you have in mind. If you aren’t sure if GroundControl is suitable for your needs, try it first! If you get 95% of the way there, maybe we can help you get the rest of the way. The important thing is for you to look at the command set, and see if there is a way for you to make GroundControl do what you need. There probably is!
Back to Top

Can I run DOS commands and batch files?
Yes! If you want to execute single DOS commands, you can use the RunDOSCommand() function. If you want to execute a batch file, use the RunProgram() command. You can even run your batch file hidden so that it does not interrupt the application running in the foreground. Simply set the run style to hidden. Just about everything possible in DOS is available as a GroundControl function, so you shouldn’t find yourself restricted in any way.
Back to Top

Does GroundControl use the registry?
GroundControl has full registry awareness. You can create and change any hive/key that you have access to, using the WriteToRegistry() and GetFromRegistry() functions. You also can read and write to ini files, which may be easier (and safer) for some applications than working with the registry.
Back to Top

Does GroundControl support long filenames?
Yes, although you need to be aware of some of the ramifications of this. GroundControl supports both long filenames ( that is, more than 8.3 ), and file names with spaces. You must be aware, however, that because of the way Windows itself works, if a path includes a space, the operating system may fail to behave in the manner you’d expect.

Specifically, Windows will open Explorer at the directory you specify if you type in a path at the command prompt. If you type

>c:\winnt

Explorer will open in that directory. Now, if you also have a directory called “c:\winnt myfiles”, typing

>c:\winnt myfiles

will not open Explorer there, because the operating system stops at “c:\winnt”. This is an operating system issue, and it will cause problems for you in GroundControl’s RunProgram function if you pass a spaced path, and suddenly find yourself looking at Explorer instead of the program you wanted to run. To fix this at the command line, make sure you include quotes around the path:

>”c:\winnt myfiles”

To fix this in GroundControl, put double quotes around the path and program in the RunProgram function:

RunProgram(""c:\winnt myfiles\oleview.exe"",Normal)

Here is an easy way to test your command line. If your command will runs from the run command in the start menu, it will work in the RunProgram command..
Back to Top

How interactive is GroundControl?
GroundControl has several different message boxes you can use. A regular Ok message box displays a custom message, and waits for someone to clear it. An Ok/Cancel message box also displays a custom message, but remembers which button the user pressed to clear it, so you can take different courses of action. Finally, an input message box will ask a custom question, and save whatever the user typed in a variable , which you can use as a parameter to any function that GroundControl has.
Back to Top

Can GroundControl read the Clipboard?
Sure, as long as the contents are in text form. Use the GetClipBoard function to pull the text into a variable . You can use GroundControl to control the transfer of data that is not text, by making one program dump its contents to the Clipboard, and have another paste from the Clipboards. This way, GroundControl doesn’t have to know what’s actually in the Clipboard.
Back to Top

What kind of directory searches are supported?
GroundControl can check for the existence of a file in a fully specified directory, using the FileExist function, which returns True if the file is there, and False if not.

This function does support wildcards, so you can search for any “*.doc” files or “a???.bmp” files, etc.
A more powerful search is the FindFile function, which can search all directories in the system path for the file you want, and also tells you where it found it. This function does not support wildcards, so you must know exactly what you are looking for.

Back to Top

What are all those SendKeys functions?
Anywhere you can type text in Windows, you can use GroundControl to send that text. The catch is that when you type, you have to make sure you have the correct window in front and active. You can use SendKeys to send Alt-F4, or any other menu commands that you care to.

You can also use SendKeys to fill in a dialog box, but you must ensure that the caret is in the right control, that is, that the correct control has focus. When done filling out the box, send Tabs to move around to the Ok button, and send an Enter key.

Be aware that certain keys are actually sent as two key strokes. An “a” is simply sent as an “a”, but an “A” is sent as a “SHIFT” followed by an “a”. This might be obvious when you are physically typing the “a” or “A”, but when you are sending the string inside of a variable , like “Hello Bob”, you are actually sending 11 keystrokes, not 9.

You can send any environment variable, send the current time or any part of it, send the contents of any variable, or the contents of a text file, and you can also send the results of an input message box, after asking the user for a string.

The trickiest part about sending keys is making sure the correct window gets the intended keystrokes. If you are running programs with the intent of sending them keys, make sure you put in a delay so the other program can get started before you stream off a bunch of text. If you don’t want to activate the other window to send it keys, you can call SendInputToWindow or SendKeysToWindow , and save the extra step.

Be aware that there are some special keys in the SendKeys command set, which may require the use of braces as described in the SendKeys Overview in the help file. To send the following exactly as it appears to Notepad from GroundControl:


%F

You would use the following syntax:

SendKeysToWindow("Untitled - Notepad","SendKeys{(}"{%}F"{)}")

This technique can be used to have GroundControl scripts create other GroundControl scripts dynamically!
Back to Top

What about screen savers?
In Windows NT, every process runs independently of the others, and screen savers are separate processes. This means that a screen saver will not interfere with GroundControl. However, if your GroundControl script has message boxes that require someone to clear them, you won’t see them if the screen saver is active.This technique can be used to have GroundControl scripts create other GroundControl scripts dynamically!
Back to Top

How do I run my new macro?
By default if you open a GroundControl macro, the macro will be displayed the GroundControl editor. This feature is great if you are developing and testing your macro, but it is not practical or useful to run it this way once you have completed your macro. You will want to execute your macro so that it will perform the task you created it to do. The way to do this is to use the ‘/r’ command line parameter. By including the ‘/r’ parameter on the command line before the name of the macro file, GroundControl will execute the macro without displaying the editor. GroundControl will insert the ‘stop macro icon’ in the system tray. If you click this icon GroundControl will halt the execution of the macro. This is important because if something goes wrong with your macro this is the only way to stop a running macro executed from the command line. GroundControl is designed as an easy to use full featured automation utility. GroundControl is not a development tool to create stand-alone applications. GroundControl macros cannot be compiled or run outside of the GroundControl program.
Back to Top

How do I use Variables?
Variables are among the most powerful features of GroundControl. They allow you to store results entered by users, or calculated numbers from other programs. They can be used to store data like file sizes, text strings for registry keys, user names, or clipboard results.

There are 26 variables in GroundControl, and as you might have guessed, each variable is named after a letter of the alphabet. The variable name begins with a percent sign, so the 26 variables available to you are called %A, %B, %C, etc. You can inspect the contents of the variables at any time by selecting Macro, then Dump Variables from the menu. A faster way is to press Ctrl-Shift-D. A dialog will be displayed which shows you what the contents of all 26 variables are.

To put something into a variable, use the PutVar function. For example, to put the value six (6) into %A, you write PutVar(%A,6). If you enter this line into GroundControl, then select it and push the Test Line button, the value 6 will be stored in %A. Push Ctrl-Shift-D to see it.

You can store numbers in variables, and you can store strings of text. For example, you might want to store your name in %N. To do this, you write PutVar(%N,”Heironymus Wombat”). Text strings should be quoted if they contain more that one word, and especially if they contain commas. To be safe, you should quote text always. It doesn’t matter if you quote numbers or not, unless you are using comma separators in your numbers. For example, the following are legal:

PutVar(%A,5.6)    ( fine )
PutVar(%A,”5.6”)    ( also fine – decimals are accepted )
PutVar(%A,”100,000”)    ( use quotes because of comma separator )

PutVar(%A,Peter)    ( unquoted strings are legal but not recommended, use quotes )
PutVar(%A,”Peter”)    ( better! )
PutVar(%A,Peter and Mark)    ( multiple words are ok, but not recommended without quotes )
PutVar(%A,”Peter and Mark”)    ( better! )
PutVar(%A,”Peter,Mark,Julie”)    ( this is fine – commas are inside quotes )
PutVar(%A,Peter,Mark,Julie)    ( this is illegal – commas are outside quotes )

There is a new function you can use in your macro called Dump(), which displays the variable contents message box during macro execution. This is handy for debugging.

PutVar(%C,”Test”)

Dump()

PutVar(%C,”Another test”)

// hopefully, the message box should change

Dump()

It doesn’t matter whether you use capital letters for the variable names. %A is the same as %a, so feel free to mix cases.

 

GroundControl will accept variables in place of regular function arguments. In English, this means that anywhere you would provide a function with parameters, you can put a variable instead, provided the variable contains what you were originally going to provide.

For example, suppose you want to display a message box. The easy way of doing this is:


MessageBox(“Hello, this is a sample message”)

The alternate way, using variables might look like this:


PutVar(%M,“Hello, this is a sample message”)
MessageBox(%M)


First, we load the text string into variable %M. Then, we call the MessageBox function, but instead of explicitly giving it the string we want to display, we pass the name of the variable where the string is stored. When GroundControl executes the MessageBox statement, it looks at the parameter to decide if it’s a variable or not. If it is, it replaces the %M you typed with the contents of %M instead. All variables begin with %, so GroundControl can identify them.

Let’s try another example. We will write a Repeat function using a variable %R. Here’s the original statement:


Repeat(Beep(),10)

Here’s the variable version:

    PutVar(%R,10)
    Repeat(Beep(),%R)
.
Again, instead of explicitly specifying ten for the repeat count, we put the value ten in variable %R, and specify %R for the repeat count. GroundControl recognizes a varaible in the Repeat statement, and substitutes the contents, which is the value ten.

You can do this to any function. Look at these examples:

1.    PutVar(%A,"Calculator")

ActivateWindow(%A)    has same effect as ActivateWindow(“Calculator”)

2.    PutVar(%A,"C:\MYFILES")

CreateDirectory(%A)    has same effect as CreateDirectory(“C:\MYFILES”)

3.    3.    PutVar(%A,”a new line of text”)
WriteToFile("mylog.txt",%A)    has same effect as WriteToFile(“mylog.txt”,”a new line of text”)


Which variables you use for which purpose is up to you. It helps to associate the variable letter with what it’s storing, so you might want to store a name in %N, a counter in %C, disk space size in %D or %S, or so on.

Why do we want to use variables? It looks as though it takes twice as many statements to do what we wanted. If we know what has to go in them before they can be used, why make two steps out of it? There are many reasons. You might want to reuse certain strings or values in multiple statements. Instead of typing in the same string, use a variable. That way, if the string ever changes, you only have to fix it in one place. A person’s name, a directory path on a drive, a maximum file size, a program name – these are all examples of something you might want to put in a variable for storage.

There are more important uses for variables. They act as temporary storage locations for data coming in and out of your macro. You just learned that any function will accept a variable for a parameter, and that it’s the contents of the variable that are substituted by GroundControl. You also learned that you use PutVar to load a variable with a value of some type. There are several other ways of getting data into variables that we haven’t looked at yet:

1. Interactive Input with InputBox

InputBox now takes an optional parameter for the variable name. The response entered by the user is stored in the variable. This means you can send their response to any function. If you ask for a filename, you can send it to DeleteFile, FindFile, WriteToIniFile, FileExist, FileOlderThan, CopyFile, etc. You can ask for a username, and log it using LogEvent, LogError, WriteToFile, etc. You could also send the username to another program using SendKeys or DDE.

For example:

InputBox(“What is your favorite color”,%C)
    IfEquals(%C,”Blue”,MessageBox(“Mine too!”))
    InputBox(“What is your favorite number”,%C)
    IfEquals(%C,21, MessageBox(“Mine too!”))

2. System Information

There is a new function called GetSystem to return the system values identified by the system constants used in LogSystem. The function takes one parameter, the variable in which to store the result:

GetSystem(%A,DISK_C_FREE)

Dump()

GetSystem(%A,MEMORY_TOTALPHYSICAL)

Dump()

GetSystem(%A,COMPUTER_NAME)

Dump()

3. File Size

You can retrieve the size of a file in bytes via the GetFileSize function. The first parameter is the name of a file, the second is the variable in which to store the result. For example, the following will write the size of the autoexec.bat file to a logfile:

GetFileSize( “c:\autoexec.bat”,%B)
    WriteLineToFile(“mylog.txt”,”The file size is: “)
    WriteLineToFile(“mylog.txt”,%B)


This created file will look like this:

The file size is:    1196

Notice in the above example that the text “mylog.txt” was used twice. Here is a place where a storage variable could be used. For example:

GetFileSize( “c:\autoexec.bat”,%B)

PutVar(%F,“mylog.txt”)

WriteLineToFile(%F,”The file size is: “)

WriteLineToFile(%F,%B)

4. Reading the Clipboard

There is a new function to pull the contents of the ClipBoard into a variable. Simply specify the variable to use:

GetClipBoard(%C)

Dump()

This is useful if you want to send a copy command to another application to have it copy some results you want to the ClipBoard, and then pull them into your macro with GetClipBoard(). This only works if the contents of the ClipBoard are in text format.

5. Reading the Registry

You can use GetFromRegistry() to pull values from the registry. You need three parameters, one for the registry path, one for the item you want to retrieve, and one specifying the variable where you want the result placed:

GetFromRegistry("HKEY_LOCAL_MACHINE\SYSTEM\SETUP","cmdline",%B)

Dump()

Registry key/paths tend to become long in a hurry. If you have multiple reads to perform from the same key/path, use a variable to store the key/path, and your macro will be much more readable:

PutVar(“%K”,”HKEY_LOCAL_MACHINE\SYSTEM\SETUP”)

GetFromRegistry(%K,"cmdline",%A)

GetFromRegistry(%K,"systempartition",%B)

GetFromRegistry(%K,"systemprefix",%C)

GetFromRegistry(%K,"setuptype”,%D)

Dump()

Use extreme caution when working within the registry!

6. Reading INI files

You can use ReadFromIniFile() to pull values from INI files. You need three parameters, one to specify the file and one for the section and item. The last parameter is the variable where the result should be placed. This is powerful because you can use your own ini files to store variables or results of any kind. Suppose you ran a macro every morning to monitor disk space. You can use your own ini file to store the disk space each day, so you can see if you are running out. Let’s create a file called monitor.ini, and store the disk space in a section called “diskspace”, and keep one entry for each drive on your system. The ini file looks like this:

[diskspace]
    cdrive=142351362

ddrive=1235112355

edrive=45236418

The macro will check the disk space every morning, then compare it to yesterday’s values stored in the ini file. It will then have to write the new disk spaces back into the ini file for the next day.

// get yesterdays space on disk c, put it in %Y

GetFromIniFile("C:\gc\monitor.ini","[diskspace]cdrive”,%Y)

// get todays space into %T

GetSystem(%T,DISK_C_FREE)

// warn the user

IfLessThan(%T,%Y,LogEvent(“Less space than yesterday on C drive”))

//update the ini file with the new value

WriteToIniFile(“C:\gc\monitor.ini”,”[diskspace]cdrive”,%T)

// repeat this code for other drives …


Of course, you can go crazy with variations of files, sections, and items. Ini files allow a ton of flexibility for permanently storing data.

7.    7.    Incrementing and Decrementing

There may be instances when you want to use variables as counters, to track how often a macro or function has been called. The new Increment and Decrement functions allow you to do this easily.

Back to Top

How do I start another program?
It is easy just use the RunProgram function, then use CloseWindow or QuitProgram to end when you're done.

Example:
RunProgram( "Notepad.exe" )
Back to Top

How do I check for disk space and other sytem informations items?
You can use the IfMoreThan or IfLessThan functions to check any of GroundControl's predefined variables, and make a decision based on the TRUE or FALSE result. These variables are defined for different aspects of memory and disk space. For example, to see if your PC has at least 32MB of physical memory, do the following:

IfMoreThan( MEMORY_TOTALPHYSICAL, 32000000, MessageBox( "My PC rocks!" )

Windows usually creates a swapfile to make room in physical memory as needed. There are variables to check the swapfile:

IfLessThan( MEMORY_AVAILPAGEFILE, 5000000, MessageBox( "Less than 5 MB left in the swapfile!" )

The sum of physical memory and the swapfile is called virtual memory, and you can check that too:

IfLessThan( MEMORY_TOTALVIRTUAL, 8000000, MessageBox( "Better buy some chips!" )
IfMoreThan( MEMORY_PERCENTUSED, 90, LogError( "Almost no room for growth - close some apps!" )

You can check the size and space of any hard drive too:

IfMoreThan( DISK_Q_FREE, 10000000, LogError( "10MB of space on network disk Q:!" ) )
IfMoreThan( DISK_C_SIZE, 2000000000, LogError( "You've got a two gigabytes hard drive!" ) )

Finally, there are a few string constants, like your computer name, the user name, etc. These can't be used by IfMoreThan or IfLessThan, but you can log them to a file with LogSystem. LogSystem can log any of the disk or memory variables as well. See LogSystem and IfMoreThan, IfLessThan for details.
Back to Top

How do I interactively fill out a dialog box?
If you know the fields of the dialog box in advance, you can use the SendKeys functions to transmit keystrokes to the box controls. Generally, you will send ALT- combinations to set focus to a control, then send the keys you want to enter in. You can send date, time, and environment variables via different SendKeys functions, but the really cool function is by using the InputBox to ask for something from the user, and then send what they typed in using SendInput.

You can define a series of keystrokes to automatically send as part of the macro using the SendKeys and SendKeysToWindow functions.

Each key is represented by one or more characters. To specify a single keyboard character, use the character itself. For example, to represent the letter A, use A for key text. If you want to represent more than one character, append each additional character to the one preceding it. To represent the letters A, B, and C, use ABC for key text.

The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( ) have special meanings to SendKeys. To specify one of these characters, enclose it inside braces. For example, to specify the plus sign, use {+}. Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces as well, because in other applications for Microsoft Windows, brackets do have special meaning that may be significant when dynamic data exchange (DDE) occurs. To send brace characters, use {{} and {}}. To specify characters that aren't displayed when you press a key (such as Enter or Tab) and keys that represent actions rather than characters, use the key codes defined in the SendKeys Codes.

For more information, check out the tutorial on SendKeys in the online help file.

Back to Top

How do I make a choice based on the result of a function?
The If statement lets you specify what to do if a function succeeds or fails. A very common example is to check for a file or program, and use GoTo to jump to a different part of the program:

If( FileExists("myfile.txt"), GoTo(":Yes"), GoTo(":No") )

You can check resources and branch using the IfMoreThan and IfLessThan functions. You don't necessarily have to branch someplace:

IfMoreThan( MEMORY_TOTALPHYSICAL, 64000000, MessageBox( "This PC has more than enough memory!" ))
IfLessThan( DISK_C_FREE, 10000000, MessageBox( "This PC has less than than 10MB of disk space left!" ))
Back to Top

How do I move windows around?
You can minimize, maximize, restore, and close Windows using the simple commands below. As long as you know the exact title of the window, you can use these commands, plus many others:

MinimizeWindow ( "Calculator" )
MaximizeWindow ( "File Manager" )
Back to Top

How do I use DDE effectively?
DDE is a powerful tool if used correctly. It stands for Dynamic Data Exchange and it allows two or more Windows programs to make requests of each other via a well-structured syntax. Typically, it is used to request or send items of data, but it also allows for the transmission of commands to another program. DDE can be configured to work between computers on a network, so you can actually control programs on other PCs.

You can use DDE through GroundControl to send DDE commands to a server application if that server supports DDE commands. If it does, you will need to know the syntax it supports, and any peculiarities in the command language that may exist. A well-written DDE server will have a well-documented set of commands, representing at least most of the commands you would need to use.

To send a DDE Command, you need to establish a conversation with a server and topic. You then send the command as a carefully formatted string, and close the conversation. GroundControl does all of these for you with a simple function:


DDECommand( "servername", "topicname", "carefully_formatted_command_string" )

The server and topic for an imaginary editor might be "slicktyper" and "commands". The command string depends on what you want to do, but it must be supported by the server. To tell the slicktyper server to quit might require an "[Exit()]" command. To tell it to open a file might need a "[FileOpen('C:\myfile.txt)']".

If you are following closely, you might be thinking it is inefficient for GroundControl to open and close a conversation for every command, and you would be correct! If you have a long sequence of commands to send, then it is much better for you to put them into a file, and run DDEScript instead. This command opens the conversation once, then executes all the commands in the file before closing the link. It is better to use DDEScript if you have more than three or four commands to send.

Beware: some servers support more than one topic, and not all commands may go to the same topic. If you are using DDEScript, all commands go to the same topic, and you will have to separate them out.
Back to Top

How do I write a do-while loop?
GroundControl has a While statement that accepts a function to evaluate every pass, and a function to execute if true. If false, the loop exits:

// annoying noise
Repeat( Beep(), 50 )

If you want to repeat a group of statements, you are better off putting those statements in a separate file, and using the RunMacro with the repeat:

//do-while loop
While( FileExists("signal.txt"), RunMacro("chores.gc"), 50 )

If you have a need for this, you should review the tutorial on loops and branches.

Your first GroundControl program will probably be a simple series of commands that are executed from top to bottom, but as you probably can imagine, a really useful program is one which makes decisions, either independently of the user, or based on user input. This section explains how to use branches and loops effectively.

As an example, let's write a program that beeps ten times in a row. The first pass might be:

Beep()
    Beep()
    Beep()
    Beep()
    Beep()
    Beep()
    Beep()
    Beep()
    Beep()
    Beep()

This takes up lots of space and looks quite silly. The better way is to use a Repeat():

Repeat( Beep(), 10 )

The stuff in the middle is executed 10 times. The value of counter starts at one, and increases by one each time until it reaches ten, where the loop exits. In our example, suppose we wanted to beep ten times ( decabeep, or decibeep? ), but play a sound clip and wait five seconds after each. GroundControl's repeat loop only lets you repeat one statement. Thus, without knowing better, we could write this:

Beep()
    PlaySound("WHITEZON.WAV")
    Delay(5000)

Beep()
    PlaySound("WHITEZON.WAV")
    Delay(5000)

... and so on eight more times. What we need is a repeat that takes more than one function as a parameter. "But wait, ", you cry, "this is impossible!. Did not Aristotle decree it was so?". "Ah, grasshopper, ", we respond smugly, "watch as we shine light where there was only darkness".

If we put the first three statements into a macro file and save them as "NOTIFY.gc", we can call them like this from our main macro:

Repeat( RunMacro("NOTIFY.gc"), 10 )

We have turned the three statements into a subroutine that can be called anywhere by anyone. We have used the repeat function to run the other macro file ten times. You should now realize how powerful the technique of subroutines and loops are, and how they can be used together for almost infinite flexibility. If you need a For-Next loop, use this concept.

Back to Top

How do write a For-Next loop?
You can use a simple Repeat function to execute one statement a specified number of times:

// Repeat Beep
Repeat( Beep(), 50 )

If you want to repeat a group of statements, you are better off putting those statements in a separate file, and using the RunMacro with the repeat:

//for-next loop
Repeat( RunMacro("chores.gc"), 50 )

If you have a need for this, you should review the tutorial on loops and branches in the GroundControl online help.
Back to Top

How do I write text to a file?
You can use LogToFile , LogSystem , and LogError to create time-stamped system logs. These look like this:

01/24/97 19:50:20 User said no to my dialog box
01/24/97 19:50:25 The Calculator program wasn't running.

Alternately, you can use WriteToFile and WriteLineToFile to create non-timestamped text files with and without carriage returns appended for you automatically.
Back to Top

Can I ask the user for something, and make a decision on it?
You can use the If statement to check the results of OK/Cancel message boxes:

If( MessageBoxOkCancel( "Should we continue?" ), GoTo(":RunProg"), GoTo(":GiveUpGhost") )

You can use the ResponseOk or ResponseCancel functions too:

MessageBoxOkCancel( "Should we continue?" )
If( ResponseOk(), GoTo(":RunProg"), GoTo(":Exit") )
Back to Top

Does GroundControl wait for a sub-script to finish?
Yes the calling script will wait for the 'sub-script' to finish before resuming execution.

If you have a macro running that calls another macro, GroundControl finishes executing the sub macro before continuing on with the main macro.
 
Back to Top

Does GroundControl treat variables in sub strings that have the same name as main string variables seperately?
No, the variables are shared, so you will need to name the variables you want to keep separate with unique variable names.
Back to Top

Can GroundControl run as a service?
No, GroundControl does not support running as a service. For GroundControl to run a user must be logged on.
Back to Top

Can GroundControl UnLock a Locked workstation?
No GroundControl cannot UnLock a Locked workstation, GroundControl can run "Behind" a locked workstation, meaning it can execute and run tasks while a workstation is locked but it cannot UnLock the workstation.
Back to Top

How can I use a variable as part of a parameter?
You must create a single variable using the AddString command to include all the text into one variable, and pass that variable to the command. You can use text or a variable as a parameter, but not both.

Examples:

//SUPPORTED
RunProgram("c:\mypath\myprogram.exe",Normal)


OR
//SUPPORTED
PutVar(%Run,"c:\mypath\myprogram.exe")
RunProgram(%Run,Normal)


OR
// SUPPORTED
PutVar(%Path,"c:\mypath")
PutVar(%Program,"myprogram.exe")
AddString(%Run,%Path)
AddString(%Run,"\")
AddString(%Run,%Program)
RunProgram(%Run,Normal)


BUT NOT
//NOT SUPPORTED
PutVar(%Path,"c:\mypath\")
RunProgram("%Path\myprogram.exe",Normal) -- is invalid

Back to Top

Sales: (661) 334-4888

Support:

e-mail: sales@acrasoft.com

e-mail: support@acrasoft.com


   ©2001 Acrasoft All rights reserved.