Jump to content

4:3 window in a resizable window - conversion formula


Recommended Posts

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 by Salo
Link to comment
Share on other sites

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

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

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 by AutoBert
Link to comment
Share on other sites

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

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 by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

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

  • Moderators

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

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...