d4rk Posted June 15, 2008 Share Posted June 15, 2008 hello every1, i have a problem like this .... As you can see, if you press "d" so the $Count=$Count+1 and write to the console, but the problem that : It in a loop (While) , so it will count to a great great number with just a 'd' pressed ... and i can't give any more idea how to keep coding with it ... but if i strip it out the loop, so it exit after running for a few seconds ... It would be great to receive some help ! Thanks $String="duy" $Array=StringSplit($String,"") ;_ArrayDisplay($Array,"") $Count=0 while 1 _Start() WEnd Func _Start() Select Case _IsPressed(_StringToHex(StringUpper(StringLeft($String,1)))) $Count=$Count+1 ConsoleWrite($Count) EndSelect EndFunc [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 15, 2008 Share Posted June 15, 2008 After to catch that it is pressed, wait for it to be released. Keep a value waiting and if the value is true, wait for the key to be released before checking to see if it's pressed again. This also belongs in support, not chat. Link to comment Share on other sites More sharing options...
d4rk Posted June 15, 2008 Author Share Posted June 15, 2008 OMG :P, i'm even didn't know , i'm using View New Posts but i think i'm in General and support forum ,i'm sorry... and about your post, can you tell me a little more ? [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
herewasplato Posted June 15, 2008 Share Posted June 15, 2008 (edited) I doubt that your God cares which forum you posted to. Try this code:#include <misc.au3> #include <string.au3> $String = "duy" $Array = StringSplit($String, "") ;_ArrayDisplay($Array,"") $Count = 0 While 1 _Start() WEnd Func _Start() Select Case _IsPressed(_StringToHex(StringUpper(StringLeft($String, 1)))) $Count = $Count + 1 ConsoleWrite($Count) Do Sleep(100) Until Not _IsPressed(_StringToHex(StringUpper(StringLeft($String, 1)))) EndSelect EndFunc ;==>_Start Edited June 15, 2008 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 15, 2008 Share Posted June 15, 2008 (edited) Try this.$Count=0 While 1 If _IsPressed(_StringToHex("D")) Then $Count = $Count + 1 While _IsPressed(_StringToHex("D")) Sleep(10) WEnd EndIf WEndEdit: Bah, plato was here first. Edited June 15, 2008 by Richard Robertson Link to comment Share on other sites More sharing options...
d4rk Posted June 15, 2008 Author Share Posted June 15, 2008 Thanks you both [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
martin Posted June 19, 2008 Share Posted June 19, 2008 I doubt that your God cares which forum you posted to. Try this code:#include <misc.au3> #include <string.au3> $String = "duy" $Array = StringSplit($String, "") ;_ArrayDisplay($Array,"") $Count = 0 While 1 _Start() WEnd Func _Start() Select Case _IsPressed(_StringToHex(StringUpper(StringLeft($String, 1)))) $Count = $Count + 1 ConsoleWrite($Count) Do Sleep(100) Until Not _IsPressed(_StringToHex(StringUpper(StringLeft($String, 1)))) EndSelect EndFunc ;==>_Starthjgjgh expandcollapse popup HotKeySet("","addcode") HotKeySet("","alldone") while 1 Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options... Richard Robertson Posted June 19, 2008 Richard Robertson Active Members 10.2k 3 Share Posted June 19, 2008 hjgjgh HotKeySet("","addcode") HotKeySet("","alldone") while 1 Martin, what was that? Link to comment Share on other sites More sharing options...
Recommended Posts