Jump to content
Sign in to follow this  
OrangePanda

Help: Script not working

Recommended Posts

OrangePanda

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

Share this post


Link to post
Share on other sites
GaryFrost

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.

 

Share this post


Link to post
Share on other sites
OrangePanda

thanks for the help. But nothing happens if i press any of the hotkey

Edited by OrangePanda

Share this post


Link to post
Share on other sites
Valuater

thanks for the help. But nothing happens if i press any of the hotkey

try pressing the "Num Lock" first

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
OrangePanda

try pressing the "Num Lock" first

8)

im really sorry to bother you guys, but it still not working :P

i already tried to press num lock

also tried it on notepad to see if its pressing the right keys, but nothings happening

Share this post


Link to post
Share on other sites
GaryFrost

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.

 

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.