jannikrendl Posted April 19, 2017 Share Posted April 19, 2017 (edited) Hey, so I was trying to create a script which clicks an option of a dropdown menu but can't find a solution to move the mouse from the current position 50 units down... If someone knows how to do this pls help me [EDIT: MBY the solution is to just use MouseGetPos and then use MouseMove(MouseGetPos[0],MouseGetPos[1]+50)? but idk... mby there is a better solution... Global $aPos = MouseGetPos Sleep(10000) MouseMove($aPos[0],$aPos[1]+50,10) ] Edit 2: NOPE Isn't working... Thanks in advance Jannik Edited April 19, 2017 by jannikrendl Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 19, 2017 Moderators Share Posted April 19, 2017 You're asking for help with a dropdown menu, without stating what kind of menu it is, which makes it more than a little difficult to make suggestions. Is it a desktop app or website? Which app/site is it? How about a screenshot of the dropdown menu? The more you give us the more we can give you "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jannikrendl Posted April 19, 2017 Author Share Posted April 19, 2017 (edited) @JLogan3o13 This is the dropdown menu. I would like to automate the process of changing the properties by clicking at the file / move the mouse (by myself) to the the file and then simply start the script so it is able to change the file's properties... Edited April 19, 2017 by jannikrendl Link to comment Share on other sites More sharing options...
snoopy.pa30 Posted April 19, 2017 Share Posted April 19, 2017 Can you use : Send("{Down 20}") to move the cursor/selection down 20 times? put whatever number if lines/menu items in you need instead of the 20. jannikrendl 1 Snoopy=====Still trying to shoot down that Red Baron :-)) Link to comment Share on other sites More sharing options...
jannikrendl Posted April 19, 2017 Author Share Posted April 19, 2017 (edited) @snoopy.pa30 Thanks, it works. But I would like to know how It is done by the mouse so I can use it for other scripts in the future... EDIT: I used @snoopy.pa30 idea but I still need the Mousemovement because I need to tick the read only tickbox. Edited April 19, 2017 by jannikrendl Link to comment Share on other sites More sharing options...
snoopy.pa30 Posted April 19, 2017 Share Posted April 19, 2017 In my (limited) experience with AutoIT, I either use the SEND, or get the actual pixel location of what I have to click on. I assume you know how to get the pixel location using AutoIT Window Info and Finder Tool. Sorry I can't suggest anything better. Snoopy=====Still trying to shoot down that Red Baron :-)) Link to comment Share on other sites More sharing options...
jannikrendl Posted April 19, 2017 Author Share Posted April 19, 2017 @snoopy.pa30 Yes I know how to find the coordinates but it is changing because of the location of the files, etc... Link to comment Share on other sites More sharing options...
snoopy.pa30 Posted April 19, 2017 Share Posted April 19, 2017 In many windows boxes you can use the TAB key to move between input fields. So you might be back to the SEND("{TAB 5}") idea. jannikrendl 1 Snoopy=====Still trying to shoot down that Red Baron :-)) Link to comment Share on other sites More sharing options...
jannikrendl Posted April 19, 2017 Author Share Posted April 19, 2017 (edited) @snoopy.pa30 Yes this will work But I am still wondering how I could do it with the mouse... Edited April 19, 2017 by jannikrendl Link to comment Share on other sites More sharing options...
snoopy.pa30 Posted April 19, 2017 Share Posted April 19, 2017 Sometimes I like to solve the problem elegantly. More often I need to solve it quickly. That is when the BFI methods come in to play. BFI - Brute Force and Ignorance. "Git er Done" jannikrendl 1 Snoopy=====Still trying to shoot down that Red Baron :-)) Link to comment Share on other sites More sharing options...
jannikrendl Posted April 19, 2017 Author Share Posted April 19, 2017 @snoopy.pa30 I wasted some time in research so I would like to get a result thats why I still would like to know how to do the process with the mouse... Link to comment Share on other sites More sharing options...
junkew Posted April 19, 2017 Share Posted April 19, 2017 The generic answer is in faq 31. Finding the actual element gives much more stable result then mouse or keystrokes. However moving relative is possible with sendinput function of win32 api or deprecated mouse_event. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
jannikrendl Posted April 19, 2017 Author Share Posted April 19, 2017 @junkew So a possible solution would be: #include <WinAPI.au3> ;~~~~~~~~~~~~~~~~~~~~ _WinAPI_Mouse_Event() ;How to use it? ;~~~~~~~~~~~~~~~~~~~~ MouseMove($iX,$iY,10) Sleep(100) MouseClick("LEFT") Link to comment Share on other sites More sharing options...
junkew Posted April 19, 2017 Share Posted April 19, 2017 google broken? not sure if you have to deal with twips func example() _mousemove(10,10) EndFunc Func _MouseMove ($iX, $iY) Local $dX = $iX ;~ $iX*(65535.0/(@DesktopWidth-1)) Local $dY = $iY ;~ $iY*(65535.0/(@DesktopHeight-1)) _WinAPI_Mouse_Event($MOUSEEVENTF_MOVE,$dX, $dY) ;~ DllCall ("user32.dll", "int", "mouse_event", "int", $MOUSEEVENTF_MOVE, "int", $dX, "int", $dY, "int", 0, "int", 0) EndFunc FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
jannikrendl Posted April 20, 2017 Author Share Posted April 20, 2017 @junkew NVM I used the suggested way by @snoopy.pa30. Thanks again 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