Jump to content

Help: Script not working


Recommended Posts

Hi im stuck with the problem on this script. It doesnt seem to work

basically what i wanted to do is this:

If press numpad 1 it should press 6 then hold right mouse button for 87 sec

after that press 4 then wait 1 sec then release the right mouse, then loop again until I stop it with a key.

the other one is if i press numpad 4 it would hold right mouse for 7 sec, then release the right mouse, then hold it again for 7 sec, then release again and so on with infinite loop until I stop it with a key.

Hope you guys can help me

thnks in advance

; Script Start - Add your code below here

;Keys
HotKeySet("(NUMPAD1)", "Essb")
HotKeySet("(NUMPAD2)", "Essboff")
HotKeySet("(NUMPAD4)", "Nova")
HotKeySet("(NUMPAD5)", "Novaoff")
    GuiSetState()

$Essb = 0
$Nova = 0

While 1
$msg = GuiGetMsg()
if $Essb = 1 Then
Send("(6)")
    MouseDown ("right")
            Sleep(86000)
        MouseUp ("right")
        Send ("(4)")
        MouseDown ("right")
        Sleep (1000)
        MouseUp ("right")
        Sleep (500)
        EndIf

if $Nova = 1 Then
        MouseDown ("right")
        Sleep (7000)
        MouseUp ("right")
        Sleep (500)
        EndIf
WEnd

Func Essb()
    $Essb = 1
EndFunc

Func Nova()
    $Nova = 1
EndFunc

Func Essboff()
    $Essb = 0
EndFunc

Func Novaoff()
    $Nova = 0
EndFunc
Link to comment
Share on other sites

Being you don't have a gui there is a few lines not needed and exit function added.

Didn't test it, but it should work.

; Script Start - Add your code below here

;Keys
HotKeySet("(NUMPAD1)", "Essb")
HotKeySet("(NUMPAD2)", "Essboff")
HotKeySet("(NUMPAD4)", "Nova")
HotKeySet("(NUMPAD5)", "Novaoff")
HotKeySet("{Esc}", "_Terminate")

$Essb = 0
$Nova = 0

While 1
    If $Essb = 1 Then
        Send("(6)")
        MouseDown("right")
        Sleep(86000)
        MouseUp("right")
        Send("(4)")
        MouseDown("right")
        Sleep(1000)
        MouseUp("right")
        Sleep(500)
    EndIf
    
    If $Nova = 1 Then
        MouseDown("right")
        Sleep(7000)
        MouseUp("right")
        Sleep(500)
    EndIf
    Sleep ( 100 )
WEnd

Func Essb()
    $Essb = 1
EndFunc   ;==>Essb

Func Nova()
    $Nova = 1
EndFunc   ;==>Nova

Func Essboff()
    $Essb = 0
EndFunc   ;==>Essboff

Func Novaoff()
    $Nova = 0
EndFunc   ;==>Novaoff

Func _Terminate()
    Exit
EndFunc   ;==>_Terminate

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Try using the correct syntax in HotKeySet use {} not ()

; Script Start - Add your code below here

;Keys
HotKeySet("{NUMPAD1}", "_Essb")
HotKeySet("{NUMPAD2}", "_Essboff")
HotKeySet("{NUMPAD4}", "_Nova")
HotKeySet("{NUMPAD5}", "_Novaoff")
HotKeySet("{Esc}", "_Terminate")

Run("Notepad")
$Essb = 0
$Nova = 0

While 1
    If $Essb = 1 Then
        Send("(6)")
        MouseDown("right")
        Sleep(86000)
        MouseUp("right")
        Send("(4)")
        MouseDown("right")
        Sleep(1000)
        MouseUp("right")
        Sleep(500)
    EndIf
    
    If $Nova = 1 Then
        MouseDown("right")
        Sleep(7000)
        MouseUp("right")
        Sleep(500)
    EndIf
    Sleep ( 100 )
WEnd

Func _Essb()
    $Essb = 1
EndFunc   ;==>Essb

Func _Nova()
    $Nova = 1
EndFunc   ;==>Nova

Func _Essboff()
    $Essb = 0
EndFunc   ;==>Essboff

Func _Novaoff()
    $Nova = 0
EndFunc   ;==>Novaoff

Func _Terminate()
    Exit
EndFunc   ;==>_Terminate

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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