Sign in to follow this  
Followers 0
techshots

Why does my mouse move when the script doesn't tell it to?

2 posts in this topic

#1 ·  Posted (edited)

Windows 7 build 7100

Purpose of the Script:

The script basically downloads webpages for me to read later on.

Background:

I use the macro record and edited quite a few things afterwards.

Problem:

When I run the script, I see everything works fine until at this point in the script:

I see the Confirm Save As (CSA) window appear, and the script INSTEAD of closing the CSA window,

Left clicks once to the right of the Save As window, and then once to the bottom of the Save As window.

It then proceeds to close the CSA window as per my code below.(The CSA window comes up when a duplicate name is used and pops up in a SA window) Why does the mouse do that when I don't see any line telling the mouse to do so in my script?

P.S. I used this script previously without much problems, but not sure what's going on now. Whenever I have to download a new set of things to read, I have to adjust a few mouse positions naturally.

Any help would be appreciated.

--------------------------------------

If winExists ( "Confirm Save As","" ) Then

; CLOSE THE Confirm Save As Window

WinActivate ( "Confirm Save As","" )

Send("{ENTER}")

; CLOSE THE SAVE AS WINDOW

WinWait("Save As","")

If Not WinActive("Save As","") Then WinActivate("Save As","")

WinWaitActive("Save As","")

Send("{ESC}")

---------------------------------------

Full Script

-----------

#region --- ScriptWriter generated code Start ---

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

;CHANGE THIS

Do

; Mouse position to select title CHANGE THIS MOUSE POSITION

MouseMove(273,393)

MouseDown("left")

MouseUp("left")

; highlight the title, copy it, and bring up Save As dialog

Send("{SHIFTDOWN}{DOWN}{SHIFTUP}{CTRLDOWN}c{CTRLUP}")

sleep(2000)

Send("{CTRLDOWN}s{CTRLUP}")

sleep(2000)

WinWait("Save As","")

If Not WinActive("Save As","") Then WinActivate("Save As","")

WinWaitActive("Save As","")

; get clipboard data

$clipdata = ClipGet()

; replace any colon with blank

$replace_illegal_colon = StringReplace($clipdata, ":", " ")

; replace any question marks with blank

$replace_illegal_question = StringReplace($replace_illegal_colon, "?", " ")

; replace any question marks with blank

$replace_illegal_greater_than = StringReplace($replace_illegal_question, ">", " ")

ClipPut ($replace_illegal_greater_than)

; click on the SAVE AS dialog box

;MouseMove(718,589)

;MouseDown("left")

;MouseUp("left")

; paste onto the SAVE AS dialog

Send("{CTRLDOWN}v{CTRLUP}")

Sleep(2000)

; Enter key to click on Save button

Send("{ENTER}")

If winExists ( "Confirm Save As","" ) Then

; CLOSE THE Confirm Save As Window

WinActivate ( "Confirm Save As","" )

Send("{ENTER}")

; CLOSE THE SAVE AS WINDOW

WinWait("Save As","")

If Not WinActive("Save As","") Then WinActivate("Save As","")

WinWaitActive("Save As","")

Send("{ESC}")

; CHANGE THIS

; CHANGE THIS :NEW LINE TO HIGHLIGHT AND COPY

MouseMove(278,361)

MouseDown("left")

MouseUp("left")

; highlight the title, copy it, and bring up Save As dialog

Send("{SHIFTDOWN}{DOWN}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{CTRLDOWN}s{CTRLUP}")

sleep(2000)

Send("{CTRLDOWN}s{CTRLUP}")

sleep(2000)

WinWait("Save As","")

If Not WinActive("Save As","") Then WinActivate("Save As","")

WinWaitActive("Save As","")

sleep(5000)

WinWait("Save As","")

If Not WinActive("Save As","") Then WinActivate("Save As","")

WinWaitActive("Save As","")

; get clipboard data

$clipdata = ClipGet()

; replace any colon with blank

$replace_illegal_colon = StringReplace($clipdata, ":", " ")

; replace any question marks with blank

$replace_illegal_question = StringReplace($replace_illegal_colon, "?", " ")

; replace any question marks with blank

$replace_illegal_greater_than = StringReplace($replace_illegal_question, ">", " ")

ClipPut ($replace_illegal_greater_than)

; click on the SAVE AS dialog box

;MouseMove(44,386)

;MouseDown("left")

;MouseUp("left")

; paste onto the SAVE AS dialog

Send("{CTRLDOWN}v{CTRLUP}")

Sleep(2000)

; Enter key to click on Save button

Send("{ENTER}")

EndIf

; wait for the download to complete

Sleep(5000)

; CHANGE THIS Click Next Button

MouseMove(1194,322)

MouseDown("left")

MouseUp("left")

Sleep(5000)

; Do until reaches last chapter title

$result = StringInStr($replace_illegal_greater_than, "35.5. Joining")

Until $result = 1

MsgBox(0, "", "Ended Successfully")

#endregion --- ScriptWriter generated code End ---

Edited by techshots

Share this post


Link to post
Share on other sites



Where did you get your X/Y coordinates, and are they relative to the Active window since you set MouseCoordMode = 0?

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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