Jump to content

Search the Community

Showing results for tags 'scroll 2 windows'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I need to scroll two PDF files each one in a separate window (side by side) in sync for comparison (they are graphic and OCR does not work well). The two windows do not have to scroll simultaneously or smoothly, they just need to stay in sync after any scrolling. So I thought easy - I can do this quick and dirty for any 2 windows - just go to each window and scroll when I detect the mousewheel moving. So I started testing just the windows scrolling aspect with Adobe Acrobat Pro 8 and Foxit Reader. I'm getting inconsistent results and most of the time the windows are not in sync. I'm using Win 10 v1803, Autoit 3.3.14.5 x64 and have tried it on 4 different machines (comments in code). The test code below shows 10 variations I have tried. I clearly must be doing something wrong and need a hint what that is. Also, is MouseMove a blocking function? That is, does it wait till it gets to the coordinates before continuing execution? I tried looking for the code for MouseMove and did not find it. Any hints appreciated as I've been stuck for over 2 weeks now. Any pdf file should work just make a copy and open them up side by side, same zoom, etc. here's one at: http://downloadcenter2.samsung.com/content/UM/201807/20180725103825282/ENG_US_KM2ATSCN-2.0.1.pdf #AutoIt3Wrapper_run_debug_mode=Y ;use this to debug in console window <--- LOOK ;recall that ;debug or ; debug or debug alone on a line appears to act as a debug toggle from: https://www.autoitscript.com/forum/topic/161421-problem-with-autoit3wrapper_run_debug_modey/#comment-1171811 ;so if debug stops working look for this #include <MsgBoxConstants.au3> #include <Word.au3> #include <FileConstants.au3> #include <Array.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <File.au3> #include <Misc.au3> ;for _IsPressed Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Opt("MouseCoordMode", 1) ;0=relative to active window, 1=absolute, 2=client Opt("SendKeyDelay", 0) ;5 milliseconds is default Opt("MouseClickDelay", 0) ;10 milliseconds = default Opt("MouseClickDownDelay", 0) ;10 milliseconds = default $version = "v1k" ;v1e - stripped out extraneous code for assistance ;v1f - scroll based on mouse wheel ;v1g - putting some code into functions ;v1h - be polite to help on AutoIt so create the files to scroll so they do not need to get anything. Use notepad files and position them and reset to top automatically. ;v1i - coded for Notepad as well - it seems to always work on all tests ;v1j - stripped out wheel sensing as not needed to show issue scrolling ;v1k - stripped out Notepad example as it scrolls fine Global $aMousePos1[2] ;position of mouse clicked in window 1 ;$aMousePos1[0] = X, $aMousePos1[1] = Y Global $tWindow1 ;title of window 1 Global $hWindow1 ;handle of window 1 Global $fpnWindow1 ;full path and filename Global $PIDWIndow1 ;process ID for killing later Global $aMousePos2[2] ;position of mouse clicked in window 2 ;$aMousePos2[0] = X, $aMousePos2[1] = Y Global $tWindow2 ;title of window 2 Global $hWindow2 ;handle of window 2 Global $fpnWindow2 ;full path and filename Global $PIDWIndow2 ;process ID for killing later Global $hTimer ;handle for timer functions ;--- set exit key HotKeySet("+!d", "Terminate") ; Shift+Alt+d MsgBox(0, "AutoIt Version", @AutoItVersion) ;Autoit version ;AutoItVersion 3.3.14.5 x64 ;tested with pdf file: ENG_US_KM2ATSCN-2.0.1.pdf from Samsung http://downloadcenter2.samsung.com/content/UM/201807/20180725103825282/ENG_US_KM2ATSCN-2.0.1.pdf ;tested on Adobe Acrobat 8 Pro and Foxit Reader 9.2 (go to File -> Preferences -> [x} Allow multiple instances - so have windows side by side) ;pdf viewere set to continuous display same zoom level, click in margin outside of document so do not click on any links that might be in the documents ;*mouse NOT moved during a test* ;machine 1: win 10 Pro v1803 i3-6100 3.7GHz 16GB 64bit SSD - tests AFU except Test 7, Test 8, Test 9 on Foxit Reader - only Test 7 works on Acrobat ;Test 8 is by far the fastest ;machine 2: Win 10 Home v1803 i5 2500S 2.7GHz 4GB x64 SSD - ;tested in Firefox Quantum 61.0.2 64bit - all tests fail except 9, 7 fails really bad (window does not scroll at all) ;tested Foxit Reader 9.2 - *ALL Pass* - 8 very fast, hard to believe in test 9 mouse click so slow with delay set to 0 ;machine 3: Win 10 Pro v 1803 AMD Athlon II X3 455 3.3GHz 8GB x64 SSD ;test in Acrobat 8 Pro - tests failing 1, 4, 8 tests passing 2,3,5,6,7,9 note Do loop count for test 8 4322/4074 and for test 9 101/472 ;test in Foxit Reader 9.2 - test failing 1,5,6 tests passing 2,3,4,7,8,9 note Do loop count for test 8 70344/76644 and for test 9 25725/28527 ;machine 4: Win 10 Pro v1803 i7 4770K 3.5Ghz 16GB SSD ;test Foxit Reader 8.3 - tests failing 3,5,6 ; test passing 1 (fast), 2,4,7,8 (fast), 9 ; Do loop counts 100/101 101/101 ;--- get window 1 mouse coordinates __Window1() ;returns $aMousePos1[0] = X, $aMousePos1[1] = Y ;--- get window 2 mouse coordinates __Window2() ;returns $aMousePos2[0] = X, $aMousePos2[1] = Y MsgBox($MB_OK + $MB_TOPMOST, "Ready", "After clicking the OK button - tests will begin." & @CRLF & "You can pause/exit this program by pressing Shift+Alt+d") MsgBox($MB_OK + $MB_TOPMOST, "Ready", "Before each test move both documents to the top of each window and make sure at same zoom level (and continuous scroll mode).") __HomeToTop() ;move to top for both windows ;#cs MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 1 - using MouseClick and MouseWheel") __start_timer() For $i = 1 to 100 MouseClick($MOUSE_CLICK_LEFT, $aMousePos1[0], $aMousePos1[1], 1, 0) ;window 1 ;speed = 100 works, 10 out of sync gives focus to clicked window MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! MouseClick($MOUSE_CLICK_LEFT, $aMousePos2[0], $aMousePos2[1], 1, 0) ;window 2 ;yes need to click in window as WinActivate also does NOT do it - do instantly MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! Next __stop_timer("Test 1") MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 1 - ended - using MouseClick and MouseWheel") __HomeToTop() ;move to top for both windows MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 2 - using MouseClick and Send") __start_timer() For $i = 1 to 100 MouseClick($MOUSE_CLICK_LEFT, $aMousePos1[0], $aMousePos1[1], 1, 0) ;speed = 100 works, 10 out of sync Send("{DOWN}") ;try this and see if it stays in sync MouseClick($MOUSE_CLICK_LEFT, $aMousePos2[0], $aMousePos2[1], 1, 0) ;yes need to click in window as WinActivate also does NOT do it - do instantly Send("{DOWN}") ;try this and see if it stays in sync Next __stop_timer("Test 2") MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 2 - ended - using MouseClick and Send") __HomeToTop() ;move to top for both windows MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 3 - using Winactivate, MouseClick and Send") ;WinActivate *really* slows it down so it does stay in sync probably due to speed slowdown alone __start_timer() For $i = 1 to 100 Do Until WinActivate($tWindow1) <> 0 ;give it focus - does not work - yes we need to click in window as WinActivate also does NOT do it - do instantly MouseClick($MOUSE_CLICK_LEFT, $aMousePos1[0], $aMousePos1[1], 1, 0) ;speed = 100 works, 10 out of sync gives focus to clicked window MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! Do Until WinActivate($tWindow2) <> 0 ; MouseClick($MOUSE_CLICK_LEFT, $aMousePos2[0], $aMousePos2[1], 1, 0) ;yes need to click in window as WinActivate also does NOT do it - do instantly MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! Next __stop_timer("Test 3") MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 3 - ended - using Winactivate, MouseClick and Send") ;WinActivate *really* slows it down so it does stay in sync probably due to speed slowdown alone __HomeToTop() ;move to top for both windows MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 4 - using tuning, MouseClick and MouseWheel") __start_timer() For $i = 1 to 100 MouseClick($MOUSE_CLICK_LEFT, $aMousePos1[0], $aMousePos1[1], 1, 0) ;speed = 100 works, 10 out of sync gives focus to clicked window Sleep(10) MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! Sleep(10) MouseClick($MOUSE_CLICK_LEFT, $aMousePos2[0], $aMousePos2[1], 1, 0) ;yes need to click in window as WinActivate also does NOT do it - do instantly Sleep(10) MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! Sleep(10) Next __stop_timer("Test 4") MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 4 - ended - using tuning, MouseClick and MouseWheel") __HomeToTop() ;move to top for both windows ;Perhaps title match is taking too long - let's try using the handle MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 5 - using handle Winactivate, MouseClick and Send") ;still very slow and in sync - try getting rid of Do-While __start_timer() For $i = 1 to 100 Do Until WinActivate($hWindow1) <> 0 ;give it focus - does not work - yes we need to click in window as WinActivate also does NOT do it - do instantly MouseClick($MOUSE_CLICK_LEFT, $aMousePos1[0], $aMousePos1[1], 1, 0) ;speed = 100 works, 10 out of sync gives focus to clicked window MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! Do Until WinActivate($hWindow2) <> 0 ; MouseClick($MOUSE_CLICK_LEFT, $aMousePos2[0], $aMousePos2[1], 1, 0) ;yes need to click in window as WinActivate also does NOT do it - do instantly MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! Next __stop_timer("Test 5") MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 5 - ended - using handle Winactivate, MouseClick and Send") ;still very slow and in sync - try getting rid of Do-While __HomeToTop() ;move to top for both windows MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 6 - no Do-While using handle Winactivate, MouseClick and Send") ;no difference - there really shouldn't be as hardware is faster than screen __start_timer() For $i = 1 to 100 WinActivate($hWindow1) MouseClick($MOUSE_CLICK_LEFT, $aMousePos1[0], $aMousePos1[1], 1, 0) ;speed = 100 works, 10 out of sync gives focus to clicked window MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! WinActivate($hWindow2) MouseClick($MOUSE_CLICK_LEFT, $aMousePos2[0], $aMousePos2[1], 1, 0) ;yes need to click in window as WinActivate also does NOT do it - do instantly MouseWheel($MOUSE_WHEEL_DOWN, 1) ;1 click - only works where mouse cursor is !! Next __stop_timer("Test 6") MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 6 - ended - no Do-While using handle Winactivate, MouseClick and Send") ;no difference - there really shouldn't be as hardware is faster than screen __HomeToTop() ;move to top for both windows ;Perhaps my debug on is causing the problem? No same. ;Try compiling - same problems. ;Dang - what am I missing? Are the windows too slow to accept the inputs? Unlikely as I can scroll much faster with wheel mouse and arrows alone. ;Clearly this quick and dirty is not doing the trick. Do I need to wait for each window to finish scrolling to go to the next? Maybe MouseWheel is not blocking and in fact ;I'm moving too fast to the next window? ;Okay I need some help. ;Wait a second - in Win 10 you can scroll an inactive window just by hovering over it - so MouseMove alone should work (not with Send, Yes with MouseWheel ONLY if go slow again!) MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 7 - using MouseMove and MouseWheel") __start_timer() For $i = 1 to 100 MouseMove($aMousePos1[0], $aMousePos1[1], 15) ;speed 0 = instantly, not in sync = 0, 10, 15 works = 100, 20, MouseWheel($MOUSE_WHEEL_DOWN, 1) MouseMove($aMousePos2[0], $aMousePos2[1], 15) MouseWheel($MOUSE_WHEEL_DOWN, 1) Next __stop_timer("Test 7") ;if use this approach just need absolute screen coordinates - do not need window title, handle, etc. MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 7 - ended - using MouseMove and MouseWheel") __HomeToTop() ;move to top for both windows ;thought - perhaps the problem is that MouseMove is not really fast enough even at speed = 0 and after executing the MouseMove the mouse ;is still moving when MouseWheel or Send is executed so it executes on the path to the end point. This would account for the strange ;behaviour were more moves are in one window versus another as the mouse is still moving over the other window as MouseWheel or Send are executed. ;This also explains why moving very slowly works as it's over the correct window for a longer time even though not at its destination. ;Let's check this hypothesis MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 8 - waiting till at mouse location using MouseMove and MouseWheel") $r = 0 ;check count through Do loop 1 $s = 0 ;check count through Do loop 2 __start_timer() For $i = 1 to 100 Do $r = $r + 1 MouseMove($aMousePos1[0], $aMousePos1[1], 0) ;speed 0 = instantly, not in sync = 0, 10, 15 works = 100, 20, $aXY = MouseGetPos() Until ($aXY[0] = $aMousePos1[0]) AND ($aXY[1] = $aMousePos1[1]) ;loop till we're at our destination MouseWheel($MOUSE_WHEEL_DOWN, 1) Do $s = $s + 1 MouseMove($aMousePos2[0], $aMousePos2[1], 0) ;speed 0 = instantly, not in sync = 0, 10, 15 works = 100, 20, $aXY = MouseGetPos() Until ($aXY[0] = $aMousePos2[0]) AND ($aXY[1] = $aMousePos2[1]) ;loop till we're at our destination MouseWheel($MOUSE_WHEEL_DOWN, 1) Next __stop_timer("Test 8") MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 8 - MouseMove" & @CRLF & "Do loop1 count should be 100 and it's = " & $r & @CRLF & "Do loop2 count should be 100 and it's = " & $s & @CRLF) MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 8 - ended - waiting till at mouse location using MouseMove and MouseWheel") __HomeToTop() ;move to top for both windows ;interesting loop1 = 101 and loop2 = 100, another test 100,102 page 3,12 - more tests 104/100 ;plus window one is on page 3 and window two is on page 11 !!! ;What is heck is going on? ;WOW - tested on a slower machine and Do loop counts are 15422,13272 so clearly mouse not moving instantenously - but in sync ;another 15298,19471 and in sync ;another machine i5-2500S 2.7GHz count 101/102 and using Foxit reader - very much faster AND in sync - looks like Acrobat may be part of the problem ;another run 104/104 ;wait all of these are page by page ;try continuous mode - same type results ; ;SO we Definitely Need to check the position AND we should not assume using Win 10 so Click in window ;In Windows 10 scrolling over any window mouse is on is in: Settings -> Devices -> Mouse &touchpad -> Scroll inactive windows when I hover over them (ON/OFF) MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 9 - close to final version waiting till at mouse location using MouseMove and MouseWheel") $r = 0 ;check count through Do loop 1 $s = 0 ;check count through Do loop 2 __start_timer() For $i = 1 to 100 Do $r = $r + 1 MouseMove($aMousePos1[0], $aMousePos1[1], 0) ;speed 0 = instantly, not in sync = 0, 10, 15 works = 100, 20, $aXY = MouseGetPos() Until ($aXY[0] = $aMousePos1[0]) AND ($aXY[1] = $aMousePos1[1]) ;loop till we're at our destination MouseClick($MOUSE_CLICK_LEFT) ;Sleep(100) ;give it time ;putting 100 in this loop *alone* made it work **OK turn off Mouse Click Delays <- still out of sync with no Sleep **Turn OFF Debug <-- no difference ;sleep doesn't work = 1, 10, 50 ; works = 100, MouseWheel($MOUSE_WHEEL_DOWN, 1) ;Sleep(100) ;give it time ;putting 100 in this loop alone made it work Do $s = $s + 1 MouseMove($aMousePos2[0], $aMousePos2[1], 0) ;speed 0 = instantly, not in sync = 0, 10, 15 works = 100, 20, $aXY = MouseGetPos() Until ($aXY[0] = $aMousePos2[0]) AND ($aXY[1] = $aMousePos2[1]) ;loop till we're at our destination MouseClick($MOUSE_CLICK_LEFT) ;Sleep(10) ;give it time MouseWheel($MOUSE_WHEEL_DOWN, 1) ;Sleep(10) ;give it time ;Sleep(100) Next __stop_timer("Test 9") MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 9 - MouseMove" & @CRLF & "Do loop1 count should be 100 and it's = " & $r & @CRLF & "Do loop2 count should be 100 and it's = " & $s & @CRLF) MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 9 - ended - close to final version waiting till at mouse location using MouseMove and MouseWheel") __HomeToTop() ;move to top for both windows ;thought - since all the tests are working perfectly on another computer - is it possible that WiZMouse is affecting this? NO - WizMouse had no effect. MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 10 - execute MouseMove only once then waiting till at mouse location using MouseMove and MouseWheel") $r = 0 ;check count through Do loop 1 $s = 0 ;check count through Do loop 2 __start_timer() For $i = 1 to 100 ;no reason to believe MouseMove not working - just exiecute it once then wait till at location MouseMove($aMousePos1[0], $aMousePos1[1], 0) ;speed 0 = instantly, not in sync = 0, 10, 15 works = 100, 20, Do ;Sleep(10) ;10ms so do not chew up CPU - even commented out slower than Test 9!! $r = $r + 1 $aXY = MouseGetPos() Until ($aXY[0] = $aMousePos1[0]) AND ($aXY[1] = $aMousePos1[1]) ;loop till we're at our destination MouseClick($MOUSE_CLICK_LEFT) ;Sleep(100) ;give it time ;putting 100 in this loop *alone* made it work **OK turn off Mouse Click Delays <- still out of sync with no Sleep **Turn OFF Debug <-- no difference ;sleep doesn't work = 1, 10, 50 ; works = 100, MouseWheel($MOUSE_WHEEL_DOWN, 1) ;Sleep(100) ;give it time ;putting 100 in this loop alone made it work MouseMove($aMousePos2[0], $aMousePos2[1], 0) ;speed 0 = instantly, not in sync = 0, 10, 15 works = 100, 20, Do Sleep(10) ;10ms so do not chew up CPU $s = $s + 1 $aXY = MouseGetPos() Until ($aXY[0] = $aMousePos2[0]) AND ($aXY[1] = $aMousePos2[1]) ;loop till we're at our destination MouseClick($MOUSE_CLICK_LEFT) ;Sleep(10) ;give it time MouseWheel($MOUSE_WHEEL_DOWN, 1) ;Sleep(10) ;give it time ;Sleep(100) Next __stop_timer("Test 10") MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 10 - MouseMove" & @CRLF & "Do loop1 count should be 100 and it's = " & $r & @CRLF & "Do loop2 count should be 100 and it's = " & $s & @CRLF) MsgBox($MB_OK + $MB_TOPMOST, "Info", "Test 10 - ended - execute MouseMove only once then waiting till at mouse location using MouseMove and MouseWheel") __HomeToTop() ;move to top for both windows MsgBox($MB_OK + $MB_TOPMOST, "PAUSE", "Program Paused Before Exit.") Exit ;------------------------------ Functions ------------------------- Func __start_timer() $hTimer = TimerInit() EndFunc ;__start_timer() Func __stop_timer($string) MsgBox($MB_OK + $MB_TOPMOST, "Info", $string & " = " & Round(TimerDiff($hTimer)/1000, 2) & "sec") EndFunc ;__stop_timer($string) Func __homeWin1() MouseClick($MOUSE_CLICK_LEFT, $aMousePos1[0], $aMousePos1[1], 1, 0) ;absolute screen coordinates Do ;wait till we arrive at coordinates - even with this Do loop it does not always move to the top Sleep(10) ;10ms so do not chew up CPU $aXY = MouseGetPos() Until ($aXY[0] = $aMousePos1[0]) AND ($aXY[1] = $aMousePos1[1]) ;loop till we're at our destination Send("^{HOME}") ;go to top EndFunc Func __homeWin2() MouseClick($MOUSE_CLICK_LEFT, $aMousePos2[0], $aMousePos2[1], 1, 0) ;absolute screen coordinates Do ;wait till we arrive at coordinates - even with this Do loop it does not always move to the top Sleep(10) ;10ms so do not chew up CPU $aXY = MouseGetPos() Until ($aXY[0] = $aMousePos2[0]) AND ($aXY[1] = $aMousePos2[1]) ;loop till we're at our destination Send("^{HOME}") ;go to top EndFunc Func __HomeToTop() ;move to top for both windows __homeWin1() __homeWin2() EndFunc Func __Window1() ;returns $aMousePos1[0] = X, $aMousePos1[1] = Y ;window 1 Do ;loop till user clicks window and verifies it MsgBox($MB_OK + $MB_TOPMOST, "Ready", "After clicking the OK button: Go to the first window you want to scroll and click on it.") $r = 0 ;flag $hDLL = DllOpen("user32.dll") While 1 Sleep(10) ; This enough to prevent CPU overload <<<<<<<<<<<<<<<<<<<<<<<< If _IsPressed("01", $hDLL) Then ;01 Left mouse button - catch it pressed down ;window is now active as user clicked on it $aMousePos1 = MouseGetPos() ;get mouse coordinates $tWindow1 = WinGetTitle("[active]") ;more importantly get the window title so we can watch for it later $hWindow1 = WinGetHandle($tWindow1) ;get handle While _IsPressed("01", $hDLL) ;wait for button to be released Sleep(10) WEnd ExitLoop ;get out at first click EndIf WEnd DllClose($hDLL) ;be polite and close the dll handle $r = MsgBox($MB_YESNO + $MB_TOPMOST, "Question", "This is the first window title: " & @CRLF & @CRLF & $tWindow1 & @CRLF & @CRLF & "Is it correct?") Until $r = $IDYES ;loop back until user verifies correct window is selected Return($aMousePos1) EndFunc ;__Window1() ;returns $aMousePos1[0] = X, $aMousePos1[1] = Y Func __Window2() ;returns $aMousePos2[0] = X, $aMousePos2[1] = Y ;window 2 Do ;loop till user clicks window and verifies it MsgBox($MB_OK + $MB_TOPMOST, "Ready", "After clicking the OK button: Go to the second window you want to scroll and click on it.") $r = 0 ;flag $hDLL = DllOpen("user32.dll") While 1 Sleep(10) ; This enough to prevent CPU overload <<<<<<<<<<<<<<<<<<<<<<<< If _IsPressed("01", $hDLL) Then ;01 Left mouse button - catch it pressed down ;window is now active as user clicked on it $aMousePos2 = MouseGetPos() ;get mouse coordinates $tWindow2 = WinGetTitle("[active]") ;more importantly get the window title so we can watch for it later $hWindow2 = WinGetHandle($tWindow2) ;get handle While _IsPressed("01", $hDLL) ;wait for button to be released Sleep(10) WEnd ExitLoop ;get out at first click EndIf WEnd DllClose($hDLL) ;be polite and close the dll handle $r = MsgBox($MB_YESNO + $MB_TOPMOST, "Question", "This is the second window title: " & @CRLF & @CRLF & $tWindow2 & @CRLF & @CRLF & "Is it correct?") Until $r = $IDYES ;loop back until user verifies correct window is selected Return($aMousePos2) EndFunc ;__Window2() ;returns $aMousePos2[0] = X, $aMousePos2[1] = Y Func Terminate() MsgBox(0, "Info: " & @ScriptName, "Terminating progam.") Exit EndFunc ;==>Terminate
×
×
  • Create New...