Sign in to follow this  
Followers 0
thawee

Autoit Mouseclicks Postions Off

6 posts in this topic

Hi, All

I am new to auto-it, and i see some really nice potential.

I am running into a problem. I have windows 7, and I am trying to use the auto-it recorder to document or trap mouse movements and clicks.

I want to install an application that doesn't have any command line interfaces without having to do it myself manually.

The problem I am having is after I have recorded my mouse movements and clicks I run the script. Opening the program off my desktop seems to work great, but thats all that seems to work good.

Its a hit or miss as to whether the script will wait for the application to load before it starts processing the other mouse clicks even though I have told the script to use wait command for loading applications before proceeding.

If it manages to load and the script waits for the program. When the script does continue the mouse positions of where it is clicking are no where near what i recorded! It seems like its not reading the correct mouse positions or translating them to click the right buttons on the application that loaded.

I see great potential here with autoit, but I am running into some basic snags.

This is the recorded Information.

_WinWaitActivate("Program Manager","")

MouseClick("left",804,35,2)

_WinWaitActivate("Disk Checker","Select a scanning option")

MouseClick("left",40,348,1)

MouseClick("left",69,412,1)

_WinWaitActivate("Perform full scan","")

MouseClick("left",322,294,1)

_WinWaitActivate("Disk Checker","")

MouseClick("left",711,514,1)

MouseMove(163,124)

MouseDown("left")

MouseMove(163,122)

MouseUp("left")

MouseClick("left",423,137,1)

Any help to get this working the way it should would be awesome.

Thanks in advance

Thawee

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

That's running ChkDsk the hard way.

Just Shellexecute it. The available switches are

<drive>: The drive to be checked. In the example I'll use C:

/F: The /F switch is the most common of the chkdsk switches. It tells chkdsk to fix any errors it finds. Chkdsk can’t fix errors on a disk that has open files. If chkdsk asks you if you want to check the drive next time Windows Vista boots or dismount the drive choose to check the drive next time Windows Vista boots. Never choose to dismount the drive. That option should only be used by a professional.

/R: The /R switch tells chkdsk to attempt to recover any bad sectors of the hard drive if any are found. A bad sector is a spot on the hard drive that can’t hold saved data anymore.

/I: The /I switch tells chkdsk to perform a less detailed but faster disk check.

Be sure to use spaces between the switches.

ShellExecuteWait("ChkDsk.exe", "C: /f", "",, "", @SW_HIDE)

Here it tells CheckDsk to check Drive c: and fix any errors it finds. To add bad sector recovery into the mix it would be

ShellExecuteWait("ChkDsk.exe", "C: /f /r", "","", @SW_HIDE)

You could also pu it into a loop to check all drives

$aDrive = DriveGetdrive("fixed")
;; Error check it
If NOT @Error Then
    For $i = 1 To Ubound($aDrives) -1
        ShellExecuteWait("ChkDsk.exe", $aDrives[$i] & " /f /r", "", "", @SW_HIDE)
    Next
EndIf
MsgBox(0, "Finished", "Drive checking is complete", 5)

Edit: I guess I should have also stated the obvious.

The mouse control coordinates you see in the info tool are relative to the window. MouseClick() uses screen coordinates. You would be better of with ControlClick()

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

First, I would try using mousecoord option with the different flags (you can find it in the helpfile.

What is _WinWaitActivate() function ? I'm not familiar with it.

_WinwaitActivate() waits until the program that is activated or launched before it continues with the rest of your code. IE you lauch disk checker, and the script pauses until disk checker is totally loaded. :(

I will look into your response Thanks for the quick responses :) much appreacted

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

That's running ChkDsk the hard way.

Just Shellexecute it. The available switches are

Be sure to use spaces between the switches.

ShellExecuteWait("ChkDsk.exe", "C: /f", "",, "", @SW_HIDE)

Here it tells CheckDsk to check Drive c: and fix any errors it finds. To add bad sector recovery into the mix it would be

ShellExecuteWait("ChkDsk.exe", "C: /f /r", "","", @SW_HIDE)

You could also pu it into a loop to check all drives

$aDrive = DriveGetdrive("fixed")
;; Error check it
If NOT @Error Then
    For $i = 1 To Ubound($aDrives) -1
        ShellExecuteWait("ChkDsk.exe", $aDrives[$i] & " /f /r", "", "", @SW_HIDE)
    Next
EndIf
MsgBox(0, "Finished", "Drive checking is complete", 5)

Edit: I guess I should have also stated the obvious.

The mouse control coordinates you see in the info tool are relative to the window. MouseClick() uses screen coordinates. You would be better of with ControlClick()

Very nice response,

I have a question though. Is there a disk checker that is better than check disk at running from a command line, and does not need to have th system reboot, so it can run at boot to repair the disk.

I would like to automate this process:

1) I would like to launch / install program.

2) then scan and repair the hard drive (Without Reboot)

3) dump log file in specified location

Without my interaction, and all i would have to do is look at the log file to see what happened?

NOte: I will look into control click and let you know what i find :(

Thanks everyone for your help thus far :)

Edited by thawee

Share this post


Link to post
Share on other sites

Note:

I just want to let everyone else know that may have faced this problem.

I did work with the control click and that seems to have fixed the issue I was having! for the most part.

I used this format when using ControlClick("<program title here>","","[iD:<ID Number Here>]") You get the ID number from the Autoit3 Window Info application.

Now I need to figure out how to start a new action when the screen changes.

If anyone has any ideas please let me know.

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