Zamp Posted November 3, 2006 Posted November 3, 2006 I am trying to make a program so whenever I press a button it does something, but it never works because right away it closes. How can you make it so it stays open until you right click the icon next to the clock and click close? And can you make it so if you press a button it like toggles a flag? So if you press, lets say 0, it turns the flag on, and if you press 0 again it turns it off. And then if the flag is on, have it do something, and stop doing it when the flag is off. I hope that makes sense and someone can help me!
AzKay Posted November 3, 2006 Posted November 3, 2006 No ones going to help you unless you try it first and post your code. # MY LOVE FOR YOU... IS LIKE A TRUCK- #
AutoChris Posted November 3, 2006 Posted November 3, 2006 (edited) I am trying to make a program so whenever I press a button it does something, but it never works because right away it closes. How can you make it so it stays open until you right click the icon next to the clock and click close? And can you make it so if you press a button it like toggles a flag? So if you press, lets say 0, it turns the flag on, and if you press 0 again it turns it off. And then if the flag is on, have it do something, and stop doing it when the flag is off. I hope that makes sense and someone can help me!The first one is easy. Put in a While...WEnd loop. While 1 Sleep(100) WEnd As for the second question, I don't feel like writing up any code showing you how to create a GUI, and then reading the result when a button is pressed, so I will leave that one to someone else with more patience. Edited November 3, 2006 by SerialKiller
Zamp Posted November 4, 2006 Author Posted November 4, 2006 While 1 = 1;make it always stay open sleep(100) WEnd $aa = 0 #include <Misc.au3> $dll = DllOpen("user32.dll") If _IsPressed("61", $dll) Then $aa + 1 EndIf DllClose($dll) If $aa = 1 then MsgBox(0, "iiiiii", "kkkk") EndIf I tried that and it didn't work. When I pressed 0 nothing happened. I have another question though. Can you have two If statements in a row? So have it be like If _Ispressed("61", $dll) and $aa = 0 Then... Could you do something like that? And would having $aa + 1 make it so it would only add 1 once?
Developers Jos Posted November 4, 2006 Developers Posted November 4, 2006 While 1 = 1;make it always stay open sleep(100) WEnd $aa = 0 #include <Misc.au3> $dll = DllOpen("user32.dll") If _IsPressed("61", $dll) Then $aa + 1 EndIf DllClose($dll) If $aa = 1 then MsgBox(0, "iiiiii", "kkkk") EndIf I tried that and it didn't work. When I pressed 0 nothing happened. I have another question though. Can you have two If statements in a row? So have it be like If _Ispressed("61", $dll) and $aa = 0 Then... Could you do something like that? And would having $aa + 1 make it so it would only add 1 once? Question: When will it get past the Wend statement ? Suggestion: Maybe follow some basic programming course first ? SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past.Â
Zamp Posted November 4, 2006 Author Posted November 4, 2006 Question: When will it get past the Wend statement ?Suggestion: Maybe follow some basic programming course first ? I don't know. >_> I just copied what SerialKiller said.Where could I find a programming course for autoit? I tried looking for one before but couldn't find it. I thought I would just try to go on without one since I thought what I was trying to do would be easy...
Paulie Posted November 4, 2006 Posted November 4, 2006 Where could I find a programming course for autoit?heres a GREAT tutorial...http://www.autoitscript.com/forum/index.php?showtopic=21048
Zamp Posted November 4, 2006 Author Posted November 4, 2006 Thanks that helped a lot! I have a question though. Would this script make it send shift over and over again? Global $aa HotKeySet("{F9}", "aa") While 1 Sleep(100) WEnd Func aa() $aa = Not $aa While $aa Send("+") ToolTip("") WEnd ToolTip("") EndFunc I tried making it send "a", and it worked, but then I tried shift and started typing when the function was running, but it was all lower case. Is that because it just doesn't work when you're typing, and it will work when I want it to just keep pressing shift nonstop? I don't know if that made sense or not. >_> Basically I want it to just keep pressing shift until I stop the function. Will that script do that?
Paulie Posted November 4, 2006 Posted November 4, 2006 (edited) Glad to see you learned something from that tutorial that code was very close to what you would need to accomplish what you want, but have you ever heard of the caps-lock key? Global $aa HotKeySet("{F9}", "aa") While 1 Sleep(100) WEnd Func aa() $aa = Not $aa If $aa then Send("{ShiftDOWN}");follow any key with 'Down' and it will hold it until 'Up' is called While $aa Sleep(500) ToolTip("In Loop",0,0) WEnd ToolTip("") Send("{ShiftUP}") EndFunc Edited November 4, 2006 by Paulie
theguy0000 Posted November 4, 2006 Posted November 4, 2006 (edited) Global $on=False HotKeySet ("{F9}", "toggleShift") While 1 Sleep (100) WEnd Func toggleShift ( ) $on = Not $on If $on Then Send ("{SHIFT DOWN}") Else Send ("{SHIFT UP}") EndIf EndFunc not tested but I think it should work... edit: gah paulie beat me to it Edited November 4, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
Zamp Posted November 4, 2006 Author Posted November 4, 2006 Caps Lock would work because I'm trying to make an auto attacker thing for a game I play, and you use shift to attack, so I want it to keep pressing shift. >_> And if I use ShiftDOWN then will it keep pressing shift? Because in the game, if you hold shift then press another button it will stop you from attacking. So it needs to press shift again after it presses the other button. So will shiftdown do that?
Paulie Posted November 4, 2006 Posted November 4, 2006 Caps Lock would work because I'm trying to make an auto attacker thing for a game I play, and you use shift to attack, so I want it to keep pressing shift. >_> And if I use ShiftDOWN then will it keep pressing shift? Because in the game, if you hold shift then press another button it will stop you from attacking. So it needs to press shift again after it presses the other button. So will shiftdown do that?No, ShiftDown holds the shift key, which isn't what you want, so use this. Global $aa HotKeySet("{F9}", "aa") While 1 Sleep(100) WEnd Func aa() $aa = Not $aa While $aa Send("{LShift}");The modifier keys that have a left and a right must be specified with a letter ToolTip("In Loop",0,0) WEnd ToolTip("") EndFunc
Zamp Posted November 4, 2006 Author Posted November 4, 2006 I tried using LShift then holding down "a" to see if it would make it all caps, and it made some of them caps and some letters were lower case. So I went to try it in my game, but nothing works I changed shift to z, just so I could try it in notepad and see if it would keep pressing it, and it worked. Is there anyway to make AutoIt work with my game?
emmanuel Posted February 1, 2007 Posted February 1, 2007 I was looking for something else, one idea that might help is putting some delay between the presses, make it something like a humanly possible speed. Another idea would be to shift down, sleep 20 shift up sleep 100 something like that. "I'm not even supposed to be here today!" -Dante (Hicks)
emmanuel Posted February 1, 2007 Posted February 1, 2007 ughWhat's up Larry? You ever finish that house up and sell it? "I'm not even supposed to be here today!" -Dante (Hicks)
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