Wrench Posted August 4, 2006 Share Posted August 4, 2006 (edited) Today marked my first try at somewhat difficult code-writing, heh. Anyhow, I think I've got the very, very basics of AutoIt scripting down. I've been trying to write a script that does the following, to no avail except quite a few error messages : Remains in the 'background' until the user presses a specific button (Do I need to use the 'Hotkey' function for this? ) and then begins sending some text (With the 'Send' function, I'm guessing). After it sends a line of text and hits return, it then pauses for six seconds ('Sleep' function?) and then sends the same line of text again. It continues to 'loop' from the beginning - that is, typing the text and hitting return (I hesitate to say loop, because it could mean something that I don't understand) until the user presses another key ('Hotkey' again?) It doesn't seem too complex, maybe someone could help me out with this? Remember, I'm completely new at this, so don't be too harsh please EDIT - Just realized my title is screwed up, heh Edited August 4, 2006 by Wrench Link to comment Share on other sites More sharing options...
Wrench Posted August 4, 2006 Author Share Posted August 4, 2006 Found this in another script: HotkeySet("{END}","_end") HotKeySet("{Home}", "RunScript") HotKeySet("{PAUSE}","PauseScript") Does that have the same effect as the 'press button start' 'press another end' part that I need? Link to comment Share on other sites More sharing options...
Jasio Posted August 4, 2006 Share Posted August 4, 2006 (edited) HotKeySet("{END}", "TogglePause") HotKeySet("{PAUSE}", "ToggleResume") $Paused = 1 While 1 Sleep(100) WEnd Func TogglePause() $Paused = 0 While $Paused = 0 Send('YourTextGoesHere') Sleep(6000) WEnd EndFunc Func ToggleResume() $Paused = 1 EndFunc It's pretty poorly written i suppose. Just hit the END key to start the script, and the PAUSE BREAK key to pause it. Edited August 4, 2006 by Jasio Link to comment Share on other sites More sharing options...
nitekram Posted August 4, 2006 Share Posted August 4, 2006 I would use another key other than ones that the user may already use, and if the user's program already used that key then who knows what would happen. Try using Alt or Ctrl before the hotkey 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow."  WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI  CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Jasio Posted August 4, 2006 Share Posted August 4, 2006 @Wrench, you can make the hotkeys anything you wish, notice where it sais {END} and {PAUSE}. You can change that to anything you wish. {!} ! {#} # {+} + {^} ^ {{} { {}} } {SPACE} SPACE {ENTER} ENTER key on the main keyboard {ALT} ALT {BACKSPACE} or {BS} BACKSPACE {DELETE} or {DEL} DELETE {UP} Cursor up {DOWN} Cursor down {LEFT} Cursor left {RIGHT} Cursor right {HOME} HOME {END} END {ESCAPE} or {ESC} ESCAPE {INSERT} or {INS} INS {PGUP} PageUp {PGDN} PageDown {F1} - {F12} Function keys {TAB} TAB {PRINTSCREEN} Print Screen key {LWIN} Left Windows key {RWIN} Right Windows key {NUMLOCK on} NUMLOCK (on/off/toggle) {CAPSLOCK off} CAPSLOCK (on/off/toggle) {SCROLLLOCK toggle} SCROLLLOCK (on/off/toggle) {CTRLBREAK} Ctrl+Break {PAUSE} PAUSE {NUMPAD0} - {NUMPAD9} Numpad digits {NUMPADMULT} Numpad Multiply {NUMPADADD} Numpad Add {NUMPADSUB} Numpad Subtract {NUMPADDIV} Numpad Divide {NUMPADDOT} Numpad period {NUMPADENTER} Enter key on the numpad {APPSKEY} Windows App key {LALT} Left ALT key {RALT} Right ALT key {LCTRL} Left CTRL key {RCTRL} Right CTRL key {LSHIFT} Left Shift key {RSHIFT} Right Shift key {SLEEP} Computer SLEEP key {ALTDOWN} Holds the ALT key down until {ALTUP} is sent {SHIFTDOWN} Holds the SHIFT key down until {SHIFTUP} is sent {CTRLDOWN} Holds the CTRL key down until {CTRLUP} is sent {LWINDOWN} Holds the left Windows key down until {LWINUP} is sent {RWINDOWN} Holds the right Windows key down until {RWINUP} is sent Link to comment Share on other sites More sharing options...
Wrench Posted August 4, 2006 Author Share Posted August 4, 2006 (edited) Yes, I had anticipated them using other keys. Thank you for all the help everyone, I'll get this down soon enough =P EDIT - Jasio, I tried your script out...it doesn't seem to work correctly. I'll try messing with it a little with my (very) limited knowledge and see where that gets me Edited August 4, 2006 by Wrench Link to comment Share on other sites More sharing options...
Wrench Posted August 4, 2006 Author Share Posted August 4, 2006 Alright, monkeyd with it a bit: HotKeySet("{END}", "TogglePause") HotKeySet("{PAUSE}", "ToggleResume") $Paused = 1 While 1 Sleep(100) WEnd Func TogglePause() $Paused = 0 While $Paused = 0 Send('Hello world!') Send("{NUMPADENTER}") Sleep(6000) WEnd EndFunc Func ToggleResume() $Paused = 1 EndFunc It works now, tested it in Notepad. Thank you Jasio! Soo much more to learn -_x I found this neat AutoIt 1 2 3 thing that someone made, I'll check it out tonight Link to comment Share on other sites More sharing options...
Jasio Posted August 4, 2006 Share Posted August 4, 2006 I suggest you download SciTe editor to. Its very helpful for all stages of the programming process. SciTe download Link to comment Share on other sites More sharing options...
Wrench Posted August 5, 2006 Author Share Posted August 5, 2006 I suggest you download SciTe editor to. Its very helpful for all stages of the programming process.Thank you, I got that this morning =PMuch easier than notepad. Was getting a headache from the monotone text x_x 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