Jump to content

Is it possible, with AutoIt, to create an on-screen keyboard that only has 3 keys (Shift, Ctrl and Alt)?


Recommended Posts

Posted

Is it possible, with AutoIt, to create an on-screen keyboard that only has 3 keys (Shift, Ctrl and Alt)? I would like to be able to click on these keys and "fool" my computer into thinking I am holding these keys down.  

Posted

I just had some time left.

 

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>


Global $hGui = GUICreate("Keyboard", 170, 50, -1, -1, -1, $WS_EX_TOPMOST)
Global $Shift = GUICtrlCreateCheckbox("Shift", 5, 5, 50, 40, $BS_PUSHLIKE)
Global $Ctrl = GUICtrlCreateCheckbox("Ctrl", 60, 5, 50, 40, $BS_PUSHLIKE)
Global $Alt = GUICtrlCreateCheckbox("Alt", 115, 5, 50, 40, $BS_PUSHLIKE)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Shift
            If _IsChecked($Shift) Then
                Send("{SHIFTDOWN}")
            Else
                Send("{SHIFTUP}")
            EndIf
        Case $Ctrl
            If _IsChecked($Ctrl) Then
                Send("{CTRLDOWN}")
            Else
                Send("{CTRLUP}")
            EndIf
        Case $Alt
            If _IsChecked($Alt) Then
                Send("{ALTDOWN}")
            Else
                Send("{ALTUP}")
            EndIf
    EndSwitch
WEnd

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

 

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Posted (edited)
7 hours ago, funkey said:

I just had some time left.

 

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>


Global $hGui = GUICreate("Keyboard", 170, 50, -1, -1, -1, $WS_EX_TOPMOST)
Global $Shift = GUICtrlCreateCheckbox("Shift", 5, 5, 50, 40, $BS_PUSHLIKE)
Global $Ctrl = GUICtrlCreateCheckbox("Ctrl", 60, 5, 50, 40, $BS_PUSHLIKE)
Global $Alt = GUICtrlCreateCheckbox("Alt", 115, 5, 50, 40, $BS_PUSHLIKE)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Shift
            If _IsChecked($Shift) Then
                Send("{SHIFTDOWN}")
            Else
                Send("{SHIFTUP}")
            EndIf
        Case $Ctrl
            If _IsChecked($Ctrl) Then
                Send("{CTRLDOWN}")
            Else
                Send("{CTRLUP}")
            EndIf
        Case $Alt
            If _IsChecked($Alt) Then
                Send("{ALTDOWN}")
            Else
                Send("{ALTUP}")
            EndIf
    EndSwitch
WEnd

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

 

This is great. I have never done any coding and I have been reading on how to do this. I have SciTE 4.1.2 but I don't see Koda under tools (which I understand I would have needed to make this script). So do I now copy this code into SciTE and press F5 and the code will run or do I need to compile the code somehow first. I appreciate you taking time to do this. I am sure this will save me hours and hours of frustration and research. I am still going to study what you have provided as I want to learn how to code.

Also, would you have any idea as to why Koda is not showing up in my SciTE 4.1.2?

Again, thank you,
yeto

 

Edited by yeto
Posted
8 hours ago, Jos said:

Install the Full Installer of SciTE4AutoIt3 to get these extra's. :) 

I am getting the following error message:

"This installer requires the AutoIt3 production release to be installed first. Stopping installation."

Where do I go to get the "AutoIt3 production release"?

Posted
7 hours ago, Jos said:

So that means you haven't installed AutoIt3 with the installer?

Thank you. That worked. Everything is working fine now.

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
  • Recently Browsing   0 members

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