timoteo Posted December 15, 2022 Share Posted December 15, 2022 Sorry, I know this is probably extremely simply and I should be able to figure it out, but I haven't done any scripting since BASIC programming on my VIC-20 and C64 back in the early 80's 😬, so bear with me please ... I just need a script that will press the CONTROL key once every X seconds and repeat until I turn off the script. Having a checkbox or radio-button to turn it on/off would be ideal, but of course, not necessary. I just need to be able to set the time interval. Thanks for any help on this! -Tim Link to comment Share on other sites More sharing options...
Nine Posted December 15, 2022 Share Posted December 15, 2022 Look at AdlibRegister to set the timer. In the function you can send {CTRLDOWN}/{CTRLUP}. Just loop till you exit the script (with a sleep of course). “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
timoteo Posted December 18, 2022 Author Share Posted December 18, 2022 Sorry, but I am totally lost with this ... is there maybe an existing script out there that I could use and/or modify? Link to comment Share on other sites More sharing options...
Musashi Posted December 18, 2022 Share Posted December 18, 2022 On 12/15/2022 at 12:44 PM, timoteo said: I just need a script that will press the CONTROL key once every X seconds and repeat until I turn off the script. Try this : HotKeySet("{ESC}", "Terminate") Local $iInterval = 2000 ; how often in ms to call the function. Default is 250 ms. AdlibRegister("MyAdLibFunc", $iInterval) While 1 Sleep(50) WEnd Func MyAdLibFunc() Local Static $iCount = 0 $iCount += 1 Send('{CTRLDOWN}') Send('{CTRLUP}') ; just an info during tests : ToolTip("MyAdLibFunc called " & $iCount & " time(s)" & @CRLF & "-> Press ESC to exit the script" & @CRLF, 50, 50, "Info :", 1) EndFunc ;==>MyAdLibFunc Func Terminate() AdlibUnRegister("MyAdLibFunc") Exit EndFunc ;==>Terminate "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
timoteo Posted December 22, 2022 Author Share Posted December 22, 2022 Thanks, Msashi! That works pretty well. Is there any way to have it run in the background though? Currently it runs on top and ends up minimizing the program I am using it with and thus not triggering the CONTROL key in the application. Link to comment Share on other sites More sharing options...
Nine Posted December 22, 2022 Share Posted December 22, 2022 Can you tell us about the application you are trying to use it with ? Why does it need to send a CTRL at specific interval ? Why does it ends up minimizing the program ? More information is needed here. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
timoteo Posted December 22, 2022 Author Share Posted December 22, 2022 5 hours ago, Nine said: Can you tell us about the application you are trying to use it with ? Why does it need to send a CTRL at specific interval ? Why does it ends up minimizing the program ? More information is needed here. Hi, Nine. Sure ... It is for a game that logs you out if you are AFK more than 10 minutes or so. It is minimizing it (I assume) because it is running full screen, and the current script is using a toll-tip "pop-up" that stays on top of everything (except full screen, like with games) and therefore minimizes the game(s) at each and every interval it activates. I used to use a script I made with AutoHotKey using the little bit o' knowledge I learned from others there and probably frankensteining some existing scripts -- total hack job I imagine, lol. That worked really well though for a quite a while, but then stopped shortly after I upgraded to Windows 10. I guess I could try my old script on my newly built rig to see if maybe it was an issue with Win10 and some other software conflict. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2022 Moderators Share Posted December 22, 2022 Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team 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...
Recommended Posts