Salo Posted July 9, 2016 Share Posted July 9, 2016 (edited) I am trying to make a simple click function. The client is resizable(though often widescreen), while the actual clickable area is fullscreen(4:3). I want to make mouseclicks able to be done in %, but I can't figure out a formula to allow the window to be any size while still being able to achieve successful clicks in the locations I need I currently have something like this $Title = WinGetHandle("Untitled") Dim $Size = WinGetClientSize($Title) Dim $Pos = WinGetPos($Title) $Pos[1] = $Pos[1] + 25 Dim $Offset = ($Size[0] - (($Size[1]-25)*(4/3)))/2 $Size[0] = $Size[0]-($Offset*2) MsgBox(1,"asd",$Offset & " || " & $Size[0] & " || " & $Size[1] & " || " & $Pos[0] & " || " & $Pos[1]) MouseClick("Left", $Pos[0]+$Offset+(0.70*$Size[0]), $Pos[1]+(0.17*$Size[1])) Offset being the empty white bar you'd get on each side, I attempted to add the offset to the relative X position of the window, to get the start of the playable area for horizontal. Relative Y position, +25 for titlebar, for Y. The code I have here is pretty close but it doesn't quite do it. It ends up being a dozen pixels off or so when i start stretching it a good chunk. I need it to be pretty precise(not necessarily perfect) as I want to use some pixelsearch and whatnot as well, but a couple dozen pixels is too much. The border window of the window is causing some issues in the formula, but I don't want to remove it if possible. I would like help in refining or remaking this formula to function more accurately. Edited July 9, 2016 by Salo Link to comment Share on other sites More sharing options...
AutoBert Posted July 9, 2016 Share Posted July 9, 2016 Mostly are better solutions possibele than a MouseClick. So tell the app, that we can give you a better Support. Link to comment Share on other sites More sharing options...
Salo Posted July 9, 2016 Author Share Posted July 9, 2016 It doesn't really matter what program. Any program that has a fixed aspect ratio inside a re-sizable window. I wanted it to work for something like a media player originally but I want it to be versatile for other applications as well, so I don't want to use controlclick. Link to comment Share on other sites More sharing options...
AutoBert Posted July 9, 2016 Share Posted July 9, 2016 (edited) The way you trie to automatize is veeery dirty, for better way name the app or upgrade your math skills. Edited July 9, 2016 by AutoBert Link to comment Share on other sites More sharing options...
Salo Posted July 10, 2016 Author Share Posted July 10, 2016 media player.. Link to comment Share on other sites More sharing options...
AutoBert Posted July 10, 2016 Share Posted July 10, 2016 Have a look on https://www.autoitscript.com/wiki/User_Defined_Functions#Players Link to comment Share on other sites More sharing options...
Salo Posted July 10, 2016 Author Share Posted July 10, 2016 I don't think this is going to help me. I want the formula I explained to work as intended. And I don't need controls, as I already said before. I need to compare a wide variety of players across various systems, and I am using the formula to coordinate exact pixel locations so I can use pixelscans. I would like to compare the visual quality of compressions and different versions of videos and things of that nature. I would also like to use the same formula for hopefully other applications in the future. All I need is the formula refined. Can you do it or not? Link to comment Share on other sites More sharing options...
AutoBert Posted July 12, 2016 Share Posted July 12, 2016 (edited) so as i already said, On 9.7.2016 at 7:25 PM, AutoBert said: Mostly are better solutions possibele than a MouseClick. and the UDF's i linked iare the best possible usable solutions for a media player automation. I must repeat me: On 9.7.2016 at 10:19 PM, AutoBert said: The way you trie to automatize is veeery dirty, for better way name the app or upgrade your math skills. i am out or fhis thread. Have luck by finding a solution. Edited July 12, 2016 by AutoBert Link to comment Share on other sites More sharing options...
Salo Posted July 13, 2016 Author Share Posted July 13, 2016 I already told you what apps I wanted it for, media players. I already told you those UDFs don't help. They do not provide a universal solution to my issue. Link to comment Share on other sites More sharing options...
SadBunny Posted July 13, 2016 Share Posted July 13, 2016 6 hours ago, Salo said: I already told you what apps I wanted it for, media players. Yes, but you were lying. 6 hours ago, Salo said: I already told you those UDFs don't help. They do not provide a universal solution to my issue. That is because they are just a response to your reformulated question, which was not to your actual question as stated in the original unedited version of your opening post Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Salo Posted July 13, 2016 Author Share Posted July 13, 2016 So what's the worst my "lying" code is for? hacking the nsa? Just nevermind, I already got someone to help me with a simple formula. Too much effort to get help from this forum. Link to comment Share on other sites More sharing options...
SadBunny Posted July 13, 2016 Share Posted July 13, 2016 (edited) 21 minutes ago, Salo said: So what's the worst my "lying" code is for? hacking the nsa? Nothing bad, just some game. (I happened to read that opening post before you edited it ) Now, I don't care about automating games, but this forum does for some reason (/edit: well, cares about discussing it at least), so I and many others just don't respond to these questions and let the mods deal with it. What I personally do care about is people repeatedly lying about their intentions to mislead people into giving you what you want for free. In my book, that's worse than just breaking some subject matter rule on some forum. So when I see that happen I call it out. That's all. Have a good day. Edited July 13, 2016 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Salo Posted July 13, 2016 Author Share Posted July 13, 2016 Yes, I originally wrote game because I thought it would require less to explain than saying I wanted it for a media player. People ask so many questions for something so simple. Either way, I don't care if you believe that it's really for a game or really for a media player. I have no reputation to protect, and I don't need anything now. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 13, 2016 Moderators Share Posted July 13, 2016 Salo, The "Game" word is like a red rag to a bull here - please read the Forum rules before you post again so that you are aware of what is and is not allowed here. Thread closed. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts