martinno Posted May 30, 2012 Share Posted May 30, 2012 Hello! I'am new ( noob ) to AutoIt and scripts in general, but found that AutoIt is one of the best choises... Have spent some few hours reading manuals, but havent get even one step closer to what I need. I hope, You can help me. Need script that runs in background and starts keystroke. What I need: when I press Enter, hotkey is launched and it launches RIGHT and after that F2. It would be excellent, if script could be enabled/disabled by CapsLock button. Hoping in Your help. Thanks. Martin. Link to comment Share on other sites More sharing options...
someone Posted May 30, 2012 Share Posted May 30, 2012 Welcome to the forum. Lookup hotkeyset, and loops in the manual. That will get you started. If you get stuck, post the code you have and we will be more then happy to help.Also please forgive me if I'm off base...but this is NOT for a game correct? While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
martinno Posted May 30, 2012 Author Share Posted May 30, 2012 Thanks, will check it out. No it's not for the game It's for job. Need to automate some processes. Link to comment Share on other sites More sharing options...
martinno Posted May 30, 2012 Author Share Posted May 30, 2012 Wrote this reading manuals... it doesnt work... HotKeySet("{CAPSLOCK}", "TogglePause") HotKeySet("{ENTER}", "Scan") While 1 Sleep(100) WEnd Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is"Paused"', 0, 0) WEnd ToolTip("") EndFunc Func Scan() HotKeySet("{ENTER}") SLEEP (1000) Send("{RIGHT}") SLEEP (1000) Send("{F2}") HotKeySet("{ENTER}", "Scan") EndFunc Link to comment Share on other sites More sharing options...
someone Posted May 30, 2012 Share Posted May 30, 2012 Running this script you get a warning and error from Scite. You can fix that, also, can you be more specific about what doesn't work? And what doesn't work means? While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 30, 2012 Moderators Share Posted May 30, 2012 martinno, Welcome to the AutoIt forum. Here you go - see if this works for you: expandcollapse popupHotKeySet("{CAPSLOCK}", "_Toggle") HotKeySet("{ENTER}", "_Scan") HotKeySet("{ESC}", "_Exit") ; Declare Global flag set to True Global $fToggle = True ConsoleWrite("Enabled" & @CRLF) ; Just for example While 1 Sleep(10) WEnd Func _Toggle() $fToggle = Not $fToggle ; Just for example Switch $fToggle Case True ConsoleWrite("Enabled" & @CRLF) Case False ConsoleWrite("Disabled" & @CRLF) EndSwitch ; End of example EndFunc Func _Scan() If $fToggle Then ConsoleWrite("Sending" & @CRLF) ; Just for example ;Send("{RIGHT}") ;Sleep(1000) ;Send("{F2}") EndIf EndFunc Func _Exit() Exit EndFunc Please ask if you have any questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
martinno Posted May 30, 2012 Author Share Posted May 30, 2012 Yes - i get warning when trying to pause script. OK, it's not the main problem - it can run all the time. It works, but not as I want - I need to hold ENTER key for a while, to run this script - short ENTER don't run it. How can I fix it? 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