Sign in to follow this  
Followers 0
Guest GrimGremlin

Please help a newbie

8 posts in this topic

OK when i get to the "installer" window and press the End key nothing happens. Any help would be greatly appreciated :ph34r:

AutoItSetOption("MouseClickDelay", 75)

WinWaitActive ("Installer")

HotKeySet("{End}", "onkeydown")
    
Func onkeydown()
    MouseClick("left", 375, 390, 0)
    MouseClick("left", 375, 390, 0)
    MouseClick("left", 375, 390, 0)
    MouseClick("left", 430, 390, 0)
    MouseClick("left", 375, 390, 0)
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

MouseClick("left", 375, 390, 0)

MouseClick("left", 375, 390, 0)

MouseClick("left", 375, 390, 0)

MouseClick("left", 430, 390, 0)

MouseClick("left", 375, 390, 0)

With your code you set the number of times the button is clicked to ZERO, not the SPEED.

MouseClick ( "button" [, x, y [, clicks [, speed ]]] )

I guess you wanted to set the mouse to move instantly (speed = 0), but than you have to set the clicks by hand, so the parser gets what you mean.

In general you have to set all the options from left to right, even if you just want to change the last one on the right and keep the rest on default values.

See the AutoIt Helpfile under Function Reference / Function Notes

MouseClick("left", 375, 390, 1, 0)
    MouseClick("left", 375, 390, 1, 0)
    MouseClick("left", 375, 390, 1, 0)
    MouseClick("left", 430, 390, 1, 0)
    MouseClick("left", 375, 390, 1, 0)
Edited by Proof

Share this post


Link to post
Share on other sites

Wow I'm stupid.

I tried that but now the script just closes when end is hit. Also it doesnt click anywhere. :ph34r:

Share this post


Link to post
Share on other sites

You sure, that no buttons are clicked? Maybe they just don`t hit the buttons you want them to. I try to avoid MouseClicks when possible.

Let a MsgBox or something pop open, when you hit END, so you know that it basically works.

Share this post


Link to post
Share on other sites

OK when i get to the "installer" window and press the End key nothing happens. Any help would be greatly appreciated :ph34r:

AutoItSetOption("MouseClickDelay", 75)

WinWaitActive ("Installer")

HotKeySet("{End}", "onkeydown")
    
Func onkeydown()
    MouseClick("left", 375, 390, 0)
    MouseClick("left", 375, 390, 0)
    MouseClick("left", 375, 390, 0)
    MouseClick("left", 430, 390, 0)
    MouseClick("left", 375, 390, 0)
EndFunc
Your script ends after the WinWaitActive ("Installer") line. That means that when this window exists and gets the focus, your script sets the HotKey and then right away ends.

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Your script ends after the WinWaitActive ("Installer") line. That means that when this window exists and gets the focus, your script sets the HotKey and then right away ends.

How do I get it to stay active?

Share this post


Link to post
Share on other sites

How do I get it to stay active?

dunno what you want exactly but this example stays active til the END key is pressed:

Global $StayAct=1
AutoItSetOption("MouseClickDelay", 75)
WinWaitActive ("Installer")
HotKeySet("{End}", "onkeydown")
While $StayAct=1
   Sleep(10)
Wend

Func onkeydown()
   MouseClick("left", 375, 390, 0)
   MouseClick("left", 375, 390, 0)
   MouseClick("left", 375, 390, 0)
   MouseClick("left", 430, 390, 0)
   MouseClick("left", 375, 390, 0)
   $StayAct=0
EndFunc

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Can you post your current code?

Ok, the way I'd do this is to add a 'While 1...WEnd', like this

WinWaitActive ("Installer")
HotKeySet("{End}", "onkeydown")

While 1
   Sleep(1000)
WEnd

Func onkeydown()
   MouseClick("left", 375, 390, 1, 0)
   MouseClick("left", 375, 390, 1, 0)
   MouseClick("left", 375, 390, 1, 0)
   MouseClick("left", 430, 390, 1, 0)
   MouseClick("left", 375, 390, 1, 0)
   MsgBox(0, "Success!", "Success!")
   Exit
EndFunc

EDIT: Damn JdeB beat me to the punch, JdeB's choice looks a little more complex than it could be. BUT if it works, well...

Edited by w_sp8er

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  
Followers 0