phearme Posted July 10, 2009 Share Posted July 10, 2009 Hi I'm trying to find out how to modify the coordinates of my script so it would work on any resolution. Lets say the resolution the script I made only works for 1440 x 900 resolution, but the other computer's native resolution is 1680 x 1050. The script has over 500 different coordinates and the only way I could think of to make it compatible with different resolutions was to make an equation that automatically figures out what to multiply the coordinates by, however that would involve me have to manually edit all coordinates to include the variable: MouseMove(32,636)becomes MouseMove(32*$z,636*$Z) Is there a less tedious way to implement this into the script or an advance version of the Replace tool that can automatically replace all MouseMove(##,###) to MouseMove(##*$z,###*$Z). Link to comment Share on other sites More sharing options...
martin Posted July 10, 2009 Share Posted July 10, 2009 Hi I'm trying to find out how to modify the coordinates of my script so it would work on any resolution. Lets say the resolution the script I made only works for 1440 x 900 resolution, but the other computer's native resolution is 1680 x 1050. The script has over 500 different coordinates and the only way I could think of to make it compatible with different resolutions was to make an equation that automatically figures out what to multiply the coordinates by, however that would involve me have to manually edit all coordinates to include the variable: MouseMove(32,636)becomes MouseMove(32*$z,636*$Z) Is there a less tedious way to implement this into the script or an advance version of the Replace tool that can automatically replace all MouseMove(##,###) to MouseMove(##*$z,###*$Z). Write a small function to do what you want and then replace all MouseMove commands with the name of that function. MyMouseMove($x,$y); for the 1440 x 900 screen Func MyMouseMove($x,$y) MouseMove(@DesktpWidth*$x/1440,@DesktopHeight * $y/900) EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
z0mgItsJohn Posted July 10, 2009 Share Posted July 10, 2009 I was going to suggest the above way before he posted xD.. but ill go ahead and post a little script that can process your script and change the cords... Source : #Include <File.Au3> $iFile = 'Test.au3' $iNewFile = @ScriptDir & '\Edit.Au3' If FileExists ($iNewFile) Then FileDelete ($iNewFile) $iStringToAdd_1 = '*$Z'; I.E. MouseMove (XX*$Z,XX) $iStringToAdd_2 = '*$Z'; I.E. MouseMove (XX,XX*$Z) For $A = '1' To _FileCountLines ($iFile) $Line = FileReadLine ($iFile, $A) If StringLeft ($Line, '9') = 'MouseMove' Then $iSplit = StringSplit ($Line, ',') $1 = StringSplit ($iSplit['1'], '(') $2 = StringSplit ($iSplit['2'], ')') $iString = StringReplace ($Line, '(' & $1['2'] & ',','(' & $1['2'] & $iStringToAdd_1 & ',') $iString = StringReplace ($iString, ',' & $2['1'] & ')',',' & $2['1'] & $iStringToAdd_2 & ')') FileWriteLine ($iNewFile, $iString) Else FileWriteLine ($iNewFile, $Line) EndIf Next Even tho the above post is a better, I wanted to show you a different way.. Hope this helps! - John Latest Projects :- New & Improved TCP Chat 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