Jump to content
Franz135

Start programm with down arrow key

Recommended Posts

 

Hello everybody,

I created a simple AutoIT bot. The bot should simply click the mouse at two points defined by me.

My problem: I want (after the program was started with F5) the commands to be activated with the down arrow key. How do I do this or what am I doing wrong?

My previous code:


HotKeySet ( "{DOWN}","_start" )
HotKeySet ( "{UP}","_pause" )
HotKeySet ( "{END}","_exit" )

Global $go = 0

Func _start()
$go = 1
EndFunc
Func _pause()
$go = 0
EndFunc
Func _exit()
Exit
EndFunc

MouseClick("left",912,271,1,1)
Sleep(10)
MouseClick("left",912,718,1,1)
Sleep(10)

Thanks!

Share this post


Link to post
Share on other sites

You're not doing anything with the $go variable, try this (and please use a code block in future posts):

HotKeySet ( "{DOWN}","_start" )
HotKeySet ( "{UP}","_pause" )
HotKeySet ( "{END}","_exit" )

Global $go = 0


While(1)
    If($go) Then
        MouseClick("left",912,271,1,1)
        Sleep(100)
        MouseClick("left",912,718,1,1)
        $go=0
    Else
        Sleep(1)
    EndIf
WEnd

Func _start()
    $go = 1
EndFunc
Func _pause()
    $go = 0
EndFunc
Func _exit()
    Exit
EndFunc

 

Share this post


Link to post
Share on other sites

May I ask you what is the application you are trying to automate ?  Because there is better ways to do it without MouseClicks.

Share this post


Link to post
Share on other sites

@Nine

The reason for the program is that I want to quickly reserve places on a website (library) that are taken after two seconds (see picture). I have some ideas how to make the programm better but I dont know how to implement them.
 
I want the program to press the refresh button in my browser at 8:59:59 a.m. After loading the website, it should click on the empty box and the "anmelden" (register) button immediately.

 

Website.JPG

Share this post


Link to post
Share on other sites

You should definitely look in to use Web automation UDF like IE or WebDriver.  It will be way easier for you to get robust script than trying to use MouseClicks.   IE is part of the installation of AutoIt and it is well documented in help file.  

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...