Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 16:18

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



_IsPressed() Help with keys

Discussion on _IsPressed() Help with keys within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Question _IsPressed() Help with keys

I have this piece of code, so when i press CTRL is start to write in console but i cant stop it when i press CTRL again, i tried to change key for stop but dont works too it loop all time.

And can _IsPressed() keys can be custom made like CTRL a, CTRL v, CTRL s, CTRL v ?

Is they be counted like this 11 CTRL key + 41 A key = 52 (ctrl a) ? But i see in help file 52 R key

Code:
#include <Misc.au3>

Global $hDLL = DllOpen("user32.dll")

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

	EndSwitch

		If _IsPressed(11, $hDLL) Then
			Do
				ConsoleWrite("test" & @CRLF)
				Sleep(800)
			Until _IsPressed(11, $hDLL)
		EndIf

WEnd

DllClose($hDLL)
mlukac89 is offline  
Old 03/07/2014, 15:06   #2
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
It will loop over and over again because you have some logic issues in there.
If _IsPressed(11, $hDLL) Then <-- here you jump into the if if your CTRL key is pressed.
So far so good but you only go out of the Do Until loop if you hit the CTRL key again.
The logic is pretty ok but the mistake you made is that these statements don't take a split of a ms to parse. You need to make a trigger for that I think. And to these combined codes you can use multiple If Statements.
Code:
If _IsPressed(11, $hDLL) and _IsPressed(1, $hDLL) Then
CTRL + LMOUSE
alpines is offline  
Old 03/07/2014, 18:05   #3
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Can't find good solution but this code need to be here i dont want to make func for it.

This example from help file is good but it works only while you hold key, but i need when i press key to run code untill i press it again. I can do it with new function and HotkeySet but then more code :P
mlukac89 is offline  
Reply


Similar Threads Similar Threads
_IsPressed > Problem
03/05/2014 - AutoIt - 4 Replies
Eigentlich tut er schon was er machen soll, nur habe ich das Problem wenn ich die Taste 1 gedrückt halte und gleichzeitig "WASD" benütze bricht es ab. Erst bei erneutem Tastendruck funktioniert es wieder. Aber halt nicht kombiniert :/ Hat wer einen Tipp oder ne alternative ?
_IsPressed für PS3 Controller
01/13/2013 - AutoIt - 3 Replies
Hallo E*PvPler, ich habe nach einem Programm gesucht damit ich mit meinem PS3 Controller auf meinem PC spielen kann. Leider hat das eine nicht bei mir funktioniert :/ und sonst habe ich kein andees gefunden. Desshalb habe ich beschlossen selbst eines zu schreiben. Man könnte es doch mit der _IsPressed Funktion machen, nur leider weiß ich den Code nicht (z.B. für Dreieck, Kreis,L1, L2, ... etc). Gibt es eine Funktion mir der ich diesen Code auslesen kann? Oder hab jemand eine andere Lösung? ...
_ispressed Umlaute
11/24/2009 - AutoIt - 3 Replies
hai ist es möglich mit _isPressed() umlaute ab zu fragen??? hab auf der liste in der Hilfe datei keine gefunden -.- thx für die auskunft
_IsPressed
04/18/2009 - General Coding - 10 Replies
Hallo Leute, Ich habe jetzt irgend eine Taste mit _IsPressed belegt z.B. die Taste "B". Wenn ich nun auf "B" drücke, glaubt _IsPressed, dass ich die Taste "B" mehrmals als einmal gedrückt habe. Ich glaube, dass das daran liegt, dass _IsPressed sich zu schnell "aktualisiert". Kann man da irgendwie was drehen, also, dass wenn man jetzt "B" drückt, dass dann _IsPressed sagt, dass "B" nur einmal gedrückt worden ist? Danke LG Manlius



All times are GMT +2. The time now is 16:18.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.