Jump to content

Recommended Posts

Posted (edited)

ok im trying to make something that you toggle on/off with F10 for:

a input box that you type a number into and it counts down backward and when it gets to zero it sends '0'

then it does it again and again untill you press F10 again

i was typing the script then i got really stumped

i thought i would just use a loop script

this is a example (not for what im trying to do but kinda LIKE what im trying to do)

$count = 10

Do
    MsgBox(0, "Kinda Example", "Count is: " & $count)

    
    $count = $count - 1  

Until $count  = 0

BUT THERE WOULD BE NO BOX TO SHOW THE COUNT and when $count = 0 it would send '0' once and repeat it

but i got stumped so if you guys know what to do if you could tell me that would be much appriciated

THANKS!!! :whistle:

Isaac

P.S.

here is the script im working on right now i have a error on it but thats cause im working on that ^ but other then that it works

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

Global $F5OnOff
Global $F6OnOff
Global $F11OnOff
Global $F10OnOff

HotKeySet('{F5}', '_SendB')
HotKeySet('{F6}', '_SendZ')
HotKeySet('{F11}', '_SendLeftClick')
HotKeySet('{F10}', '_Send0')

GUICreate("Program (In Progress)",220,200, 100,200)
GUISetBkColor (0x00E0FFFF) 
GUICtrlSetOnEvent($GUI_EVENT_CLOSE, "onclick")
GUICtrlCreateLabel("1." & @CRLF & "F5 Toggle Pressing B" & @CRLF & @CRLF &  "2." & @CRLF & "F6 Toggle Pressing Z" & @CRLF & @CRLF &  "F11 Toggle Auto Click Left", 50, 10)
$NumberKey = GUICtrlCreateInput("Enter Amount In Sec.", 55, 120, 110, 20)
$user = GUICtrlCreateDummy()
GUICtrlSetOnEvent(-1, "Onexit")
$button = GUICtrlCreateButton ("Close",75,170,70,20)
GUICtrlSetOnEvent(-1, "onclick")
GUISetState(@SW_SHOW)

Sleep(5000)


While 1
   Sleep (10)
   If $F5OnOff Then Send('b')
   If $F6OnOff Then Send('z')
   If $F11OnOff Then MouseClick('Left')
   If $F10OnOff Then Send('0')
       
Wend

Exit

; Functions ----------------------

Func onclick()
   GUICtrlSendToDummy($user)
EndFunc

Func OnExit()
   Exit
EndFunc

Func _SendB()
    $F5OnOff = Not $F5OnOff
EndFunc

Func _SendZ()
    $F6OnOff = Not $F6OnOff
EndFunc

Func _SendLeftClick()
    $F11OnOff = Not $F11OnOff
EndFunc

Func _Send0()
    $F10OnOff = Not $F10OnOff
    EndFunc
    
    

$count = $NumberKey

Do
    $count - 1
    
If $count < 0
    Send'0'
EndIf
Edited by toothyXdip
---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
  • Moderators
Posted

Global $bHKOnOff
HotKeySet('Some Key', '_MasterSwitch')

While 1
    Sleep(10000)
WEnd

Func _MasterSwitch()
    $bHKOnOff = Not $bHKOnOff
    If $bHKOnOff Then
        HotKeySet('Key 1 On', '_FunctionToCall')
        HotKeySet('Key 2 On', '_FunctionToCall2')
    ElseIf Not $bHKOnOff Then
        HotKeySet('Key 1 On', '')
        HotKeySet('Key 2 On', '')
    EndIf
    Return ''
EndFunc

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.

Posted

when i put that in there it opens my program but it doesnt send '0' and i dont think it even counts down

Here is my script now:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

Global $F5OnOff
Global $F6OnOff
Global $F11OnOff
Global $F10OnOff

HotKeySet('{F5}', '_SendB')
HotKeySet('{F6}', '_SendZ')
HotKeySet('{F11}', '_SendLeftClick')
HotKeySet('{F10}', '_MasterSwitch')

GUICreate("Program (In Progress)",220,200, 100,200)
GUISetBkColor (0xCC00CC) 
GUICtrlSetOnEvent($GUI_EVENT_CLOSE, "onclick")
GUICtrlCreateLabel("1." & @CRLF & "F5 Toggle Pressing B" & @CRLF & @CRLF &  "2." & @CRLF & "F6 Toggle Pressing Z" & @CRLF & @CRLF &  "F11 Toggle Auto Click Left", 50, 10)
$NumberKey = GUICtrlCreateInput("Enter Amount In Sec.", 55, 120, 110, 20)
$user = GUICtrlCreateDummy()
GUICtrlSetOnEvent(-1, "Onexit")
$button = GUICtrlCreateButton ("Close",75,170,70,20)
GUICtrlSetOnEvent(-1, "onclick")
GUISetState(@SW_SHOW)

Sleep(5000)


While 1
   Sleep (10)
   If $F5OnOff Then Send('b')
   If $F6OnOff Then Send('z')
   If $F11OnOff Then MouseClick('Left')
       
Wend

Exit

; Functions ----------------------

Func onclick()
   GUICtrlSendToDummy($user)
EndFunc

Func OnExit()
   Exit
EndFunc

Func _SendB()
    $F5OnOff = Not $F5OnOff
EndFunc

Func _SendZ()
    $F6OnOff = Not $F6OnOff
EndFunc

Func _SendLeftClick()
    $F11OnOff = Not $F11OnOff
EndFunc

Func _Send0()
    $F10OnOff = Not $F10OnOff
    EndFunc
    
Func _MasterSwitch()
    $F10OnOff = Not $F10OnOff
    If $F10OnOff Then
      HotKeySet('0', '_FunctionToCall')

    EndIf
    Return ''
EndFunc

Func _FunctionToCall()
    $count = $NumberKey

Do
    
    $count = $count - 1  

Until $count  = 0



EndFunc
---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
  • Moderators
Posted

You're right, HotKeySet() doesn't send '0', what would you use to "send" 0?

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.

Posted

umm im not sure but here is my script again (i did somestuff to it):

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

Global $F5OnOff
Global $F6OnOff
Global $F11OnOff
Global $F10OnOff

HotKeySet('{F5}', '_SendB')
HotKeySet('{F6}', '_SendZ')
HotKeySet('{F11}', '_SendLeftClick')
HotKeySet('{F10}', '_MasterSwitch')

GUICreate("Program (In Progress)",220,200, 100,200)
GUISetBkColor (0xCC00CC) 
GUICtrlSetOnEvent($GUI_EVENT_CLOSE, "onclick")
GUICtrlCreateLabel("1." & @CRLF & "F5 Toggle Pressing B" & @CRLF & @CRLF &  "2." & @CRLF & "F6 Toggle Pressing Z" & @CRLF & @CRLF &  "F11 Toggle Auto Click Left", 50, 10)
$NumberKey = GUICtrlCreateInput("Enter Amount In Sec.", 55, 120, 110, 20)
$user = GUICtrlCreateDummy()
GUICtrlSetOnEvent(-1, "Onexit")
$button = GUICtrlCreateButton ("Close",75,170,70,20)
GUICtrlSetOnEvent(-1, "onclick")
GUISetState(@SW_SHOW)

Sleep(5000)


While 1
   Sleep (10)
   If $F5OnOff Then Send('b')
   If $F6OnOff Then Send('z')
   If $F11OnOff Then MouseClick('Left')
       
Wend

Exit

; Functions ----------------------

Func onclick()
   GUICtrlSendToDummy($user)
EndFunc

Func OnExit()
   Exit
EndFunc

Func _SendB()
    $F5OnOff = Not $F5OnOff
EndFunc

Func _SendZ()
    $F6OnOff = Not $F6OnOff
EndFunc

Func _SendLeftClick()
    $F11OnOff = Not $F11OnOff
EndFunc

    
Func _MasterSwitch()
    $F10OnOff = Not $F10OnOff
    If $F10OnOff Then
        HotKeySet('', '_Send0')
    EndIf
    Return ''
EndFunc

Func _Send0()
    $count = $NumberKey

Do
    
    $count = $count - 1  

If $count  = 0 Then 
Send('0')
EndIf

EndFunc

but i have 2 errors:

C:\Documents and Settings\isaac\Desktop\TXBot.au3(93,1) : ERROR: missing Until <expr>.

EndFunc

^

C:\Documents and Settings\isaac\Desktop\TXBot.au3(85,1) : REF: missing Until <expr>.

Do

^

---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Posted

Those errors in Scite are telling you your Do command is missing the ending Until. So

Do
$count = $count - 1  
Until $count = 0

If $count  = 0 Then
Send('0')
EndIf

that should work for you.

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

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
  • Recently Browsing   0 members

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