
Samoth
Members-
Posts
6 -
Joined
-
Last visited
About Samoth
- Birthday 02/23/1986
Profile Information
-
Location
Wilhelmshaven, Germany
-
WWW
http://info.jtmeyer.de
Samoth's Achievements

Seeker (1/7)
1
Reputation
-
FireFox reacted to a post in a topic: IsPressed_UDF ! v2.3 | Advanced keypress
-
#1973 =) I hope this ticket is waterproof...
-
IsPressed_UDF ! v2.3 | Advanced keypress
Samoth replied to FireFox's topic in AutoIt Example Scripts
I don't know why I can't edit posts after I reloggedin. I had another little idea optimizing the last tiny bit of speed... >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\user\BWI\AutoIt\numbers.au3" ----------SHORT TEST---------- Generating random numbers...Done ! Doing test A...Done ! Result : 0.24618 sec(s) Doing test B...Done ! Result : 0.12587 sec(s) Doing test C...Done ! Result : 0.06766 sec(s) ----------LONG TEST---------- Generating random numbers...Done ! Doing test A...Done ! Result : 7.46660 sec(s) Doing test B...Done ! Result : 3.72427 sec(s) Doing test C...Done ! Result : 2.36960 sec(s) >Exit code: 0 Time: 15.797 Only posting my optimizations... For full code snip it from my previous post. I added the default value at index 0. This saves a subtraction by 1 every time. Then I just changed the global Array to have mixed content (strings and integers) which will save another comparison everytime and allows to return the result immediately. I know one shouldn't do this, but for the result is static it doesn't mess anything. There are 59 spaces in my array by the way. This optimization saves a peek over a third (36,3%) instead of a fourth compared to my nested switch-blocks before and a peek over two thirds (68,2%) compared to the linear switch-block of Valuater and FireFox. Global $a_Keys[166] = [-1, "LeftMouse", "RightMouse", -1, "MiddleMouse", "X1Mouse", "X2Mouse", -1, _ "BACKSPACE", "TAB", -1, -1, "CLEAR", "ENTER", -1, -1, "SHIFT", "CTRL", "ALT", "PAUSE", _ "CAPSLOCK", -1, -1, -1, -1, -1, -1, "ESC", -1, -1, -1, -1, "SPACEBAR", "PAGE UP", "PAGE DOWN", _ "END", "HOME", "LEFT", "UP", "RIGHT", "DOWN", "SELECT", "PRINT", "EXECUTE", "PRINT SCREEN", _ "INS", "DEL", -1, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", -1, -1, -1, -1, -1, -1, _ -1, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", _ "S", "T", "U", "V", "W", "X", "Y", "Z", "LWin", "RWin", -1, -1, -1, "0'", "1'", "2'", "3'", _ "4'", "5'", "6'", "7'", "8'", "9'", "Multiply", "Add", "Separator", "Subtract", "Decimal", _ "Divide", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", _ -1, -1, "F16", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "NUM LOCK", _ "SCROLL LOCK", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "LSHIFT", "RSHIFT", _ "LCTRL", "RCTRL", "LMENU", "RMENU"] ; #FUNCTION# =================================================================== ; Name : __GetKeyByHex_ArrayBased_Samoth2 ; Description: Returns Aplha key for specified key ; Parameter(s): None ; Requirement(s): None ; Return Value(s): On Success - Returns Key ; On Failure - Returns -1 ; Author(s): Samoth ; Note(s): Thanks Valuater... 8) ;=============================================================================== Func __GetKeyByHex_ArrayBased_Samoth2($iKeyIn = 0) $iKeyIn = Dec($iKeyIn) If $iKeyIn > 165 Then Return -1 Return $a_Keys[$iKeyIn] EndFunc ;==>__GetKeyByHex_ArrayBased_Samoth2- 104 replies
-
- _ispressed
- key
-
(and 2 more)
Tagged with:
-
IsPressed_UDF ! v2.3 | Advanced keypress
Samoth replied to FireFox's topic in AutoIt Example Scripts
Sorry for double posting, but I can't edit my post any more?? I wrote a small new function based on array indexes getting its information from a pre-initialized in-memory static global array with blank entries. It's a fourth faster then my optimized version before... This version before can dynamically be optimized by a recursive function returning the code of the nested switch-Statements. But I won't bet it can get faster than this global array based method. And my new function is the shortest I've ever seen for this. The default-Value 3 results in the first blank array entry, resulting in a return value of -1. >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\user\BWI\AutoIt\numbers.au3" LeftMouse ----------SHORT TEST---------- Generating random numbers...Done ! Doing test A...Done ! Result : 0.24911 sec(s) Doing test B...Done ! Result : 0.12014 sec(s) Doing test C...Done ! Result : 0.08559 sec(s) ----------LONG TEST---------- Generating random numbers...Done ! Doing test A...Done ! Result : 7.28746 sec(s) Doing test B...Done ! Result : 3.76141 sec(s) Doing test C...Done ! Result : 2.67726 sec(s) >Exit code: 0 Time: 15.946 Global $a_Keys[165] = ["LeftMouse", "RightMouse", "", "MiddleMouse", "X1Mouse", "X2Mouse", "", _ "BACKSPACE", "TAB", "", "", "CLEAR", "ENTER", "", "", "SHIFT", "CTRL", "ALT", "PAUSE", _ "CAPSLOCK", "", "", "", "", "", "", "ESC", "", "", "", "", "SPACEBAR", "PAGE UP", "PAGE DOWN", _ "END", "HOME", "LEFT", "UP", "RIGHT", "DOWN", "SELECT", "PRINT", "EXECUTE", "PRINT SCREEN", _ "INS", "DEL", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "", "", "", "", "", "", _ "", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", _ "S", "T", "U", "V", "W", "X", "Y", "Z", "LWin", "RWin", "", "", "", "0'", "1'", "2'", "3'", _ "4'", "5'", "6'", "7'", "8'", "9'", "Multiply", "Add", "Separator", "Subtract", "Decimal", _ "Divide", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", _ "", "", "F16", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "NUM LOCK", _ "SCROLL LOCK", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "LSHIFT", "RSHIFT", _ "LCTRL", "RCTRL", "LMENU", "RMENU"] #Region short test ConsoleWrite(@CRLF & "----------SHORT TEST----------") Global $numtest = 10000 _Test() #EndRegion short test Func _longtest() #Region long test ConsoleWrite(@CRLF & @CRLF & "----------LONG TEST----------") Global $numtest = 300000 _Test() #EndRegion long test EndFunc ;==>_longtest Func _Test() #Region Number ------------------------------ Local $random[$numtest] ConsoleWrite(@CRLF & "Generating random numbers...") For $i = 0 To $numtest - 1 $random[$i] = Random(1, Dec("A5"), 1) Next ConsoleWrite("Done !" & @CRLF) #EndRegion Number ------------------------------ #Region Test A ---------------------------------- ConsoleWrite("Doing test A...") $testBStart = TimerInit() For $i = 0 To $numtest - 1 _GetKeyByHex_SwitchNumber($random[$i]) Next $testBFinish = StringLeft(TimerDiff($testBStart) * 0.001, 7) ConsoleWrite("Done ! " & "Result : " & $testBFinish & " sec(s)" & @CRLF) #EndRegion Test A ---------------------------------- #Region Test B ---------------------------------- ConsoleWrite("Doing test B...") $testBStart = TimerInit() For $i = 0 To $numtest - 1 _GetKeyByHex_SwitchNumber_Samoth($random[$i]) Next $testBFinish = StringLeft(TimerDiff($testBStart) * 0.001, 7) ConsoleWrite("Done ! " & "Result : " & $testBFinish & " sec(s)" & @CRLF) #EndRegion Test B ---------------------------------- #Region Test C ------------------------------ ConsoleWrite("Doing test C...") $testCStart = TimerInit() For $i = 0 To $numtest - 1 __GetKeyByHex_ArrayBased_Samoth2($random[$i]) Next $testCFinish = StringLeft(TimerDiff($testCStart) * 0.001, 7) ConsoleWrite("Done ! " & "Result : " & $testCFinish & " sec(s)" & @CRLF) #EndRegion Test C ------------------------------ If $numtest = 300000 Then Exit Else _longtest() EndIf EndFunc ;==>_Test ; #FUNCTION# =================================================================== ; Name : __GetKeyType ; Description: Returns Hexadecimal or Aplha key for specified key ; Parameter(s): None ; Requirement(s): None ; Return Value(s): On Success - Returns Key ; On Failure - Returns -1 ; Author(s): Valuater, FireFox ; Note(s): Thanks Valuater... 8) ;=============================================================================== Func _GetKeyByHex_SwitchNumber($sHexKey) $sHexKey = Dec($sHexKey) Switch $sHexKey Case 1 Return "LeftMouse" Case 2 Return "RightMouse" Case 4 Return "MiddleMouse" Case 5 Return "X1Mouse" Case 6 Return "X2Mouse" Case 8 Return "BACKSPACE" Case 9 Return "TAB" Case 12 Return "CLEAR" Case 13 Return "ENTER" Case 16 Return "SHIFT" Case 17 Return "CTRL" Case 18 Return "ALT" Case 19 Return "PAUSE" Case 20 Return "CAPSLOCK" Case 27 Return "ESC" Case 32 Return "SPACEBAR" Case 33 Return "PAGE UP" Case 34 Return "PAGE DOWN" Case 35 Return "END" Case 36 Return "HOME" Case 37 Return "LEFT" Case 38 Return "UP" Case 39 Return "RIGHT" Case 40 Return "DOWN" Case 41 Return "SELECT" Case 42 Return "PRINT" Case 43 Return "EXECUTE" Case 44 Return "PRINT SCREEN" Case 45 Return "INS" Case 46 Return "DEL" Case 48 Return "0" Case 49 Return "1" Case 50 Return "2" Case 51 Return "3" Case 52 Return "4" Case 53 Return "5" Case 54 Return "6" Case 55 Return "7" Case 56 Return "8" Case 57 Return "9" Case 65 Return "A" Case 66 Return "B" Case 67 Return "C" Case 68 Return "D" Case 69 Return "E" Case 70 Return "F" Case 71 Return "G" Case 72 Return "H" Case 73 Return "I" Case 74 Return "J" Case 75 Return "K" Case 76 Return "L" Case 77 Return "M" Case 78 Return "N" Case 79 Return "O" Case 80 Return "P" Case 81 Return "Q" Case 82 Return "R" Case 83 Return "S" Case 84 Return "T" Case 85 Return "U" Case 86 Return "V" Case 87 Return "W" Case 88 Return "X" Case 89 Return "Y" Case 90 Return "Z" Case 91 Return "LWin" Case 92 Return "RWin" Case 96 Return "0'" Case 97 Return "1'" Case 98 Return "2'" Case 99 Return "3'" Case 100 Return "4'" Case 101 Return "5'" Case 102 Return "6'" Case 103 Return "7'" Case 104 Return "8'" Case 105 Return "9'" Case 106 Return "Multiply" Case 107 Return "Add" Case 108 Return "Separator" Case 109 Return "Subtract" Case 110 Return "Decimal" Case 111 Return "Divide" Case 112 Return "F1" Case 113 Return "F2" Case 114 Return "F3" Case 115 Return "F4" Case 116 Return "F5" Case 117 Return "F6" Case 118 Return "F7" Case 119 Return "F8" Case 120 Return "F9" Case 121 Return "F10" Case 122 Return "F11" Case 123 Return "F12" Case 124 Return "F13" Case 127 Return "F16" Case 144 Return "NUM LOCK" Case 145 Return "SCROLL LOCK" Case 160 Return "LSHIFT" Case 161 Return "RSHIFT" Case 162 Return "LCTRL" Case 163 Return "RCTRL" Case 164 Return "LMENU" Case 165 Return "RMENU" EndSwitch Return -1 EndFunc ;==>_GetKeyByHex_SwitchNumber ; #FUNCTION# =================================================================== ; Name : __GetKeyType ; Description: Returns Hexadecimal or Aplha key for specified key ; Parameter(s): HexKey ; Requirement(s): None ; Return Value(s): On Success - Returns Key ; On Failure - Returns -1 ; Author(s): Samoth, Valuater, FireFox ; Note(s): Thanks Valuater... 8) ;=============================================================================== Func _GetKeyByHex_SwitchNumber_Samoth($sHexKey) $sHexKey = Dec($sHexKey) Switch $sHexKey Case 1 To 37 Switch $sHexKey Case 1 Return "LeftMouse" Case 2 Return "RightMouse" Case 4 Return "MiddleMouse" Case 5 Return "X1Mouse" Case 6 Return "X2Mouse" Case 8 Return "BACKSPACE" Case 9 Return "TAB" Case 12 Return "CLEAR" Case 13 Return "ENTER" Case 16 Return "SHIFT" Case 17 Return "CTRL" Case 18 Return "ALT" Case 19 Return "PAUSE" Case 20 Return "CAPSLOCK" Case 27 Return "ESC" Case 32 Return "SPACEBAR" Case 33 Return "PAGE UP" Case 34 Return "PAGE DOWN" Case 35 Return "END" Case 36 Return "HOME" Case 37 Return "LEFT" EndSwitch Case 38 To 68 Switch $sHexKey Case 38 Return "UP" Case 39 Return "RIGHT" Case 40 Return "DOWN" Case 41 Return "SELECT" Case 42 Return "PRINT" Case 43 Return "EXECUTE" Case 44 Return "PRINT SCREEN" Case 45 Return "INS" Case 46 Return "DEL" Case 48 Return "0" Case 49 Return "1" Case 50 Return "2" Case 51 Return "3" Case 52 Return "4" Case 53 Return "5" Case 54 Return "6" Case 55 Return "7" Case 56 Return "8" Case 57 Return "9" Case 65 Return "A" Case 66 Return "B" Case 67 Return "C" Case 68 Return "D" EndSwitch Case 96 To 91 Switch $sHexKey Case 69 Return "E" Case 70 Return "F" Case 71 Return "G" Case 72 Return "H" Case 73 Return "I" Case 74 Return "J" Case 75 Return "K" Case 76 Return "L" Case 77 Return "M" Case 78 Return "N" Case 79 Return "O" Case 80 Return "P" Case 81 Return "Q" Case 82 Return "R" Case 83 Return "S" Case 84 Return "T" Case 85 Return "U" Case 86 Return "V" Case 87 Return "W" Case 88 Return "X" Case 89 Return "Y" Case 90 Return "Z" Case 91 Return "LWin" EndSwitch Case 92 To 115 Switch $sHexKey Case 92 Return "RWin" Case 96 Return "0'" Case 97 Return "1'" Case 98 Return "2'" Case 99 Return "3'" Case 100 Return "4'" Case 101 Return "5'" Case 102 Return "6'" Case 103 Return "7'" Case 104 Return "8'" Case 105 Return "9'" Case 106 Return "Multiply" Case 107 Return "Add" Case 108 Return "Separator" Case 109 Return "Subtract" Case 110 Return "Decimal" Case 111 Return "Divide" Case 112 Return "F1" Case 113 Return "F2" Case 114 Return "F3" Case 115 Return "F4" EndSwitch Case 116 To 165 Switch $sHexKey Case 116 Return "F5" Case 117 Return "F6" Case 118 Return "F7" Case 119 Return "F8" Case 120 Return "F9" Case 121 Return "F10" Case 122 Return "F11" Case 123 Return "F12" Case 124 Return "F13" Case 127 Return "F16" Case 144 Return "NUM LOCK" Case 145 Return "SCROLL LOCK" Case 160 Return "LSHIFT" Case 161 Return "RSHIFT" Case 162 Return "LCTRL" Case 163 Return "RCTRL" Case 164 Return "LMENU" Case 165 Return "RMENU" EndSwitch EndSwitch Return -1 EndFunc ;==>_GetKeyByHex_SwitchNumber_Samoth ; #FUNCTION# =================================================================== ; Name : __GetKeyByHex_ArrayBased_Samoth2 ; Description: Returns Hexadecimal or Aplha key for specified key ; Parameter(s): None ; Requirement(s): None ; Return Value(s): On Success - Returns Key ; On Failure - Returns -1 ; Author(s): Samoth ; Note(s): Thanks Valuater... 8) ;=============================================================================== Func __GetKeyByHex_ArrayBased_Samoth2($iKeyIn = 3) $iKeyIn = Dec($iKeyIn) - 1 If $iKeyIn >= 165 Then Return -1 If $a_Keys[$iKeyIn] <> "" Then Return $a_Keys[$iKeyIn] Return -1 EndFunc ;==>__GetKeyByHex_ArrayBased_Samoth2- 104 replies
-
- _ispressed
- key
-
(and 2 more)
Tagged with:
-
IsPressed_UDF ! v2.3 | Advanced keypress
Samoth replied to FireFox's topic in AutoIt Example Scripts
Hey, I just want to come back to your performance tuning of _GetKeyByHex_SwitchNumber... I optimized it to double speed (maybe a bit more possible). I just cut the test-Switch-Statements into smaller slices (Test-blocks) being tested seperately in smaller Switch-Statements. This can be done one or two steps of smaller slices further to get a few more millis out of it. It's based on the idea to walk recursively through graph trees. Feel free to go this step further into the deep ;-) Theoretically the most speed might be possible when comparing about 2 to 4 times in each nested Switch-block but I don't know AutoIts internal code optimization. This has to be given a try. #Region short test ConsoleWrite(@CRLF & "----------SHORT TEST----------") Global $numtest = 10000 _Test() #EndRegion short test Func _longtest() #Region long test ConsoleWrite(@CRLF & @CRLF & "----------LONG TEST----------") Global $numtest = 300000 _Test() #EndRegion long test EndFunc ;==>_longtest Func _Test() #Region Number ------------------------------ Local $random[$numtest] ConsoleWrite(@CRLF & "Generating random numbers...") For $i = 0 To $numtest - 1 $random[$i] = Random(1, Dec("A5"), 1) Next ConsoleWrite("Done !" & @CRLF) #EndRegion Number ------------------------------ #Region Test A ---------------------------------- ConsoleWrite("Doing test A...") $testBStart = TimerInit() For $i = 0 To $numtest - 1 _GetKeyByHex_SwitchNumber($random[$i]) Next $testBFinish = StringLeft(TimerDiff($testBStart) * 0.001, 7) ConsoleWrite("Done ! " & "Result : " & $testBFinish & " sec(s)" & @CRLF) #EndRegion Test A ---------------------------------- #Region Test B ---------------------------------- ConsoleWrite("Doing test B...") $testBStart = TimerInit() For $i = 0 To $numtest - 1 _GetKeyByHex_SwitchNumber_Samoth($random[$i]) Next $testBFinish = StringLeft(TimerDiff($testBStart) * 0.001, 7) ConsoleWrite("Done ! " & "Result : " & $testBFinish & " sec(s)" & @CRLF) #EndRegion Test B ---------------------------------- If $numtest = 300000 Then Exit Else _longtest() EndIf EndFunc ;==>_Test ; #FUNCTION# =================================================================== ; Name : __GetKeyType ; Description: Returns Hexadecimal or Aplha key for specified key ; Parameter(s): None ; Requirement(s): None ; Return Value(s): On Success - Returns Key ; On Failure - Returns 0 ; Author(s): Valuater, FireFox ; Note(s): Thanks Valuater... 8) ;=============================================================================== Func _GetKeyByHex_SwitchNumber($sHexKey) $sHexKey = Dec($sHexKey) Switch $sHexKey Case 1 Return "LeftMouse" Case 2 Return "RightMouse" Case 4 Return "MiddleMouse" Case 5 Return "X1Mouse" Case 6 Return "X2Mouse" Case 8 Return "BACKSPACE" Case 9 Return "TAB" Case 12 Return "CLEAR" Case 13 Return "ENTER" Case 16 Return "SHIFT" Case 17 Return "CTRL" Case 18 Return "ALT" Case 19 Return "PAUSE" Case 20 Return "CAPSLOCK" Case 27 Return "ESC" Case 32 Return "SPACEBAR" Case 33 Return "PAGE UP" Case 34 Return "PAGE DOWN" Case 35 Return "END" Case 36 Return "HOME" Case 37 Return "LEFT" Case 38 Return "UP" Case 39 Return "RIGHT" Case 40 Return "DOWN" Case 41 Return "SELECT" Case 42 Return "PRINT" Case 43 Return "EXECUTE" Case 44 Return "PRINT SCREEN" Case 45 Return "INS" Case 46 Return "DEL" Case 48 Return "0" Case 49 Return "1" Case 50 Return "2" Case 51 Return "3" Case 52 Return "4" Case 53 Return "5" Case 54 Return "6" Case 55 Return "7" Case 56 Return "8" Case 57 Return "9" Case 65 Return "A" Case 66 Return "B" Case 67 Return "C" Case 68 Return "D" Case 69 Return "E" Case 70 Return "F" Case 71 Return "G" Case 72 Return "H" Case 73 Return "I" Case 74 Return "J" Case 75 Return "K" Case 76 Return "L" Case 77 Return "M" Case 78 Return "N" Case 79 Return "O" Case 80 Return "P" Case 81 Return "Q" Case 82 Return "R" Case 83 Return "S" Case 84 Return "T" Case 85 Return "U" Case 86 Return "V" Case 87 Return "W" Case 88 Return "X" Case 89 Return "Y" Case 90 Return "Z" Case 91 Return "LWin" Case 92 Return "RWin" Case 96 Return "0'" Case 97 Return "1'" Case 98 Return "2'" Case 99 Return "3'" Case 100 Return "4'" Case 101 Return "5'" Case 102 Return "6'" Case 103 Return "7'" Case 104 Return "8'" Case 105 Return "9'" Case 106 Return "Multiply" Case 107 Return "Add" Case 108 Return "Separator" Case 109 Return "Subtract" Case 110 Return "Decimal" Case 111 Return "Divide" Case 112 Return "F1" Case 113 Return "F2" Case 114 Return "F3" Case 115 Return "F4" Case 116 Return "F5" Case 117 Return "F6" Case 118 Return "F7" Case 119 Return "F8" Case 120 Return "F9" Case 121 Return "F10" Case 122 Return "F11" Case 123 Return "F12" Case 124 Return "F13" Case 127 Return "F16" Case 144 Return "NUM LOCK" Case 145 Return "SCROLL LOCK" Case 160 Return "LSHIFT" Case 161 Return "RSHIFT" Case 162 Return "LCTRL" Case 163 Return "RCTRL" Case 164 Return "LMENU" Case 165 Return "RMENU" EndSwitch Return -1 EndFunc ;==>_GetKeyByHex_SwitchNumber ; #FUNCTION# =================================================================== ; Name : __GetKeyType ; Description: Returns Hexadecimal or Aplha key for specified key ; Parameter(s): HexKey ; Requirement(s): None ; Return Value(s): On Success - Returns Key ; On Failure - Returns 0 ; Author(s): Samoth, Valuater, FireFox ; Note(s): Thanks Valuater... 8) ;=============================================================================== Func _GetKeyByHex_SwitchNumber_Samoth($sHexKey) $sHexKey = Dec($sHexKey) Switch $sHexKey Case 1 To 37 Switch $sHexKey Case 1 Return "LeftMouse" Case 2 Return "RightMouse" Case 4 Return "MiddleMouse" Case 5 Return "X1Mouse" Case 6 Return "X2Mouse" Case 8 Return "BACKSPACE" Case 9 Return "TAB" Case 12 Return "CLEAR" Case 13 Return "ENTER" Case 16 Return "SHIFT" Case 17 Return "CTRL" Case 18 Return "ALT" Case 19 Return "PAUSE" Case 20 Return "CAPSLOCK" Case 27 Return "ESC" Case 32 Return "SPACEBAR" Case 33 Return "PAGE UP" Case 34 Return "PAGE DOWN" Case 35 Return "END" Case 36 Return "HOME" Case 37 Return "LEFT" EndSwitch Case 38 To 68 Switch $sHexKey Case 38 Return "UP" Case 39 Return "RIGHT" Case 40 Return "DOWN" Case 41 Return "SELECT" Case 42 Return "PRINT" Case 43 Return "EXECUTE" Case 44 Return "PRINT SCREEN" Case 45 Return "INS" Case 46 Return "DEL" Case 48 Return "0" Case 49 Return "1" Case 50 Return "2" Case 51 Return "3" Case 52 Return "4" Case 53 Return "5" Case 54 Return "6" Case 55 Return "7" Case 56 Return "8" Case 57 Return "9" Case 65 Return "A" Case 66 Return "B" Case 67 Return "C" Case 68 Return "D" EndSwitch Case 96 To 91 Switch $sHexKey Case 69 Return "E" Case 70 Return "F" Case 71 Return "G" Case 72 Return "H" Case 73 Return "I" Case 74 Return "J" Case 75 Return "K" Case 76 Return "L" Case 77 Return "M" Case 78 Return "N" Case 79 Return "O" Case 80 Return "P" Case 81 Return "Q" Case 82 Return "R" Case 83 Return "S" Case 84 Return "T" Case 85 Return "U" Case 86 Return "V" Case 87 Return "W" Case 88 Return "X" Case 89 Return "Y" Case 90 Return "Z" Case 91 Return "LWin" EndSwitch Case 92 To 115 Switch $sHexKey Case 92 Return "RWin" Case 96 Return "0'" Case 97 Return "1'" Case 98 Return "2'" Case 99 Return "3'" Case 100 Return "4'" Case 101 Return "5'" Case 102 Return "6'" Case 103 Return "7'" Case 104 Return "8'" Case 105 Return "9'" Case 106 Return "Multiply" Case 107 Return "Add" Case 108 Return "Separator" Case 109 Return "Subtract" Case 110 Return "Decimal" Case 111 Return "Divide" Case 112 Return "F1" Case 113 Return "F2" Case 114 Return "F3" Case 115 Return "F4" EndSwitch Case 116 To 165 Switch $sHexKey Case 116 Return "F5" Case 117 Return "F6" Case 118 Return "F7" Case 119 Return "F8" Case 120 Return "F9" Case 121 Return "F10" Case 122 Return "F11" Case 123 Return "F12" Case 124 Return "F13" Case 127 Return "F16" Case 144 Return "NUM LOCK" Case 145 Return "SCROLL LOCK" Case 160 Return "LSHIFT" Case 161 Return "RSHIFT" Case 162 Return "LCTRL" Case 163 Return "RCTRL" Case 164 Return "LMENU" Case 165 Return "RMENU" EndSwitch EndSwitch Return -1 EndFunc ;==>_GetKeyByHex_SwitchNumber- 104 replies
-
- _ispressed
- key
-
(and 2 more)
Tagged with:
-
Strangely I didn't have this behaviour until today. I wrote a script that attached to my browser and worked fine just the last few weeks. Today it went nuts so I came along this thread and another one as well. I posted my solution over Might this "patch" probably make it's way into a next release of AutoIt? This funny error only seems to occur on open IE windows not being a TopLevelContainer. I just check out for this.
-
You can modify your IE.au3 to check whether your IE object is a TopLevelContainer and respond accordingly in Func _IEPropertyGet(ByRef $o_object, $s_property) from line 2669 on: Case $s_property = "hwnd" If Not __IEIsObjType($o_object, "browser") Then __IEErrorNotify("Error", "_IEPropertyGet", "$_IEStatus_InvalidObjectType") Return SetError($_IEStatus_InvalidObjectType, 1, 0) EndIf ;Return SetError($_IEStatus_Success, 0, HWnd($o_object.HWnd())) ;-------------- If $o_object.TopLevelContainer Then Return SetError($_IEStatus_Success, 0, HWnd($o_object.HWnd())) Else Return SetError($_IEStatus_Success, 0, 0) EndIf ;--------------