anybastard Posted August 24, 2011 Posted August 24, 2011 Hi guys , as usual i need your help !! I'm trying to automatize my test and to do this i want use MoveMouse function . ( for me this is the first time with this function ) I looked in on the net and i found this code Const $addWidthInPixels = 0 Const $addHeightInPixels = 0 MouseMove(Int(@DesktopWidth*.5),Int(@DesktopHeight*.5),0) MsgBox(0,"Begin Test","Press enter to begin test.") MouseMove(Int(@DesktopWidth*.38 + $addWidthInPixels),Int(@DesktopHeight*.97 +$addHeightInPixels),20) This code works fine the first mouse move function put the mouse cursor in the middle of my screen -> open -> a message box -> press ok -> and put the mouse on the task bar But i don't understand these : Int(@DesktopWidth*.5),Int(@DesktopHeight*.5) or (Int(@DesktopWidth*.38 + $addWidthInPixels),Int(@DesktopHeight*.97 +$addHeightInPixels),20) how can i know the cordinates like .5 or .38 or .97 ? is there a tool ?? Please could you explain me this or give me a link to understand this script ?? Thanks a lot Regards AnyB.
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 anybastard,Those are just simple decimal numbers which set the mouse coordinates to a certain percentage of the value. So Int(@DesktopWidth * .5) and Int(@DesktopHeight * .5) wil give you values equal to 50% (or half) of the desktop size. That is how the script gets the mouse to the centre of the screen.Int(@DesktopWidth*.38 + $addWidthInPixels) will return a value equal to 38% of the width of the desktop plus whatever value you have in the $addWidthInPixels variable - currently 0. The Int function will ensure that you get an integer return as 38% of the desktop might not be an exact integer.Similarly Int(@DesktopHeight*.97 + $addHeightInPixels) will give you a value equal to 97% of the height of the desktop plus $addHeightInPixels.You should find the mouse moving to about 1/3 of the way across the screen from the left and very nearly at the bottom. All clear? 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
anybastard Posted August 24, 2011 Author Posted August 24, 2011 Hi Melba . first for all thanks for your prompt Those are just simple decimal numbers which set the mouse coordinates to a certain percentage of the value. -> Clear So Int(@DesktopWidth * .5) and Int(@DesktopHeight * .5) wil give you values equal to 50% (or half) of the desktop size. That is how the script gets the mouse to the centre of the screen. - Clear , this mean that in any case my mouse pointer will be in middle of the screen ( screen resolution or size indipendent ) Int(@DesktopWidth*.38 + $addWidthInPixels) will return a value equal to 38% of the width of the desktop plus whatever value you have in the $addWidthInPixels variable - currently 0. The Int function will ensure that you get an integer return as 38% of the desktop might not be an exact integer. -> Clear Similarly Int(@DesktopHeight*.97 + $addHeightInPixels) will give you a value equal to 97% of the height of the desktop plus $addHeightInPixels. -> this isn't clear , becouse this mean that if i run my script on two desktops with different resolution and / or size my mouse position is different . Am I right ? Last question ...is there a workflow or tool to find this percentage ??Thanks again RegardsAnyB
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 anybastard,Int(@DesktopWidth * .38) and Int(@DesktopHeight * .97) will put your mouse in the same relative position on any resolution screen - 38% of the way across and 97% of the way down. This position will be modified if you then add the 2 contants and use Int(@DesktopWidth * .38 + $addWidthInPixels) and Int(@DesktopHeight * .97 + $addHeightInPixels). But both these constants are set to 0 in the snippet you posted and so will have no effect - I have no idea why they are there, go and look at the script from which you took the snippet. 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
anybastard Posted August 24, 2011 Author Posted August 24, 2011 (edited) Melba , Now all is clear .... thanks for that I just found a new function " MouseGetPosition" or use AutoIt windows info to find coordinates this mean that if i know screen resolution and cordinates i found the percentages . am i right? ciaoo AnyB Edited August 24, 2011 by anybastard
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 anybastard,if i know screen resolution and cordinates i found the percentagesCorrect. 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
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