Champak Posted January 10, 2008 Posted January 10, 2008 (edited) I found this as part of another script and hacked around it to get the basic function that I need. However I need it to do a little more but can't figure how to get it the rest of the way, so hopefully I can get some help. This is an onscreen keyboard.I need:1/ I need it not to be set up on the "GUIOnEventMode 1". I tried setting this up on the default loop mode, but nothing I did would work. This has to integrate with another script I have that must be in continuous loop.2/ It isn't sending what I have in the input, it keeps sending "40". (This is really weird to me)3/ I made a weak workaround where this script will hide the keyboard for a split second and send the input to the previous window and then the keyboard will pop back up/reactivate. I would prefer it not have to HIDE=>SEND=>SHOW, because I feel that something like that will fail down the line in certain situations. 4/ I would prefer that it sends the info to whatever app immediately, instead of having to press the enter button after I type everything to send the info.5/ Although the main purpose of this is for a touch screen, I would like to have the option to use a standard keyboard. This thing is blocking keyboard input.Thanks for any helpexpandcollapse popup#include <GuiConstants.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) Dim $BTN_[40] $key = StringSplit("1,2,3,4,5,6,7,8,9,0,Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M", ",") $mainwindow = GuiCreate("Keyboard", 400, 200, 20, @DesktopHeight - 300, -1, "") ; BUTTONS $BTN_[1] = GuiCtrlCreateButton("1", 0, 0, 40, 40) $BTN_[2] = GuiCtrlCreateButton("2", 40, 0, 40, 40) $BTN_[3] = GuiCtrlCreateButton("3", 80, 0, 40, 40) $BTN_[4] = GuiCtrlCreateButton("4", 120, 0, 40, 40) $BTN_[5] = GuiCtrlCreateButton("5", 160, 0, 40, 40) $BTN_[6] = GuiCtrlCreateButton("6", 200, 0, 40, 40) $BTN_[7] = GuiCtrlCreateButton("7", 240, 0, 40, 40) $BTN_[8] = GuiCtrlCreateButton("8", 280, 0, 40, 40) $BTN_[9] = GuiCtrlCreateButton("9", 320, 0, 40, 40) $BTN_[10] = GuiCtrlCreateButton("0", 360, 0, 40, 40) $BTN_[11] = GuiCtrlCreateButton("Q", 0, 40, 40, 40) $BTN_[12] = GuiCtrlCreateButton("W", 40, 40, 40, 40) $BTN_[13] = GuiCtrlCreateButton("E", 80, 40, 40, 40) $BTN_[14] = GuiCtrlCreateButton("R", 120, 40, 40, 40) $BTN_[15] = GuiCtrlCreateButton("T", 160, 40, 40, 40) $BTN_[16] = GuiCtrlCreateButton("Y", 200, 40, 40, 40) $BTN_[17] = GuiCtrlCreateButton("U", 240, 40, 40, 40) $BTN_[18] = GuiCtrlCreateButton("I", 280, 40, 40, 40) $BTN_[19] = GuiCtrlCreateButton("O", 320, 40, 40, 40) $BTN_[20] = GuiCtrlCreateButton("P", 360, 40, 40, 40) $BTN_[21] = GuiCtrlCreateButton("A", 20, 80, 40, 40) $BTN_[22] = GuiCtrlCreateButton("S", 60, 80, 40, 40) $BTN_[23] = GuiCtrlCreateButton("D", 100, 80, 40, 40) $BTN_[24] = GuiCtrlCreateButton("F", 140, 80, 40, 40) $BTN_[25] = GuiCtrlCreateButton("G", 180, 80, 40, 40) $BTN_[26] = GuiCtrlCreateButton("H", 220, 80, 40, 40) $BTN_[27] = GuiCtrlCreateButton("J", 260, 80, 40, 40) $BTN_[28] = GuiCtrlCreateButton("K", 300, 80, 40, 40) $BTN_[29] = GuiCtrlCreateButton("L", 340, 80, 40, 40) $BTN_[30] = GuiCtrlCreateButton("Z", 40, 120, 40, 40) $BTN_[31] = GuiCtrlCreateButton("X", 80, 120, 40, 40) $BTN_[32] = GuiCtrlCreateButton("C", 120, 120, 40, 40) $BTN_[33] = GuiCtrlCreateButton("V", 160, 120, 40, 40) $BTN_[34] = GuiCtrlCreateButton("B", 200, 120, 40, 40) $BTN_[35] = GuiCtrlCreateButton("N", 240, 120, 40, 40) $BTN_[36] = GuiCtrlCreateButton("M", 280, 120, 40, 40) $BackSpace = GuiCtrlCreateButton("<-", 320, 120, 40, 40) GUICtrlSetFont( -1, 10, 500) $Input = GUICtrlCreateInput("", 5, 170, 305, 23) GUICtrlSetFont( -1, 10) $Send = GUICtrlCreateButton("&ENTER", 315, 160, 80, 40) For $i = 1 To 37 GUICtrlSetOnEvent($BTN_[$i], "ButtonPressed") Next GUICtrlSetOnEvent($BackSpace, "Back_Space") GUICtrlSetOnEvent($Send, "Send_it") GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState(@SW_SHOW) WinSetOnTop ( "Keyboard", "", 1 ) WinSetTrans ( "Keyboard", "", 200) While (1) Sleep(500) WEnd Func ButtonPressed() $i = @GUI_CtrlId - $BTN_[1] + 1; array starts at item 1, so add 1 $info1 = GUICtrlRead($input) GUICtrlSetData($input, $info1 & $key[$i]) EndFunc Func Back_Space() $info1 = GUICtrlRead($input) $info1 = StringTrimRight($info1, 1) GUICtrlSetData($input, $info1 ) EndFunc Func CLOSEClicked() If @GUI_WINHANDLE = $mainwindow Then Exit EndIf EndFunc Func Send_it() GUISetState(@SW_HIDE, $mainwindow) $VolumeDownKey = WinGetTitle ( "") Send($input) GUISetState(@SW_SHOW, $mainwindow) GUICtrlSetData($input, "" ) EndFunc Edited January 12, 2008 by Champak
evilertoaster Posted January 10, 2008 Posted January 10, 2008 (edited) for #2- Send(GUICtrlRead($input)) instead of Send($input) Edited January 10, 2008 by evilertoaster
Champak Posted January 12, 2008 Author Posted January 12, 2008 Thanks, I don't know why I didn't realize that. .............Now for the rest. Anyone?
John117 Posted January 15, 2008 Posted January 15, 2008 im not finished but you can seehttp://www.autoitscript.com/forum/index.php?showtopic=61774
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now