Jump to content

My Virtual Keyboard


Info
 Share

Recommended Posts

Notes:

1) Do not try to combine keys with your keyboard and the keyboard GUI, most of the combines will work though.

2) I'm new to AutoIt so please give me advices how to improve my writing.

Thanks to:

- Melba 23 for his help.

- martin for his help.

- wraithdu for his help.

- GaryFrost for his GetKeyState functions.

Virtual Keyboard.au3

Virtual Keyboard - Everything.rar

Edited by Info
Link to comment
Share on other sites

I'm suprised after that other thread this was how you chose to do it, but so be it. Anyway, this line -

If WinActivate($ReplacedString) = 1 Then Send($_Key)

is wrong. The WinActivate() function returns the handle of the activated window, so it will never equal 1, and you will never send the keystroke. Was this actually working for you somehow?

Link to comment
Share on other sites

I'm not sure but if

If WinActivate($ReplacedString) Then Send($_Key)

is right then

If WinActivate($ReplacedString) = True Then Send($_Key)

is right

and if

If WinActivate($ReplacedString) = True Then Send($_Key)

is like

If WinActivate($ReplacedString) = 1 Then Send($_Key)

because both represent success then

If WinActivate($ReplacedString) = 1 Then Send($_Key)

is right

All of them work the same so it really doesn't matter...

:)

Edited by Info
Link to comment
Share on other sites

No it DOES NOT. That line is NEVER true.

Not that it matters, but see here for how to change button styles dynamically:

http://www.autoitscript.com/forum/index.php?showtopic=97951&view=findpost&p=705070

If you don't want to use that method, then it's still better to show/hide two buttons with different states that to always destroy/re-create buttons for the Shift etc. keys.

Link to comment
Share on other sites

I delete the Alt, Ctrl and Shift buttons because I need to create new ones with a different style, I can't just hide and show them.

What do you think overall about the program?

No it DOES NOT. That line is NEVER true.

Both lines work exactly the same for me. How can you explain that? Edited by Info
Link to comment
Share on other sites

Oh, hmmm, seems to have been a change in AutoIt 3.3.1.0 beta.

Added #764: Return Pid on ProcessWait() and handle on WinWait(), WinWaitActive, WinActivate(), WinActive(), WinMove() when successful.

That should probably be labeled as script breaking in the changelog. Anyway, given this fact, it's probably better to change that line to

If WinActivate($ReplacedString) Then Send($_Key)

for compatibility.

Edited by wraithdu
Link to comment
Share on other sites

Good work and thanks for sharing. :)

However, just wanted to mention that there is already a free virtual keyboard for clicking to type on the screen:

On-Screen Keyboard Portable

http://portableapps.com/apps/accessibility/on-screen_keyboard_portable

Link to comment
Share on other sites

Good work and thanks for sharing. :)

However, just wanted to mention that there is already a free virtual keyboard for clicking to type on the screen:

On-Screen Keyboard Portable

http://portableapps.com/apps/accessibility/on-screen_keyboard_portable

Urgh, why do people always say something like that? This guy is learning, he is new. Maybe, just maybe he wanted to know how it was done? Maybe, he wanted to learn. Why re-invent the wheel? Do it until you find a better wheel. That's what innovation is about. The saying "If it's not broke, don't fix it" is flawed! It assumes perfection. And you know what it means to assume (it makes an ass out of u and me). Edited by JamesBrooks
Link to comment
Share on other sites

However, just wanted to mention that there is already a free virtual keyboard for clicking to type on the screen:

We know that and it's not very suitable for many applications. For instance if you want to use it on a touch screen then you have to have fingers like a pixie's, so I think it's good to know how to make your own. Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

martin what do you think about the virtual keyboard?

I think it's extremely good.

I think you could have made it even better.

A> If you used wraithdu's idea to prevent focus.

B> If you made better indication of the state of the modifyer keys. If Ctrl is down it's not so obvious. You make the shift key smaller when it is down, so if you made a bright label show behind it as a border it would look lit perhaps.

Maybe something like

#include <windowsconstants.au3>
#include <guiconstantsEx.au3>

$gui = GUICreate("lit key",100,100)

$btn = GUICtrlCreateButton("CTRL",52,52,38,20)
$lab = GUICtrlCreateLabel("",50,50,42,24,$WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1,0x300ff00)
GUICtrlSetState(-1,$GUI_HIDE)
GUISetState()
$off = false
while 1
    $Msg = GUIGetMsg()

        if $Msg = -3 then Exit

        if $Msg = $Btn Then
            if $off Then
                GUICtrlSetState($lab,$GUI_HIDE)
            Else
                GUICtrlSetState($lab,$GUI_SHOW)
            EndIf
            $off = not $off
        EndIf

WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...