anixon Posted June 14, 2007 Share Posted June 14, 2007 (edited) The following code is for a virtual keyboard. No guarantees, warranties are offered or implied that it is fit for any particular purpose. Comments on the structure of the code would be appreciated Ant.. CODE;Includes #include <GuiConstants.au3> #include <Inet.au3> #include <IE.au3> ;Constants Dim $Title = "Your Virtual Keyboard [VK] Name" Dim $webpage = "http address for logon web page" Dim $LogonScreen = "The Browser Tabs screen name before logged in" Dim $loggedinscreen = "The Browser Tabs screen name after logged in" Dim $oFormName = "With $logon screen active go to Menu Item Paqe/View source for this name" Dim $oUserName = "With $logon screen active go to Menu Item Page/View source for this name" Dim $oPassword = "With $logon screen active go to Menu Page/View source for this name" ;Variables Global $wintitle = "", $capsflag = 1, $tabflag = 0, $screenflag = 0, $font = "times new roman", $oValue = 0, $oQuery = "", $vkey = "" ;Internet Connectivity $IsCon = DllCall("WinInet.dll", "int", "InternetGetConnectedState", "int_ptr", 0, "int", 0) If $IsCon[0] = 0 Then MsgBox(0, $Title & "- Virtual Keyboard ", "NO Internet CONNECTIVITY.", 10) PLExit() EndIf ;Open Webpage $oIE = _IECreate($webpage) _IELoadWait($oIE) WinSetState($LogonScreen, "", @SW_MAXIMIZE) If WinExists($LogonScreen) Then Else $message = " Site NOT AVAILABLE" DisplayMessage() PLExit() EndIf ;User Interface While 1 ;Random Screen Placement $x = Random(5, 120, 1) $y = Random(250, 550, 1) GUICreate($Title & " - Virtual Keyboard", 320, 100, $x, $y, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) GUISetFont(10, 800, 1, $font) $tab = GUICtrlCreateButton("Tab", 5, 5, 30, 20) If $capsflag = 1 Then $q = GUICtrlCreateButton("Q", 35, 5, 20, 20) $w = GUICtrlCreateButton("W", 55, 5, 20, 20) $e = GUICtrlCreateButton("E", 75, 5, 20, 20) $r = GUICtrlCreateButton("R", 95, 5, 20, 20) $t = GUICtrlCreateButton("T", 115, 5, 20, 20) $y = GUICtrlCreateButton("Y", 135, 5, 20, 20) $u = GUICtrlCreateButton("U", 155, 5, 20, 20) $i = GUICtrlCreateButton("I", 175, 5, 20, 20) $o = GUICtrlCreateButton("O", 195, 5, 20, 20) $p = GUICtrlCreateButton("P", 215, 5, 20, 20) Else $q = GUICtrlCreateButton("q", 35, 5, 20, 20) $w = GUICtrlCreateButton("w", 55, 5, 20, 20) $e = GUICtrlCreateButton("e", 75, 5, 20, 20) $r = GUICtrlCreateButton("r", 95, 5, 20, 20) $t = GUICtrlCreateButton("t", 115, 5, 20, 20) $y = GUICtrlCreateButton("y", 135, 5, 20, 20) $u = GUICtrlCreateButton("u", 155, 5, 20, 20) $i = GUICtrlCreateButton("i", 175, 5, 20, 20) $o = GUICtrlCreateButton("o", 195, 5, 20, 20) $p = GUICtrlCreateButton("p", 215, 5, 20, 20) EndIf $7 = GUICtrlCreateButton("7", 255, 5, 20, 20) $8 = GUICtrlCreateButton("8", 275, 5, 20, 20) $9 = GUICtrlCreateButton("9", 295, 5, 20, 20) $Caps = GUICtrlCreateButton("Caps", 5, 25, 35, 20) If $capsflag = 1 Then $a = GUICtrlCreateButton("A", 40, 25, 20, 20) $s = GUICtrlCreateButton("S", 60, 25, 20, 20) $d = GUICtrlCreateButton("D", 80, 25, 20, 20) $f = GUICtrlCreateButton("F", 100, 25, 20, 20) $g = GUICtrlCreateButton("G", 120, 25, 20, 20) $h = GUICtrlCreateButton("H", 140, 25, 20, 20) $j = GUICtrlCreateButton("J", 160, 25, 20, 20) $k = GUICtrlCreateButton("K", 180, 25, 20, 20) $l = GUICtrlCreateButton("L", 200, 25, 20, 20) Else $a = GUICtrlCreateButton("a", 40, 25, 20, 20) $s = GUICtrlCreateButton("s", 60, 25, 20, 20) $d = GUICtrlCreateButton("d", 80, 25, 20, 20) $f = GUICtrlCreateButton("f", 100, 25, 20, 20) $g = GUICtrlCreateButton("g", 120, 25, 20, 20) $h = GUICtrlCreateButton("h", 140, 25, 20, 20) $j = GUICtrlCreateButton("j", 160, 25, 20, 20) $k = GUICtrlCreateButton("k", 180, 25, 20, 20) $l = GUICtrlCreateButton("l", 200, 25, 20, 20) EndIf $enter = GUICtrlCreateButton("Enter", 220, 25, 35, 20) $4 = GUICtrlCreateButton("4", 255, 25, 20, 20) $5 = GUICtrlCreateButton("5", 275, 25, 20, 20) $6 = GUICtrlCreateButton("6", 295, 25, 20, 20) If $capsflag = 1 Then $z = GUICtrlCreateButton("Z", 45, 45, 20, 20) $x = GUICtrlCreateButton("X", 65, 45, 20, 20) $c = GUICtrlCreateButton("C", 85, 45, 20, 20) $v = GUICtrlCreateButton("V", 105, 45, 20, 20) $b = GUICtrlCreateButton("B", 125, 45, 20, 20) $n = GUICtrlCreateButton("N", 145, 45, 20, 20) $m = GUICtrlCreateButton("M", 165, 45, 20, 20) Else $z = GUICtrlCreateButton("z", 45, 45, 20, 20) $x = GUICtrlCreateButton("x", 65, 45, 20, 20) $c = GUICtrlCreateButton("c", 85, 45, 20, 20) $v = GUICtrlCreateButton("v", 105, 45, 20, 20) $b = GUICtrlCreateButton("b", 125, 45, 20, 20) $n = GUICtrlCreateButton("n", 145, 45, 20, 20) $m = GUICtrlCreateButton("m", 165, 45, 20, 20) EndIf $comma = GUICtrlCreateButton(",", 185, 45, 20, 20) $Kfullstop = GUICtrlCreateButton(".", 205, 45, 20, 20) If $capsflag = 1 Then $CapsL = GUICtrlCreateButton("Caps ON", 7, 70, 65, 25) GUICtrlSetColor(-1, 0x008000) ; Green ElseIf $capsflag = 0 Then $CapsL = GUICtrlCreateButton("Caps OFF", 7, 70, 65, 25) GUICtrlSetColor(-1, 0xff0000) ; Red EndIf $logon = GUICtrlCreateButton("Logon ON", 85, 70, 85, 25) $1 = GUICtrlCreateButton("1", 255, 45, 20, 20) $2 = GUICtrlCreateButton("2", 275, 45, 20, 20) $3 = GUICtrlCreateButton("3", 295, 45, 20, 20) $0 = GUICtrlCreateButton("0", 255, 65, 40, 20) $Nfullstop = GUICtrlCreateButton(".", 295, 65, 20, 20) $exitbutton = GUICtrlCreateButton("Exit", 185, 70, 50, 25) GUICtrlSetState(-1, $GUI_FOCUS) GUISetState() ;Keystroke Processor While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitbutton GUIDelete() PLExit() Case $msg = $tab Or $msg = $enter If $screenflag = 0 Then Screenprocess() $message = " User ID NOT VALID" DisplayMessage() GUIDelete() ExitLoop Else Screenprocess() Send("{tab}") $screenflag = 0 $tabflag = 1 ExitLoop EndIf Case $msg = $Caps If $capsflag = 0 Then $capsflag = 1 ElseIf $capsflag = 1 Then $capsflag = 0 EndIf GUIDelete() ExitLoop Case $msg = $logon If $tabflag = 0 Then $message = " User ID NOT VALID" DisplayMessage() GUIDelete() WinActivate($wintitle) ExitLoop EndIf If $screenflag = 0 Then $message = " Password NOT VALID" DisplayMessage() GUIDelete() WinActivate($wintitle) ExitLoop EndIf Screenprocess() $oForm = _IEFormGetObjByName($oIE, $oFormName) _IEFormSubmit($oForm) _IELoadWait($oIE) If WinExists($loggedinscreen) Then Exit Else $message = " User ID or Password NOT VALID" DisplayMessage() PLExit() EndIf Case $msg = $a If $capsflag = 1 Then $vkey = "A" If $capsflag = 0 Then $vkey = "a" VKeyprocessor() ExitLoop Case $msg = $b If $capsflag = 1 Then $vkey = "B" If $capsflag = 0 Then $vkey = "b" VKeyprocessor() ExitLoop Case $msg = $c If $capsflag = 1 Then $vkey = "C" If $capsflag = 0 Then $vkey = "c" VKeyprocessor() ExitLoop Case $msg = $d If $capsflag = 1 Then $vkey = "D" If $capsflag = 0 Then $vkey = "d" VKeyprocessor() ExitLoop Case $msg = $e If $capsflag = 1 Then $vkey = "E" If $capsflag = 0 Then $vkey = "e" VKeyprocessor() ExitLoop Case $msg = $f If $capsflag = 1 Then $vkey = "F" If $capsflag = 0 Then $vkey = "f" VKeyprocessor() ExitLoop Case $msg = $g If $capsflag = 1 Then $vkey = "G" If $capsflag = 0 Then $vkey = "g" VKeyprocessor() ExitLoop Case $msg = $h If $capsflag = 1 Then $vkey = "H" If $capsflag = 0 Then $vkey = "h" VKeyprocessor() ExitLoop Case $msg = $i If $capsflag = 1 Then $vkey = "I" If $capsflag = 0 Then $vkey = "i" VKeyprocessor() ExitLoop Case $msg = $j If $capsflag = 1 Then $vkey = "J" If $capsflag = 0 Then $vkey = "j" VKeyprocessor() ExitLoop Case $msg = $k If $capsflag = 1 Then $vkey = "K" If $capsflag = 0 Then $vkey = "k" VKeyprocessor() ExitLoop Case $msg = $l If $capsflag = 1 Then $vkey = "L" If $capsflag = 0 Then $vkey = "l" VKeyprocessor() ExitLoop Case $msg = $m If $capsflag = 1 Then $vkey = "M" If $capsflag = 0 Then $vkey = "m" VKeyprocessor() ExitLoop Case $msg = $n If $capsflag = 1 Then $vkey = "N" If $capsflag = 0 Then $vkey = "n" VKeyprocessor() ExitLoop Case $msg = $o If $capsflag = 1 Then $vkey = "O" If $capsflag = 0 Then $vkey = "o" VKeyprocessor() ExitLoop Case $msg = $p If $capsflag = 1 Then $vkey = "P" If $capsflag = 0 Then $vkey = "p" VKeyprocessor() ExitLoop Case $msg = $q If $capsflag = 1 Then $vkey = "Q" If $capsflag = 0 Then $vkey = "q" VKeyprocessor() ExitLoop Case $msg = $r If $capsflag = 1 Then $vkey = "R" If $capsflag = 0 Then $vkey = "r" VKeyprocessor() ExitLoop Case $msg = $s If $capsflag = 1 Then $vkey = "S" If $capsflag = 0 Then $vkey = "s" VKeyprocessor() ExitLoop Case $msg = $t If $capsflag = 1 Then $vkey = "T" If $capsflag = 0 Then $vkey = "t" VKeyprocessor() ExitLoop Case $msg = $u If $capsflag = 1 Then $vkey = "U" If $capsflag = 0 Then $vkey = "u" VKeyprocessor() ExitLoop Case $msg = $v If $capsflag = 1 Then $vkey = "V" If $capsflag = 0 Then $vkey = "v" VKeyprocessor() ExitLoop Case $msg = $w If $capsflag = 1 Then $vkey = "W" If $capsflag = 0 Then $vkey = "w" VKeyprocessor() ExitLoop Case $msg = $x If $capsflag = 1 Then $vkey = "X" If $capsflag = 0 Then $vkey = "x" VKeyprocessor() ExitLoop Case $msg = $y If $capsflag = 1 Then $vkey = "Y" If $capsflag = 0 Then $vkey = "y" VKeyprocessor() ExitLoop Case $msg = $z If $capsflag = 1 Then $vkey = "Z" If $capsflag = 0 Then $vkey = "z" VKeyprocessor() ExitLoop Case $msg = $1 $vkey = 1 VKeyprocessor() ExitLoop Case $msg = $2 $vkey = 2 VKeyprocessor() ExitLoop Case $msg = $3 $vkey = 3 VKeyprocessor() ExitLoop Case $msg = $4 $vkey = 4 VKeyprocessor() ExitLoop Case $msg = $5 $vkey = 5 VKeyprocessor() ExitLoop Case $msg = $6 $vkey = 6 VKeyprocessor() ExitLoop Case $msg = $7 $vkey = 7 VKeyprocessor() ExitLoop Case $msg = $8 $vkey = 8 VKeyprocessor() ExitLoop Case $msg = $9 $vkey = 9 VKeyprocessor() ExitLoop Case $msg = $0 $vkey = 0 VKeyprocessor() ExitLoop Case $msg = $comma $vkey = "," VKeyprocessor() ExitLoop Case $msg = $Kfullstop Or $msg = $Nfullstop $vkey = "." VKeyprocessor() ExitLoop EndSelect WEnd WEnd ;Process Keyboard Selection Func VKeyprocessor() $screenflag = $screenflag + 1 $oForm = _IEFormGetObjByName($oIE, $oFormName) If $tabflag = 0 Then $oQuery = _IEFormElementGetObjByName($oForm, $oUserName) Else $oQuery = _IEFormElementGetObjByName($oForm, $oPassword) EndIf $oValue = _IEFormElementGetValue($oQuery) If $oValue = "" Then _IEFormElementSetValue($oQuery, $vkey) Else _IEFormElementSetValue($oQuery, $oValue & $vkey) EndIf Screenprocess() EndFunc ;==>VKeyprocessor ;Process Screen Func Screenprocess() Opt("WinTitleMatchMode", 4) $wintitle = WinGetTitle("[ACTIVE]") GUIDelete() WinActivate($LogonScreen, "") WinActivate($wintitle) EndFunc ;==>Screenprocess ;Message Box Subroutine Func DisplayMessage() SplashTextOn($Title & "- Virtual Keyboard", $message, 250, 50, 600, 500, 36, "times new roman", 10, 600) Sleep(3500) SplashOff() EndFunc ;==>DisplayMessage ;Exit Script Func PLExit() $PID = ProcessExists("iexplore.exe") If $PID Then ProcessClose($PID) Exit EndFunc ;==>PLExit Edited June 14, 2007 by anixon Link to comment Share on other sites More sharing options...
i542 Posted June 15, 2007 Share Posted June 15, 2007 Really want a comment? ok it sucks but if you try next things to improve your program it can improve to great program. here: - For god's name, insert a GUI to declare constants! I am getting sick of entering values in those constants by itself! - Add some instructions. What means: ;Constants Dim $Title = "Your Virtual Keyboard [VK] Name" Dim $webpage = "http address for logon web page" Dim $LogonScreen = "The Browser Tabs screen name before logged in" Dim $loggedinscreen = "The Browser Tabs screen name after logged in" Dim $oFormName = "With $logon screen active go to Menu Item Paqe/View source for this name" ;this Dim $oUserName = "With $logon screen active go to Menu Item Page/View source for this name" ;this Dim $oPassword = "With $logon screen active go to Menu Page/View source for this name";this Made a description in G U I or change name. - Support for Firefox will be appreciated ok thats all when you finish I am waiting you with new tasks lol. I can do signature me. Link to comment Share on other sites More sharing options...
Skrip Posted June 15, 2007 Share Posted June 15, 2007 (edited) Question(s): What is this supposed to do exactly? What did you make this for? Why does it connect me to google searching for http address for logon web page? Why does it do a 'random screen placement'? Edited June 15, 2007 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
i542 Posted June 15, 2007 Share Posted June 15, 2007 don't ask me but if you do, I will try to create program based on it I can do signature me. Link to comment Share on other sites More sharing options...
anixon Posted June 16, 2007 Author Share Posted June 16, 2007 (edited) Question(s): What is this supposed to do exactly? What did you make this for? Why does it connect me to google searching for http address for logon web page? Why does it do a 'random screen placement'?You have to change the DIM values to suit your purpose. My script is designed to run the logon process for a specific Internet Banking website. It might require modification to suit other logon processes. Physical Keyboard is not usedAnt.. Edited June 16, 2007 by anixon Link to comment Share on other sites More sharing options...
anixon Posted June 16, 2007 Author Share Posted June 16, 2007 Really want a comment? ok it sucks but if you try next things to improve your program it can improve to great program. here: - For god's name, insert a GUI to declare constants! I am getting sick of entering values in those constants by itself! - Add some instructions. What means: ;Constants Dim $Title = "Your Virtual Keyboard [VK] Name" Dim $webpage = "http address for logon web page" Dim $LogonScreen = "The Browser Tabs screen name before logged in" Dim $loggedinscreen = "The Browser Tabs screen name after logged in" Dim $oFormName = "With $logon screen active go to Menu Item Paqe/View source for this name" ;this Dim $oUserName = "With $logon screen active go to Menu Item Page/View source for this name" ;this Dim $oPassword = "With $logon screen active go to Menu Page/View source for this name";this Made a description in G U I or change name. - Support for Firefox will be appreciated ok thats all when you finish I am waiting you with new tasks lol. Thanks for your frank response which I guess pretty much applies to an end product. I guess that the script is very much in the development stage and as I previously mentioned I was looking for comments on structure or more particularily how to make the code more efficient. I was not publishing an end solution. Code documentation is definately useful however I guess I made the mistake of assuming that whoever after reading the code would know what it was about. Once again thanks for the comments Ant.. Link to comment Share on other sites More sharing options...
i542 Posted June 16, 2007 Share Posted June 16, 2007 no problem just post a little better script and here you go four stars at topic But first post updated script. I can do signature me. Link to comment Share on other sites More sharing options...
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