abdulrahmanok Posted September 17, 2020 Share Posted September 17, 2020 (edited) Hi brothers, Im trying to make an application to send (down) key when press (f5), but the problem is that 'AcrobatSDIWindow' randomly change its Class INSTANCE Value So this is my Simple try to deal with that, while i think there must be better to get adobe INSTANCE Value expandcollapse popup;#include<Myfuncs.au3> HotKeySet('{F5}', "Send2") HotKeySet('{F6}', "Send3") HotKeySet('{ESC}', "_EXIT") For $i =17 to 100 $test=ControlSend('[CLASS:AcrobatSDIWindow]','','[CLASS:AVL_AVView; INSTANCE:' & $i & ']',"{Down}") ; print($i & ':' & $test) If $test=1 Then $True_INSTANCE= $i ExitLoop EndIf Next MsgBox(0,'$True_INSTANCE',$True_INSTANCE) Global $True_INSTANCE While 1 Sleep(3000) WEnd Func Send2() ; ControlClick('[CLASS:AcrobatSDIWindow]','','ScrollBar2','left',1,10, 581) ;~ Sleep(400) $test=ControlSend('[CLASS:AcrobatSDIWindow]','','[CLASS:AVL_AVView; INSTANCE:' & $True_INSTANCE & ']',"{Down}") ;Sleep(50) ;ControlSend('[CLASS:AcrobatSDIWindow]','','[CLASS:AVL_AVView; INSTANCE:17]',"{Down}") ;~ Next EndFunc Func Send3() ;ControlSend('[CLASS:AcrobatSDIWindow]','','[CLASS:AVL_AVView; INSTANCE:17]',"{UP}") ;ControlClick('[CLASS:AcrobatSDIWindow]','','ScrollBar2','left',1,9, 9) ;~ For $1=0 to 3 $test=ControlSend('[CLASS:AcrobatSDIWindow]','','[CLASS:AVL_AVView; INSTANCE:' & $True_INSTANCE & ']',"{UP}") ;Sleep(50) ; ControlSend('[CLASS:AcrobatSDIWindow]','','[CLASS:AVL_AVView; INSTANCE:17]',"{UP}") ;~ Next EndFunc Func _EXIT() EXIT EndFunc >>>> Window <<<< Title: _.pdf - Adobe Acrobat Pro Class: AcrobatSDIWindow Position: -8, -8 Size: 1382, 744 Style: 0x17CF0000 ExStyle: 0x00000100 Handle: 0x0000000000231F6C >>>> Control <<<< Class: AVL_AVView Instance: 17 ClassnameNN: AVL_AVView17 Name: Advanced (Class): [CLASS:AVL_AVView; INSTANCE:17] ID: Text: AVPageView Position: 42, 75 Size: 1307, 611 Solved By:Nine Edited September 19, 2020 by abdulrahmanok Link to comment Share on other sites More sharing options...
abdulrahmanok Posted September 19, 2020 Author Share Posted September 19, 2020 (edited) I didnt think my issue is that difficault! Edited September 19, 2020 by abdulrahmanok Link to comment Share on other sites More sharing options...
Nine Posted September 19, 2020 Share Posted September 19, 2020 Look at RegExpClass option, that may be the thing you are looking for ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
abdulrahmanok Posted September 19, 2020 Author Share Posted September 19, 2020 Im not sure how this could help, Im already using control click, but the issue is that I want to get control click for Mid page so it can respond to (down) and (up) keys.. but when restart pdf the true value of Mid page which is: $i $test=ControlSend('[CLASS:AcrobatSDIWindow]','','[CLASS:AVL_AVView; INSTANCE:' & $i & ']',"{Down}") Keep changing so it sends (down) and (up) keys to wrong control which make no sense... hope everything clear now. Link to comment Share on other sites More sharing options...
Nine Posted September 19, 2020 Share Posted September 19, 2020 Please do not use large font like you had, you should know by now it is not very pleasant to get shout at. My understanding is the you need to find the control handle of a control that changes instance all the time. Now you are testing every possible instance until you find one. By using something like this, it would streamline your code : Local $hWnd = WinGetHandle("[CLASS:AcrobatSDIWindow]") ConsoleWrite ($hWnd & @CRLF) WinActivate($hWnd) WinWaitActive($hWnd) Local $hCtrl = ControlGetHandle ($hWnd,"","[REGEXPCLASS:AVL_AVView.*]") ConsoleWrite ($hCtrl & @CRLF) ControlSend ($hWnd, "", $hCtrl, "{DOWN 4}") Add some error handling and you are set to go. (Tested on Win7) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
abdulrahmanok Posted September 19, 2020 Author Share Posted September 19, 2020 Thanks Bro, Firstly I didnt want to shout or something what is the point of shouting on someone who trying to help you?! I just used it becasue my screen is too small so I feel better with large font. And I will try your mentioned code now Link to comment Share on other sites More sharing options...
Nine Posted September 19, 2020 Share Posted September 19, 2020 You know, you can Zoom in if need be. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
abdulrahmanok Posted September 19, 2020 Author Share Posted September 19, 2020 still not that combfortable to zoom and keep replying, but i will did that anyway while I could be misunderstood Nine 1 Link to comment Share on other sites More sharing options...
abdulrahmanok Posted September 19, 2020 Author Share Posted September 19, 2020 20 minutes ago, Nine said: Please do not use large font like you had, you should know by now it is not very pleasant to get shout at. My understanding is the you need to find the control handle of a control that changes instance all the time. Now you are testing every possible instance until you find one. By using something like this, it would streamline your code : Local $hWnd = WinGetHandle("[CLASS:AcrobatSDIWindow]") ConsoleWrite ($hWnd & @CRLF) WinActivate($hWnd) WinWaitActive($hWnd) Local $hCtrl = ControlGetHandle ($hWnd,"","[REGEXPCLASS:AVL_AVView.*]") ConsoleWrite ($hCtrl & @CRLF) ControlSend ($hWnd, "", $hCtrl, "{DOWN 4}") Add some error handling and you are set to go. (Tested on Win7) Its working only when Pdf window is active, is there is anyway to make it work while inactive window? This is another try to get true control using the size and XY postion: For $i =17 to 200 $test=ControlSend('[CLASS:AcrobatSDIWindow]','','[CLASS:AVL_AVView; INSTANCE:' & $i & ']',"{Down}") print($i & ':' & $test) If $test=1 Then $True_INSTANCE= $i $aPos=ControlGetPos ( '[CLASS:AcrobatSDIWindow]', "", '[CLASS:AVL_AVView; INSTANCE:' & $i & ']' ) Global $X= $aPos[0] ,$Y=$aPos[1], $SizeX=$aPos[2], $SizeY=$aPos[3] If $X>=63 And $Y>=84 And $SizeX=0 And $SizeY>=584 Then ExitLoop MsgBox( 0,$True_INSTANCE, "Position: " & $aPos[0] & ", " & $aPos[1] & @CRLF & "Size: " & $aPos[2] & ", " & $aPos[3]) ;ClipPut($aPos[0] & ", " & $aPos[1] & @CRLF & "Size: " & $aPos[2] & ", " & $aPos[3]) ;63, 84 ;Size: 0, 584 else $test=0 EndIf EndIf Next Link to comment Share on other sites More sharing options...
Nine Posted September 19, 2020 Share Posted September 19, 2020 Ok, I was thinking that RegExp was on CLASSNN, but it is not, it is on Class only. So my error, but if you use the TEXT, it seems to be working : Local $hWnd = WinGetHandle("[CLASS:AcrobatSDIWindow]") ConsoleWrite ($hWnd & @CRLF) Local $hCtrl = ControlGetHandle ($hWnd,"","[CLASS:AVL_AVView;TEXT:AVPageView]") ConsoleWrite ($hCtrl & @CRLF) ControlSend ($hWnd, "", $hCtrl, "{DOWN 4}") abdulrahmanok 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
abdulrahmanok Posted September 19, 2020 Author Share Posted September 19, 2020 Finally It works perfectly now, but can I ask you...Where did you get 'TEXT:AVPageView' value? Local $hCtrl = ControlGetHandle ($hWnd,"","[CLASS:AVL_AVView;TEXT:AVPageView]") Link to comment Share on other sites More sharing options...
Nine Posted September 19, 2020 Share Posted September 19, 2020 AutoIt info tool. Your OP shows it “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
abdulrahmanok Posted September 19, 2020 Author Share Posted September 19, 2020 Now I understand it Thanks for help Brother Link to comment Share on other sites More sharing options...
Nine Posted September 19, 2020 Share Posted September 19, 2020 I am not your brother (unless you know something I don't), but I am glad I helped you out. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
abdulrahmanok Posted September 20, 2020 Author Share Posted September 20, 2020 I know 😄 that's metaphor, it's something to say to someone telling him that now i feel you like my brother Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now