Jump to content

Embarrassingly simple script attempt/request? - (Locked)


Recommended Posts

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 post
Share on other sites

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).

Link to post
Share on other sites
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

 

Musashi-C64.png

"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 post
Share on other sites

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.

Link to post
Share on other sites
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 post
Share on other sites
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...