Based on
<https://www.gwmicro.com/Support/Knowledge_Base/?kbnumber=GWKB2035>
https://www.gwmicro.com/Support/Knowledge_Base/?kbnumber=GWKB2035
I wrote the script as shown at the end of this email
Since ExecuteGlobal did not behave as I expected, I did some searching on
the web and found Eval
The call to ExecuteGlobal and the first call to Eval, both result in "No
error" and 0 as result
The second call to Eval results in the expected 15.
The call to Execute results in the expected 50
What do I do wrong with the call to ExecuteGlobal and the first call to Eval
?
Option Explicit
Dim myHotkey : Set myHotkey = Keyboard.RegisterHotkey("Control-Shift-1",
"MyFunction")
Sub MyFunction()
On Error Resume Next
Dim result : result = 0
Dim a : a = 5
Dim b : b = 10
ExecuteGlobal "result = a + b"
If Err Then
call MsgBox("error")
Else
call MsgBox("No error")
End If
MsgBox result
Eval "result = a + b"
If Err Then
call MsgBox("error")
Else
call MsgBox("No error")
End If
MsgBox result
result = Eval( "a + b" )
If Err Then
call MsgBox("error")
Else
call MsgBox("No error")
End If
MsgBox result
Execute "result = a * b"
If Err Then
call MsgBox("error")
Else
call MsgBox("No error")
End If
MsgBox result
End Sub
Met vriendelijke groet, kind regards
Nico Valster
<http://www.babbage.com/> www.babbage.com
<http://www.youtube.com/results?search_query=babbagecom> Babbage op Youtube
klik hier:
Onyxdijk 199
4706 LL Roosendaal
tel. : 0165-536156
KVK: 20065000
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com/attachments/20151127/34531961/attachment.htm>
_______________________________________________
Any views or opinions presented in this email are solely those of the author
and do not necessarily represent those of Ai Squared.
For membership options, visit
http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/archive%40mail-archive.com.
For subscription options, visit
http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com
List archives can be found at
http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com