Re: Execute error: Type Mismatch: 'Execute'



On Aug 20, 7:52 pm, Old Pedant <OldPed...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
"kel...@xxxxxxxxxxxxxxxxxxxx" wrote:
I'm in the process of writing a vbscript that uses KixForms as a GUI
frontend.
According to a number of web pages (and this group) it is possible to
to use it as follows;

...
Do While Form1.Visible
   Execute(Form1.DoEvents)
Loop

Ummm...I'm more than a little confused here.

According to the VBS docs
   http://msdn.microsoft.com/en-us/library/03t418d2(VS.85).aspx
the Execute *statement* will execute a *string*, only.

So unless Form1.DoEvents is a string, I don't see how that code works, at all.

Perhaps you could try
     MsgBox Form1.DoEvents
to see what string Execute is attempting to work with?


Thanks for the reply OP, to answer some of your questions;

When the script is run it loops around the do while loop waiting for
something to happen to the Form.DoEvents object.
If the button is clicked it returns the value of the Button.OnClick,
which in this case is Func_Quit.

I modified the script slightly so that it will display what
Form.DoEvents is returning;

Do While Form.Visible
func = Form.DoEvents
wscript.echo func
Execute(func)
Loop

If the button is clicked, the following is displayed on the console;

Func_Quit <- Function name being called
Function has been called <- Result of function being called.

This demonstrates that the function name is returned by the DoEvents
and it is called by the Execute command.

I've tried what you suggested earlier without success, one can click
the button but nothing happens.;
Do While Form.Visible
Form.DoEvents
Loop

What I want the script to do is to call the function, run it and then
return to the loop


Am I missing something fundamental about the execute statement ?

Thanks,
Martin.
.