Re: Execute error: Type Mismatch: 'Execute'
- From: Tom Lavedas <tglbatch@xxxxxxx>
- Date: Thu, 21 Aug 2008 10:01:20 -0700 (PDT)
On Aug 21, 11:09 am, kel...@xxxxxxxxxxxxxxxxxxxx wrote:
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.
Pure speculation here - I don't have KiXtart to test with - but maybe
this will work ...
Set Form = CreateObject( "Kixtart.Form" )
Set Button = Form.Button
Button.Text = "Close"
Button.OnClick = GetRef("Func_Quit")
Form.Show
Do While Form.Visible
wsh.sleep 100
Loop
Function Func_Quit
MsgBox "Just a message box"
wscript.echo "Function has been called"
End Function
The GetRef function is designed to bind functions to events. This
gets around the need for the Execute, I think. The Sleep in the loop
just gives up the processor for a time so that other threads get their
time to function.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
.
- References:
- Execute error: Type Mismatch: 'Execute'
- From: kellym
- RE: Execute error: Type Mismatch: 'Execute'
- From: Old Pedant
- Re: Execute error: Type Mismatch: 'Execute'
- From: kellym
- Execute error: Type Mismatch: 'Execute'
- Prev by Date: Security EventLog
- Next by Date: Re: Extraction of text
- Previous by thread: Re: Execute error: Type Mismatch: 'Execute'
- Next by thread: split txt file
- Index(es):