Sign in to follow this  
Followers 0
ravenp

Recording mouse clicks and screen res.

13 posts in this topic

Howdy folks... long time WISE user, new to Autoit but i like what I see so far! I am trying to script an install for an IE certificate and a few of the buttons dont' have ALT + key operations so i've reverted to mouse clicks.

I have captured the clicks and the playback works fine on several machines with similar resolution, but I've noticed that a jump from 1024x768 to 1600x1200 for example seems to break the script.

Are there any tricks here that would save me from having to write a different script for each res and then check before running?

thanks!!

ps... if I can program keystrokes to replace the mouse clicks, i'd be all over that too :whistle:

Share this post


Link to post
Share on other sites



Howdy folks... long time WISE user, new to Autoit but i like what I see so far!  I am trying to script an install for an IE certificate and a few of the buttons dont' have ALT + key operations so i've reverted to mouse clicks.

I have captured the clicks and the playback works fine on several machines with similar resolution, but I've noticed that a jump from 1024x768 to 1600x1200 for example seems to break the script.

Are there any tricks here that would save me from having to write a different script for each res and then check before running?

thanks!!

ps... if I can program keystrokes to replace the mouse clicks, i'd be all over that too :whistle:

<{POST_SNAPBACK}>

check out ControlSend() and ControlClick() in the help file, that should take care of it...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

check out ControlSend() and ControlClick() in the help file, that should take care of it...

<{POST_SNAPBACK}>

Hey, thanks.

So instead of this...

WinWait("Certificate","&Install Certificate")

If Not WinActive("Certificate","&Install Certificate") Then WinActivate("Certificate","&Install Certificate")

WinWaitActive("Certificate","&Install Certificate")

MouseMove(224,422)

MouseDown("left")

MouseUp("left")

Sleep(1000)

I could have something like...

ControlClick ( "Certificate", "&Install Certificate", 108 [, left] [, 1]] )

???

Share this post


Link to post
Share on other sites

Hey, thanks.

So instead of this...

WinWait("Certificate","&Install Certificate")

If Not WinActive("Certificate","&Install Certificate") Then WinActivate("Certificate","&Install Certificate")

WinWaitActive("Certificate","&Install Certificate")

MouseMove(224,422)

MouseDown("left")

MouseUp("left")

Sleep(1000)

I could have something like...

ControlClick ( "Certificate", "&Install Certificate", 108 [, left] [, 1]] )

???

<{POST_SNAPBACK}>

yes but take out the ]['s those are to designate optional parameters, you don't have to have them around your arguments in the actual call

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

yes but take out the ]['s those are to designate optional parameters, you don't have to have them around your arguments in the actual call

<{POST_SNAPBACK}>

It seemed to require a bit extra to work... but i got it.

WinWait("Security Warning","You are about to ins")

If Not WinActive("Security Warning","You are about to ins") Then WinActivate("Security Warning","You are about to ins")

WinWaitActive("Security Warning","You are about to ins")

ControlClick ( "Security Warning", "You are about to ins", 6 )

MouseClick("left")

Now to test more resolutions.

Thanks for the help!!!

Share this post


Link to post
Share on other sites

If this does not work and the window has in each resolution the same size(pixel), you can use the option "MouseCoordMode". Then the coordinates are relative to the active window.

e.g.:

Opt("MouseCoordMode", 0) ;; Mouse coordinates relative to active window

MouseClick($primary, 191, 185, 1, 1)

java script:emoticon(':whistle:')

smilie

Share this post


Link to post
Share on other sites

So now I have a working script... works on 800x600 as well as 1600x1200.

Some of the buttons don't have control numbers, so i've had to leave in the mouse captures for those parts.

Is there another way to click those buttons where the control is hidden?

Thanks a bunch!

Share this post


Link to post
Share on other sites

Hopefully 1 last question :whistle:

I'm trying to figure out logic for IF statements pertaining to active windows. One of the factors that changes in my script depends on whether the certificate has been installed or not already. If it has, there is one less dialogue that pops up.

So it would be very helpful if I could use...

If Not WinActive("Security Warning","You are about to ins") Then WinActivate("Security Warning","You are about to ins")

A bit differently to launch a different key combination depending on whether that dialogue box appears or a different one does.

Any ideas?

Thanks!

Share this post


Link to post
Share on other sites

Hopefully 1 last question :whistle:

I'm trying to figure out logic for IF statements pertaining to active windows.  One of the factors that changes in my script depends on whether the certificate has been installed or not already.  If it has, there is one less dialogue that pops up.

So it would be very helpful if I could use...

If Not WinActive("Security Warning","You are about to ins") Then WinActivate("Security Warning","You are about to ins")

A bit differently to launch a different key combination depending on whether that dialogue box appears or a different one does.

Any ideas?

Thanks!

<{POST_SNAPBACK}>

you could do a little loop to check which window pops up and react accordingly.

here's a sample

while 1
    if WinExists("Window1") then
        ...;your code here for one window
        ExitLoop
    EndIf
    if WinExists("Window2") then
        ...;your code here for next
            ExitLoop
        EndIf
WEnd

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Hopefully 1 last question :whistle:

I'm trying to figure out logic for IF statements pertaining to active windows.  One of the factors that changes in my script depends on whether the certificate has been installed or not already.  If it has, there is one less dialogue that pops up.

So it would be very helpful if I could use...

If Not WinActive("Security Warning","You are about to ins") Then WinActivate("Security Warning","You are about to ins")

A bit differently to launch a different key combination depending on whether that dialogue box appears or a different one does.

Any ideas?

Thanks!

<{POST_SNAPBACK}>

Nevermind, I figured out the if logic :dance:

If WinActive("Security Warning","You are about to ins") Then

WinWait("Security Warning","You are about to ins")

If Not WinActive("Security Warning","You are about to ins") Then WinActivate("Security Warning","You are about to ins")

WinWaitActive("Security Warning","You are about to ins")

ControlClick ( "Security Warning", "You are about to ins", 6 )

MouseClick("left")

Sleep(1000)

ElseIf WinActive("Certificate Import Wizard","The import was succe") Then

WinWait("Certificate Import Wizard","The import was succe")

If Not WinActive("Certificate Import Wizard","The import was succe") Then WinActivate("Certificate Import Wizard","The import was succe")

WinWaitActive("Certificate Import Wizard","The import was succe")

ControlClick ( "Certificate Import Wizard", "The import was succe", 2 )

MouseClick("left")

Sleep(1000)

EndIf

That worked great...

If someone could help eliminate my mouse capture that would be amazing!

Thanks for everyone's help!

Share this post


Link to post
Share on other sites

you could do a little loop to check which window pops up and react accordingly.

here's a sample

while 1
    if WinExists("Window1") then
        ...;your code here for one window
        ExitLoop
    EndIf
    if WinExists("Window2") then
        ...;your code here for next
            ExitLoop
        EndIf
WEnd

<{POST_SNAPBACK}>

Wow, thanks...that's cleaner than mine :whistle:

Share this post


Link to post
Share on other sites

Wow, thanks...that's cleaner than mine :whistle:

<{POST_SNAPBACK}>

glad i could help... for your mouse issue, did you see the post by Tygran? that may help, if not, there are alot of posts on the forum about identifying and manipulating controls (and overcoming issues doing so)

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

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