xKylex Posted July 28, 2007 Posted July 28, 2007 Ok, so I'm trying to set it up so it continually presses a button until I press a certain key. For example, let's say I wanted it to press F1 until I press Esc to cancel it. I have no clue whatsoever as to how to go about this. Please help. I'd like an answer in a script please. Thanks in advance.
dbzfanatic Posted July 29, 2007 Posted July 29, 2007 you would need to do something like this HotkeySet("{Esc}", "Quit") Func Quit() $oStop=1 EndFunc Do Send("{F1}") Until $oStop = 1 at least if i'm understanding your question correctly Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
ssubirias3 Posted July 29, 2007 Posted July 29, 2007 Ok, so I'm trying to set it up so it continually presses a button until I press a certain key. For example, let's say I wanted it to press F1 until I press Esc to cancel it. I have no clue whatsoever as to how to go about this. Please help. I'd like an answer in a script please. Thanks in advance. Another harmless example. It really does help to search the help file and the forums. #NoTrayIcon HotKeySet("{ESC}", "ExitOut") HotKeySet("{F1}", "Msg2DWise") HotKeySet("^!{ESC}", "ThatRight") MsgBox(0+64+262144,"Trifling... Completely Trifling", "Press F1 to demo and the ESC keys to quit. ") While 1 Sleep(100) WEnd Func Msg2DWise() MsgBox(0+64+262144,"Trifling... Completely Trifling", "Have you searched the help file for your answer? ") MsgBox(0+64+262144,"Trifling... Still Trifling", "Have you even searched the forums before " & @CR & "posting this question? ") While 1 Send("{F1}") Sleep(100) WEnd EndFunc Func ThatRight() Exit 0 EndFunc Func ExitOut() Msgbox(0+16+262144,"Trifling... No Doubt!", "Wanna Exit???" & @CR&@CR & "Press the ESC keys silly!") EndFunc
xKylex Posted July 29, 2007 Author Posted July 29, 2007 Another harmless example. It really does help to search the help file and the forums. #NoTrayIcon HotKeySet("{ESC}", "ExitOut") HotKeySet("{F1}", "Msg2DWise") HotKeySet("^!{ESC}", "ThatRight") MsgBox(0+64+262144,"Trifling... Completely Trifling", "Press F1 to demo and the ESC keys to quit. ") While 1 Sleep(100) WEnd Func Msg2DWise() MsgBox(0+64+262144,"Trifling... Completely Trifling", "Have you searched the help file for your answer? ") MsgBox(0+64+262144,"Trifling... Still Trifling", "Have you even searched the forums before " & @CR & "posting this question? ") While 1 Send("{F1}") Sleep(100) WEnd EndFunc Func ThatRight() Exit 0 EndFunc Func ExitOut() Msgbox(0+16+262144,"Trifling... No Doubt!", "Wanna Exit???" & @CR&@CR & "Press the ESC keys silly!") EndFuncdam u. I actually ran that. I knew it seemed odd..
ssubirias3 Posted July 29, 2007 Posted July 29, 2007 dam u. I actually ran that. I knew it seemed odd..LOL... oh now you can't be too upset with me, can you?? After all if you read and study the code you'll learn more than you asked. Isn't that what education should be; fun and rememberalbe? No harm intended, hopefully you can look back on this and chuckle!If there's something in the code you don't understand, look up that command in the help file or ask us here. Have a good one xKylex.--ss3...
BrettF Posted July 29, 2007 Posted July 29, 2007 Another harmless example. It really does help to search the help file and the forums. #NoTrayIcon HotKeySet("{ESC}", "ExitOut") HotKeySet("{F1}", "Msg2DWise") HotKeySet("^!{ESC}", "ThatRight") MsgBox(0+64+262144,"Trifling... Completely Trifling", "Press F1 to demo and the ESC keys to quit. ") While 1 Sleep(100) WEnd Func Msg2DWise() MsgBox(0+64+262144,"Trifling... Completely Trifling", "Have you searched the help file for your answer? ") MsgBox(0+64+262144,"Trifling... Still Trifling", "Have you even searched the forums before " & @CR & "posting this question? ") While 1 Send("{F1}") Sleep(100) WEnd EndFunc Func ThatRight() Exit 0 EndFunc Func ExitOut() Msgbox(0+16+262144,"Trifling... No Doubt!", "Wanna Exit???" & @CR&@CR & "Press the ESC keys silly!") EndFuncYou really shouldn't post code like that to noobs like good ol' kyle. It isn't polite. He new to the forum. You could have told him, the correct way to go about things. The right procedure. Did you? No. Whats funny is, you spent more time on that code, then a simple answer. The way you advertised it too. "another harmless example" Harmless?? In a way, it doesn't kill your computer, but it does create so many msgboxs, its just plain annoying! Why bother post, if it wont help to op??? Really??? He may be quite a quite person, like one of my best friends (also called Kyle). He is the type of person, who you can torment, and torment, and he will bottle up their anger. Until you push it too far, Its just the way he works. I'd watch yourself and your smart replies ssubirias3. Really. Help the other person like they have a right to be helped, or as far as I'm concerned, keep it in chat, or get out... I don't want you gone ssubirias3, but really, if you can't keep it sensible, i sure as hell don't want you on these forums. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
xKylex Posted July 29, 2007 Author Posted July 29, 2007 Bert, thank you. But yeah, I can look back and chuckle, in fact I am. But it didn't actually help me solve my problem, I still don't know how to do it. I've looked through the help section thing, couldn't find it though. I just need a code that basically means 'Repeat previous/following code until X button is pressed' then I think I can get the rest. Thanks in advance again, and Thank you ssubirias, I'ma edit the code you gave me a bit then send it to my friends .
BrettF Posted July 29, 2007 Posted July 29, 2007 Bert, thank you. But yeah, I can look back and chuckle, in fact I am. But it didn't actually help me solve my problem, I still don't know how to do it. I've looked through the help section thing, couldn't find it though. I just need a code that basically means 'Repeat previous/following code until X button is pressed' then I think I can get the rest. Thanks in advance again, and Thank you ssubirias, I'ma edit the code you gave me a bit then send it to my friends .Well duh! Knew I forgot something... I'm getting senile you see, and the worst bit is I'm only 15 There are a few ways you could go about this. There's this way: #include <Misc.au3> While 1 ConsoleWrite ("> While Loop running. Press Esc to Exit" & @CRLF) ; Some sort of code goes here... I just put a console write. If _IsPressed ("1B") Then ExitLoop EndIf WEnd ConsoleWrite ("> Loop Ended" & @CRLF) or this way #include <Misc.au3> While Not _IsPressed ("1B") ConsoleWrite ("> While Loop running. Press Esc to Exit" & @CRLF) ; Some sort of code goes here... I just put a console write. WEnd ConsoleWrite ("> Loop Ended" & @CRLF) or... #include <Misc.au3> Do ConsoleWrite ("> While Loop running. Press Esc to Exit" & @CRLF) ; Some sort of code goes here... I just put a console write. Until _IsPressed ("1B") ConsoleWrite ("> Loop Ended" & @CRLF) And finally, HotKeySet ("{Esc}", "ExitFunc") While 1 ConsoleWrite ("> While Loop running. Press Esc to Exit" & @CRLF) WEnd Func ExitFunc () ConsoleWrite ("> Loop Ended" & @CRLF) Exit EndFunc That should get you well on your way Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
xKylex Posted July 29, 2007 Author Posted July 29, 2007 Ok, I'm a bigger noob than I thought. Um...Thanks bert I suppose, but how do I set it up so it constantly presses F2 until I press ESC? BTW, I'm using the last code you posted. I'm a big noob, I need the exact code so I can copy and paste into an AutoIt script basically Thanks.
xKylex Posted July 29, 2007 Author Posted July 29, 2007 (edited) Imma see if you can figure this one out.Open the script editor.Press Ctrl+FWhen the "Find" Dialog appears, type "F1" into the box and make sure "Whole word only" is unchecked.When it highlights the "F1", change it to "F2"Give it a try.If it doesn't work, try again, and find the next instance of "F1"Trust me, you can handle this one.I'm not that dumb, I coulda done that. That script doesn't even have F1 in it though.I'm thinking I might need the Do...Until action. Is there anyway to take an .exe and convert it back into an editable AutoIt file? Edited July 29, 2007 by xKylex
Paulie Posted July 29, 2007 Posted July 29, 2007 (edited) I'm not that dumb, I coulda done that. That script doesn't even have F1 in it though.lol I didn't read all the way. You called me out. :"> I didn't realize bert used consolewrite. Just change this ConsoleWrite ("> While Loop running. Press Esc to Exit" & @CRLF) to this Send ("{F2}") and @bert I understand and totally respect you standing up teh noobs, however, there is one part of your statement that i can not agree with Really. Help the other person like they have a right to be helped, or as far as I'm concerned, keep it in chat, or get out...my problem is that support here is a privilege, not a right. And had Kyle been a real ass(which he wasn't), he would not have earned his privilege to be helped. I agree that ssubirias3 was a little excessively poignant to someone who obviously has little to no scripting experience, there are much nicer and more appropriate ways of suggesting to check the helpfile, however, support is voluntary, and no one has the "right" to support. Edited July 29, 2007 by Paulie
xKylex Posted July 29, 2007 Author Posted July 29, 2007 (edited) lol I didn't read all the way. You called me out. :"> I didn't realize bert used consolewrite. Just change this ConsoleWrite ("> While Loop running. Press Esc to Exit" & @CRLF) to this Send ("{F2}") Wow, that's all I needed to do..? Lol, okay, well while I waited for a reply, I was kinda making my own code for it, and I came out with this: HotKeySet ("{Esc}", "ExitFunc") While 1 Do Send ("{w}") Until Send ( "{ESC}") WEnd Func ExitFunc () Exit EndFunc (I used 'w' because it would have noticeable and harmless results.) But all it does is open then close, any suggestions? BTW, thanks Happy Feet penguin guy (Sorry can't remember username ) Edited July 29, 2007 by xKylex
Paulie Posted July 29, 2007 Posted July 29, 2007 Wow, that's all I needed to do..? Lol, okay, well while I waited for a reply, I was kinda making my own code for it, and I came out with this: HotKeySet ("{Esc}", "ExitFunc") While 1 Do Send ("{w}") Until Send ( "{ESC}") WEnd Func ExitFunc () Exit EndFunc (I used 'w' because it would have noticeable and harmless results.) But all it does is open then close, any suggestions? BTW, thanks Happy Feet penguin guy (Sorry can't remember username )heh no problem, I'm sorry i didn't read. That was a 2:40 AM moment for me
xKylex Posted July 29, 2007 Author Posted July 29, 2007 (edited) So anyway, now I got it working (Thanks to the peeps that helped); You guys must be like, pretty intense scripter people. What kinda things can you guys make with AutoIt? Can you make viruses and stuff (Just wonder, I don't plan on it... ). With the GUI commands and stuff, could you actually create a full online game? That would be sweet, and if you could, I'd like to talk to you a bit more.. Edited July 29, 2007 by xKylex
BrettF Posted July 29, 2007 Posted July 29, 2007 @bert I understand and totally respect you standing up teh noobs, however, there is one part of your statement that i can not agree withmy problem is that support here is a privilege, not a right. And had Kyle been a real ass(which he wasn't), he would not have earned his privilege to be helped. I agree that ssubirias3 was a little excessively poignant to someone who obviously has little to no scripting experience, there are much nicer and more appropriate ways of suggesting to check the helpfile, however, support is voluntary, and no one has the "right" to support.I agree 100% with you. It is a privilege, one that needs to be earned. I was getting at the right that Kyle had to be helped in a friendly manner. Not like ssubirias3 did. There is a way to give support to someone, and that was not it . Thanks Paul. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
BrettF Posted July 29, 2007 Posted July 29, 2007 So anyway, now I got it working (Thanks to the peeps that helped); You guys must be like, pretty intense scripter people. What kinda things can you guys make with AutoIt? Can you make viruses and stuff (Just wonder, I don't plan on it... ) With the GUI commands and stuff, could you actually create a full online game? That would be sweet, and if you could, I'd like to talk to you a bit more.. Of course you can create viruses. You can with any language. And people have made malicious programs, and people like them give AutoIt a bad name. I have often thought of it. If you feel like you're up to a challenge, I will be happy to help you. I need something to do... Chat has its highs and lows... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Paulie Posted July 29, 2007 Posted July 29, 2007 (edited) So anyway, now I got it working (Thanks to the peeps that helped); You guys must be like, pretty intense scripter people."Pretty intense scripter people" that was funny, and flattering! Thanks.What kinda things can you guys make with AutoIt? Can you make viruses and stuff (Just wonder, I don't plan on it... ). With the GUI commands and stuff, could you actually create a full online game? That would be sweet, and if you could, I'd like to talk to you a bit more.. Autoit can do alot of things. To be really automated about it,AutoIt can: * Provide a general-purpose scripting language for all Windows versions * Simulate keystrokes (supports most keyboard layouts) * Simulate mouse movements and clicks * Move, resize and manipulate windows * Interact directly with "controls" on a window (set/get text from edit controls, check boxes and radio buttons, select items in drop-down lists, etc.) * Create complex user interfaces (GUIs) * Work with the clipboard to cut/paste text items * Provide a scriptable RunAs function for Windows 2000/XP/2003However, in regards to viruses and malware, the dev team has invested tons of time to having the compiler check scripts for malware. If they contain malware, they will immediately error out and fail. I personally am glad this has been instituted, because before it was, tons of people were getting autoit just to write viruses and hacks. and then they'd come here and pester us to help them. It was quite annoying.EDIT: Shhhhh Bert! Edited July 29, 2007 by Paulie
xKylex Posted July 29, 2007 Author Posted July 29, 2007 Bert, when you said you often thought about it and would help me, did you mean about making a virus or a game? And I'm glad you can't make viruses in this too, I can understand the problems it would cause. Bert/Paulie, either of you got MSN?
xKylex Posted July 29, 2007 Author Posted July 29, 2007 (edited) Sorry, It posted twice.. Edited July 29, 2007 by xKylex
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