June 26, 2008

WinTask - Undocumented Workarounds

As with any tool, there are a few undocumented problems and limitations in WinTask.


Here are some that I know about.  I'll add more as I learn of them.
(last updated: December 30, 2009)

#ScriptAfterTimeout$
#ScriptAfterTimeout$ does not allow you to use a .rob file name containing a space. It works correctly if the .rob doesn't contain any spaces in the file name.

So this will not work:
#ScriptAfterTimeout$="After Timeout"
#ExecTimeout = 20

Pause 30 secs
MsgBox("Ok")
WinTask Tech Support says that the " needs to be doubled:
The " needs to be doubled, so try:
#ScriptAfterTimeout$=chr$(34)+"After Timeout"+chr$(34)
and it will work.
BEGINDIALOG ... ENDDIALOG
In version 3.5a, it doesn't appear that the CAPTION statement works correctly in dialogs.

For example, the titlebar of this dialog won't show any caption, even though it should show "My Caption is Here":

    BEGINDIALOG Dialog 465, 387, 350, 220
    CAPTION "My Caption is Here"
    DEFPUSHBUTTON "&OK", btnOK, 137, 157, 75, 23
    ENDDIALOG

    CallDialog Dialog

The workaround is to remember to use the optional Title$ argument in every CallDialog statement:

    CallDialog Dialog,"My Caption is Here"

Note: This has been fixed in subsequent versions.
Capture$
The <mode> argument in the Capture$() function cannot be a variable.  It must be a constant.

So something like this will not work
var = 0
Capture$("window name",1,var)
It will get the following syntax error:
A number is expected
As a workaround, you could create a function like this and use it in place of Capture$:
Function MyCapture$(window_name$, instance, mode)
Local a$
  Select Case mode
    Case 0
        a$=Capture$(window_name$, instance, 0)
    Case 1
        a$=Capture$(window_name$, instance, 1)
    Case 3
        a$=Capture$(window_name$, instance, 3)
    Case 5
        a$=Capture$(window_name$, instance, 5)
    Case 7
        a$=Capture$(window_name$, instance, 7)
    Case 9
        a$=Capture$(window_name$, instance, 9)
    Case Else
        a$=Capture$(window_name$, instance, 0)
  EndSelect
MyCapture$=a$
EndFunction
MsgFrame
MsgFrame() cannot display an ampersand (&) as part of the text.

So, MsgFrame("A&B",1) will just display "AB"

WinTask Tech Support says to use two & characters instead of one
In the Windows control which is used for MsgFrame/MsgFrameTitle, the & is a special character (keyboard shortcut underlined). So to force the display of this character, you need to double the &
MsgFrame("A&&B",1)
MsgFrameTitle
MsgFrameTitle() cannot display an ampersand (&) as part of the text.

So, MsgFrameTitle("The Title","A&B",1) will just display "AB"

WinTask Tech Support says to use two & characters instead of one
In the Windows control which is used for MsgFrame/MsgFrameTitle, the & is a special character (keyboard shortcut underlined). So to force the display of this character, you need to double the &
MsgFrameTitle("The Title","A&&B",1)