Delta01 Posted March 15, 2008 Share Posted March 15, 2008 (edited) Hi, I'm trying to make a script that detects when / is pressed, I've searched in the help file to find the hex code for the / but I've had no luck. In the help file is says: / 47 2f Slant (forward slash, divide) So, this is my code which isn't working. How would I get it do detect detect when the / key is pressed? #Include <Misc.au3> $dll = DllOpen("user32.dll") While 1 If _IsPressed("2f", $dll) Then msgbox(64,"Slash pressed", "Detected!") WEnd DllClose($dll) I've tried using "2f" and "47" Help would be appreciated Edit: I'm trying to detect the one near shift, not the divide key near the numpad Edited March 15, 2008 by Delta01 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 15, 2008 Moderators Share Posted March 15, 2008 _IsPressed(0x2f, $dll) or _IsPressed(47, $dll) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Delta01 Posted March 15, 2008 Author Share Posted March 15, 2008 _IsPressed(0x2f, $dll)or_IsPressed(47, $dll)Nope, still doesn't work Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 15, 2008 Moderators Share Posted March 15, 2008 (edited) 47 is the letter G not slash So it works fine. Edited March 15, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Delta01 Posted March 15, 2008 Author Share Posted March 15, 2008 (edited) 47 is the letter G not slash So it works fine. No, I went into the autoit help file and this is what it said. (First column is: Char, Second: dec and third: hex) / 47 2f Description: Slant (forward slash, divide) And when I try to use that in a script, it won't detect it. Edit: 6f works, but only for the numpad divide. Edit: What I'm trying to do is recognize a string, which is /display - The below code is working great, works with the numpad / but not the question mark one. expandcollapse popup#Include <Misc.au3> #Include <Date.au3> Global $Slash, $D, $i, $S, $P, $L, $A, $Y, $bRunTimer = 2, $Hour, $Mins, $Secs, $booLtype $dll = DllOpen("user32.dll") While 1 If _IsPressed("6f", $dll) Then $Slash = "Ok" _Timer("/") EndIf If _IsPressed("44", $dll) AND $Slash = "Ok" Then $D = "Ok" $Slash = 1 _Timer("D") EndIf If _IsPressed("49", $dll) AND $D = "Ok" Then $Slash = 1 $D = 1 $i = "Ok" _Timer("i") EndIf If _IsPressed("53", $dll) AND $i = "Ok" Then $Slash = 1 $D = 1 $i = 1 $S = "Ok" _Timer("p") EndIf If _IsPressed("50", $dll) AND $S = "Ok" Then $Slash = 1 $D = 1 $i = 1 $P = "Ok" $S = 1 _Timer("S") EndIf If _IsPressed("4c", $dll) AND $P = "Ok" Then $Slash = 1 $D = 1 $i = 1 $P = 1 $L = "Ok" _Timer("L") EndIf If _IsPressed("41", $dll) AND $L = "Ok" Then $Slash = 1 $D = 1 $i = 1 $P = 1 $L = 1 $A = "Ok" _Timer("A") EndIf If _IsPressed("59", $dll) AND $A = "Ok" Then $Slash = 1 $D = 1 $i = 1 $P = 1 $L = 1 $A = 1 $Y = "Ok" ToolTip("Success!", 0, 0) sleep(2000) ToolTip("", 0, 0) _Timer("Y") EndIf If $bRunTimer = 1 Then PollTimer() WEnd DllClose($dll) Func _Timer($booLtype01) Global $Timer = TimerInit() Global $bRunTimer = 1 Global $booLtype = $booLtype01 EndFunc Func PollTimer() Global $iTimeToGo = 8000 - Int(TimerDiff($timer)) If $iTimeToGo <= 0 Then If $booLtype = "/" Then $Slash = "No" If $booLtype = "D" Then $D = "No" If $booLtype = "i" Then $i = "No" If $booLtype = "s" Then $s = "No" If $booLtype = "p" Then $p = "No" If $booLtype = "l" Then $l = "No" If $booLtype = "a" Then $a = "No" If $booLtype = "y" Then $y = "No" EndIf EndFunc Edited March 15, 2008 by Delta01 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 15, 2008 Moderators Share Posted March 15, 2008 No, I went into the autoit help file and this is what it said. (First column is: Char, Second: dec and third: hex) / 47 2f Description: Slant (forward slash, divide) And when I try to use that in a script, it won't detect it. Edit: 6f works, but only for the numpad divide. Edit: What I'm trying to do is recognize a string, which is /display - The below code is working great, works with the numpad / but not the question mark one.What do you man "no". You're wrong.#include <Misc.au3> $dll = DllOpen("user32.dll") While 1 If _IsPressed("BF", $dll) Then MsgBox(64, "Slash pressed", "Detected!") ExitLoop EndIf Sleep(100) WEnd DllClose($dll) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Delta01 Posted March 15, 2008 Author Share Posted March 15, 2008 What do you man "no". You're wrong.#include <Misc.au3> $dll = DllOpen("user32.dll") While 1 If _IsPressed("BF", $dll) Then MsgBox(64, "Slash pressed", "Detected!") ExitLoop EndIf Sleep(100) WEnd DllClose($dll) Ahh, that's it. Thanks a ton. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 15, 2008 Share Posted March 15, 2008 No, I went into the autoit help file and this is what it said. (First column is: Char, Second: dec and third: hex)/ 47 2f Description: Slant (forward slash, divide) And when I try to use that in a script, it won't detect it.The point you are missing is that keyboard scan codes (used in _IsPressed) are not the same as ASCII codes, which you quoted from the help file. The help file for 3.2.10.0 accidentally omitted the scan code chart from the page on _IsPressed, but if you look at the help files for the 3.2.11.x Betas, you will see the chart there again. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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