Jump to content

VBScript to autoIt conversion


Recommended Posts

Hi all,

Can somebody help me to convert the following VBScript to AutoIt. I think I could manage most of it myself but haven't worked out how to use the ObjEvent function in this situation. I am connecting to the windoweyes.application, and registering a hotkey via window-eyes com object. For thoughs who don't know, Window-eyes is a screenreader for the blind. Where can I find the VBScript converter tool I can't seem to find it anythere?. Please help.

Begin VBScript:

Dim MyHotKey, keyFlag

keyFlag = False

Set WE = CreateObject("WindowEyes.Application")

set MyHotKey = WE.Keyboard.RegisterHotkey("control-shift-c", GetRef("helloWorld"))

While Not keyFlag

wscript.Sleep 100

Wend

WE.Speech.Speak "all done, thanks for playing"

Sub helloWorld()

WE.Speech.Speak "hello world"

keyFlag = True

End Sub

Thanks for any help here.

Warm regards.

Martin Webster.

Link to comment
Share on other sites

You don't actually need any event processing. Just use the native HotKeySet() function (see help file):

Global $MyHotKey, $keyFlag, $WE

$keyFlag = False
$WE = ObjCreate("WindowEyes.Application")
HotKeySet("^+c", "helloWorld")

While Not $keyFlag
    Sleep(100)
WEnd
$WE.Speech.Speak("all done, thanks for playing")

Func helloWorld()
    $WE.Speech.Speak("hello world")
    $keyFlag = True
EndFunc   ;==>helloWorld

:(

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hi,

Thanks for your reply, but there may be times when I need window-eyes to handle the function, this is of course not one of thoughs situations, but if I wanted window-eyes to handle the helloWorld function, via the Keyboard Object and RegisterHotkey property, then how do I do this using the ObjEvent function?. I will try and give you a scenario where this could be needed , I may have to have absolute control of the speech output, and therefore have to tell window-eyes to SHUTUP!!!!. smile, sorry this is not a good example, in fact I'd say it's rubbish if I heard it from anybody else smile LOL. Sometimes it would just be better to let window-eyes handle events. If you could give me another lesson with the ObjEvent function, that would be cool. Thanks again so much.

Warm regards.

Martin Webster.

Link to comment
Share on other sites

I can't test it, but I would guess the AutoIt equivalent of GetRef() in your original script would be DllCallbackRegister() followed by DllCallbackGetPtr(). You would pass that pointer to WindowEyes to call the function.

:(

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I can't test it, but I would guess the AutoIt equivalent of GetRef() in your original script would be DllCallbackRegister() followed by DllCallbackGetPtr(). You would pass that pointer to WindowEyes to call the function.

:(

Hi Mellow,

I'll look at the help docs for the DLL functions you mentioned all though for now I think I'll just let autoIt handle things. It's a great scripting language I am really pleased with it so far. Thanks for your help.

Warm regards.

Martin Webster.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...