Jump to content

Need help adding a send function to Auto It


Hurts
 Share

Recommended Posts

I have been working on a program to auto send a few keys.

I need to add a feature that sends the TAB key every 4 seconds, but i don't know where and how to add it. I would like it to work in addition to the current program. Here it is:

$hkt = IniRead ( "Settings.ini", "Hotkeys", "Togglekey", "Not Set" )
$hkc = IniRead ( "Settings.ini", "Hotkeys", "Exitkey", "Not Set" )
$slpn = IniRead ( "Settings.ini", "Sleep Time", "Minimum", "Not Set" )
$slpx = IniRead ( "Settings.ini", "Sleep Time", "Maximum", "Not Set" )
If $hkt = "Not Set" AND $hkc = "Not Set" Then
    MsgBox ( 0 , "Error", "No settings.ini detected, or some data missing. Creating one now and setting to default." )
    IniWrite ( "Settings.ini", "Hotkeys", "Togglekey", "^!z" )
    IniWrite ( "Settings.ini", "Hotkeys", "Exitkey", "^!x" )
    IniWrite ( "Settings.ini", "Sleep Time", "Minimum", "30" )
    IniWrite ( "Settings.ini", "Sleep Time", "Maximum", "75" )
    Exit
EndIf
$toggle = 0
HotKeySet ( $hkt , "toggle" )
HotKeySet ( $hkc , "close" )
While 1
    Sleep ( 5000 )
WEnd

Func toggle()
    If $toggle = 0 Then
        $toggle = 1
        start()
    Else
        $toggle = 0
    Endif
EndFunc

Func start()
    Do
        $sleept = Random ( $slpn , $slpx , 0 )
        $sleept = $sleept * 1000
        Sleep ( 1000 )
        Send("{CTRLDOWN}{CTRLUP}{CTRLDOWN}{CTRLUP}g")
        Sleep ( $sleept )
    Until $toggle = 0
EndFunc

Func close()
    Exit
EndFunc
Link to comment
Share on other sites

  • Moderators

At the top of you script put:

AdlibEnable('_SendTab', 4000)oÝ÷ Ø   Ýiº/{*.¬[§qÉh±ênµ«­¢+ÙÕ¹}M¹Q ¤(M¹ ÌäííQ    ôÌäì¤)¹Õ¹

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...