AutoIT Mettere in pausa script autohotkey

abellos

Utente Bronze
29 Giugno 2018
2
1
0
20
Ciao a tutti,
ho realizzato il seguente script per ripetere la pressione del tasto 3 quanto premo la E (questo e' configurabile ma i tasti son di default).

Codice:
; Generated by AutoGUI 2.2.6a
#NoEnv

#SingleInstance Force
SetWorkingDir %A_ScriptDir%


    IfNotExist, mmCFG.ini
        
    FileAppend,
    (

    [settings]

    setT1=100

    setT2=300

    startKey=e

    mantraKey=3

    ), mmCFG.ini

    Gui Add, Text, x16 y16 w71 h23 +0x200, Key spam ms:
    Gui Add, Edit, x96 y16 w41 h21 vsetT1,
    Gui Add, Edit, x152 y16 w38 h21 vsetT2,
    Gui Add, Text, x16 y48 w74 h23 +0x200, Activation key:
    Gui Add, Hotkey, x96 y48 w42 h21 vstartKey,
    Gui Add, Text, x16 y80 w74 h23 +0x200, Mantra key:
    Gui Add, Hotkey, x96 y80 w42 h21 vmantraKey,
    Gui Add, Button, x152 y80 w40 h23 gsave, &Save

    IniRead, setT1, mmCFG.ini, settings, setT1,
    IniRead, setT2, mmCFG.ini, settings, setT2,
    IniRead, startKey, mmCFG.ini, settings, startKey,
    IniRead, mantraKey, mmCFG.ini, settings, mantraKey,

    GuiControl,text, setT1, %setT1%

    GuiControl,text, setT2, %setT2%

    GuiControl,text, startKey, %startKey%

    GuiControl,text, mantraKey, %mantraKey%

    Gui Show, w218 h120, Mantra Spam
    
    enterKeyPressed = false   

    Hotkey %startKey%, starkey
    Hotkey Enter, starkey

Return

save:

    Gui, Submit, NoHide

    IniWrite, %setT1%, mmCFG.ini, settings, setT1
    IniWrite, %setT2%, mmCFG.ini, settings, setT2
    IniWrite, %startKey%, mmCFG.ini, settings, startKey
    IniWrite, %mantraKey%, mmCFG.ini, settings, mantraKey

Return


; Do not edit above this line

starKey:
    If (State=50){
        State=Off
        
    }else{
        State=50
        
    }

    SetTimer SendKey, %State%

return

SendKey:       
    if Key=Enter and enterKeyPressed=false then   
        State=Off
    else {
        #MaxThreadsPerHotkey 2

        Send %mantraKey%
        RandSleep(setT1,setT2)
    }
return

;*************************
; Functions
;*************************

    RandSleep(x,y) {               ;creates a variable with an X and Y
        Random, rand, %x%, %y%          ;Uses the Random function to generate x and y
        Sleep %rand%                      ;makes the %rand% value the sleep time
    }

GuiClose:
    ExitApp

Funziona come deve, ma ora vorrei che quando io premo il tasto [invio] lo script vada in pausa fino a che non ripremo [invio] una seconda volta.
Questo perche con [invio] mi apre la chat del gioco e se premo la E lo script parte e mi scrive in chat, cosa che nnon mi serve e vorrei evitare, mi sapete dare un aiuto? grazie in anticipo