Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Convert Positions between Resolutions


  • Please log in to reply
2 replies to this topic
Sanctus
  • Members
  • 283 posts
  • Last active: Dec 06 2014 04:05 PM
  • Joined: 30 Nov 2012

Version: 1.00 (22.03.2014)

 

Here is a simple script to convert any x and y positions in one resolution to a new resolution.

 

Positions are 99% the time correct.

 

Features Added:

  • Saves last used resolutions
  • Popups the info
  • Copy the x & y pos
#SingleInstance force
myGui("x860 y400", "Position Converter")

myGui(position, title)
{
	static wo,wn,ho,hn,x,y
	IniRead, swo, conpos.ini, old, wo
	IniRead, sho, conpos.ini, old, ho
	IniRead, swn, conpos.ini, new, wn
	IniRead, shn, conpos.ini, new, hn
	gui, new
	gui, Default
	;gui, Color, 00ABA9
	gui, +LastFound +LabelMyGui
	gui, add, groupbox, w200 h180, Position Converter
	gui, font, s8, Arial
	gui, add, text, xm12 ym20 section, Set the Original and New Resolution
	gui, add, text, yp+17.5 center, Then add the position to convert
	gui, add, Edit, xp+45 yp+20 w50 vwo, %swo%
	gui, add, Edit, xp+65 yp w50 vho, %sho%
	gui, add, text, yp+5 xp-110, Old Res:
	gui, add, text, yp xp+100, x
	gui, add, Edit, xp-55 yp+20 w50 vwn, %swn%
	gui, add, Edit, xp+65 yp w50 vhn, %shn%
	gui, add, text, yp+5 xp-115, New Res:
	gui, add, text, yp xp+105, x
	gui, add, text, xp-105 yp+25, Pos X:
	gui, add, Edit, xp+35 yp-5 w50 vx
	gui, add, text, xp+55 yp+5, Pos Y:
	gui, add, Edit, xp+35 yp-5 w50 vy
	gui, add, button,xp-65 yp+30 gDone, OK
	gui, add, button, xp+30  gmyguiclose, Cancel
	gui, show, % position, % title
	return

	Done:
	{
	gui,submit,nohide
	IniWrite, %wo%, conpos.ini, old, wo
	IniWrite, %ho%, conpos.ini, old, ho
	IniWrite, %wn%, conpos.ini, new, wn
	IniWrite, %hn%, conpos.ini, new, hn
	NewX := % Round(x / (wo / wn))
	NewY := % Round(y / (ho / hn))
	gui, new
	gui, Default
	gui, +LastFound +LabelMyGui -SysMenu
	gui, add, groupbox, w205 h230, New Position
	gui, font, s12, Arial
	gui, add, text, xm12 ym20 section, Old Pos X: 
	gui, add, text, xp+110 yp, %x%
	gui, add, text, xp-110 yp+15, Old Pos Y: 
	gui, add, text, xp+110 yp, %y%
	gui, add, text, xp-110 yp+15, New Pos X: 
	gui, add, text, xp+110 yp, %NewX%
	gui, add, text, xp-110 yp+15, New Pos Y: 
	gui, add, text, xp+110 yp, %NewY%
	gui, font, s8, Arial
	gui, add, button, xp-80 yp+17.5 w120 h30 gClip, Copy New X and Y
	gui, font, s10, Arial
	gui, add, button, xp+45 yp+35 gOK, OK
	gui, add, text, xp-65 yp+35, careful add x + 4 and y + 15
	gui, add, text, xp-10 yp+20, If converting for windowed mode
	gui, font, s10, Verdana
	gui, add, text, yp+30 xp, Version: 1.00 (22.03.2014)
	gui, show,, Position for new Resolution
	return
	}
	myguiclose:
	{
	ExitApp
	return
	}
	Clip:
	{
	Clipboard = %NewX% %NewY%
	return
	}
	OK:
	{
	gui,submit,nohide
	gui, destroy
	return
	}
}

F8::ExitApp

As always, let me know if anything goes wrong, ideas and suggestions are welcome.


Check out ALL My Scripts  ;)


ToTheMax
  • Members
  • 51 posts
  • Last active: May 30 2015 09:57 AM
  • Joined: 08 Sep 2013

Wow this is really usefull actually.

Well done!



Sanctus
  • Members
  • 283 posts
  • Last active: Dec 06 2014 04:05 PM
  • Joined: 30 Nov 2012

Thank you, just did a revision on my position script,

Added 3 buttons for speeding up coding

If you want your scripts to work in any resolution check it out ;)

 

http://www.autohotke...nates-at-mouse/


Check out ALL My Scripts  ;)