David Moen Posted December 9, 2004 Report Share Posted December 9, 2004 I don't seem to be able to get the Mouse Click on Control to work with the Advanced - Other X: and Y: Coordinates set. The Center of Control option works. If need to click some place other than the center of the control I use the Mouse Move command relative to the Control and then the Mouse Left Button. Anything I'm doing wrong or is this a bug? Quote Link to comment Share on other sites More sharing options...
joe Posted December 10, 2004 Report Share Posted December 10, 2004 Welcome to the forum! Unless something has changed very recently, using an offset X/Y works just fine. Are you sure the coordinates being used are relative to the control? Quote Link to comment Share on other sites More sharing options...
David Moen Posted December 10, 2004 Author Report Share Posted December 10, 2004 Yes, I'm using Coordinates that work with the mouse move relative to control. The same coordinates do not work with the Mouse Click on Control command. I've tried this on may occasions and sometimes get the same problem. Maybe I doing something wrong, but I don't thing so. There have been times this has worked but not all the time. Could it be the program I'm trying to automate will not allow it to work? Quote Link to comment Share on other sites More sharing options...
joe Posted December 10, 2004 Report Share Posted December 10, 2004 There must be something else going on, especially if it works some of the time. Have you taken into account that offsets are calculated from the control's upper-left corner, and not the center? ... I'm sure you have because they are the same coordinate system as the Mouse Move command, which you say works. Does the Mouse Move command (then click) work all the time? Or does it only work part of the time? Another thought. Macro Express can work faster than your computer's peripherals. Sometimes a macro can zoom ahead of expected events. Does the macro work more reliably if you slow it way down? Quote Link to comment Share on other sites More sharing options...
David Moen Posted December 13, 2004 Author Report Share Posted December 13, 2004 The Mouse move and click works all the time. Even when the mouse click on control doesn't. I would prefer the mouse click on control command because it doesn't mess up if the user moves the mouse during the macro. Slowing down does not seem to help. The problem occurs mostly when there is a window with a few buttons in it and the buttons can not be captured using the get control method. The window appears to be the only control that can be captured. So I capture the window and move the mouse in relation to the control and mouse click on the button and that works. The mouse click on control at the same coordinates does not. One other time this happened to me was a window that had a place to double click on and it opened an edit box that allowed a value to be altered. Once that edit box was open it became a control that had an index number that changed each time that it was double clicked on. The capture contol using text was not an option because the text was what needed to be changed. This may never work for me but I thought I'd ask. Otherwise, I think macro express is the best thing that has ever happened to Windows! Quote Link to comment Share on other sites More sharing options...
kevin Posted December 13, 2004 Report Share Posted December 13, 2004 Perhaps your comment: The mouse click on control at the same coordinates does not provides a clue. The Mouse Move Relative to Window commands are relative to the entire window, including the title bar at the top. Most times when I have worked with a program where the entire window was a control, the control did not include the title bar. Could this be what is happening with the application you are working with? Quote Link to comment Share on other sites More sharing options...
David Moen Posted December 14, 2004 Author Report Share Posted December 14, 2004 I subtracted the height of the title bar from the Y coordinate and the mouse click on control worked. This presents another problem. Based on the users windows settings the title bar height changes. Thanks, David M. Quote Link to comment Share on other sites More sharing options...
David Moen Posted December 14, 2004 Author Report Share Posted December 14, 2004 The button I need to click on is in a window that can be resized by the user. When the window is resized the button moves. Although, it does stay in the same place in relation to the bottom right corner. So I figured out how to many pixels from the bottom right corner it is and then I can subtract those numbers from the Width and Height of the control. my macro looks like this: Get Control %C1% Variable Set Interger %N1% from Control %C1% Width Variable Set Interger %N2% from Control %C1% Height //Subtract distance of button from right side Variable Modify Interger: %N1%=%N1%-170 //Subtract distance of button from bottom Variable Modify Interger: %N2%=%N1%-60 //X=%N1% Y=%N2% Mouse Single Left Click on Control %C1% But it doesn't work unless I subtract an additional 25 from %N2% to make up for the height of the title bar. You may notice I was not measuring the width and height of the window, but rather the Control. Therefore, I should not need to subtract the height of the title bar. The following macro works without subtracting 25 from %N2%: Get Control %C1% Variable Set Interger %N1% from Control %C1% Width Variable Set Interger %N2% from Control %C1% Height //Subtract distance of button from right side Variable Modify Interger: %N1%=%N1%-170 //Subtract distance of button from bottom Variable Modify Interger: %N2%=%N1%-60 //X=%N1% Y=%N2% Mouse Move to Control %C1%: %N1%, %N2% Mouse Left Button Click This seems like a bug! I'm doing all of the commands in relation to the Control %C1% and I'm getting different results. Quote Link to comment Share on other sites More sharing options...
IceBox Posted December 20, 2004 Report Share Posted December 20, 2004 First of all, line 7 of your script says "Variable Modify Interger: %N2%=%N1%-60" I think it should say "%N2%=%N2%-60". That could be your problem. Otherwise... just a suggestion... I have been working with different offices within my company from around the country, and the title bar is ALWAYS an issue. I have implemented a simple rule at every office. All users MUST set their desktops to the "Windows Standard" scheme. If they want to play with their desktops, and use pretty colors, they can do that at home, not at work. I know that's not the answer you are looking for, and there probably is a good workaround that will take into account for the window title height, but it certainly is the easiest solution we have found. But, hopefully switching the variables, as I said above, will help with your problem. Quote Link to comment Share on other sites More sharing options...
David Moen Posted January 4, 2005 Author Report Share Posted January 4, 2005 I think it should say "%N2%=%N2%-60". That could be your problem. You're right. I had it right in my macro but when I typed it up for the forum I typed it incorrectly. There should be a feature to measure the height of the title bar so that the macros can take that into account. To handle this in the past I've installed a little program that I launch hidden anytime that I need to make sure the title bar size hasn't changed. This program's window size can not be changed. I know the height of the window and title bar and I know the height of the window without the title bar. The macro always checks the window's (with the title bar) height, if on another computer the user changes the title bar size, I have the macro factor in the difference in the title bar size so that the clicks happen in the correct places. Quote Link to comment Share on other sites More sharing options...
joe Posted January 4, 2005 Report Share Posted January 4, 2005 Hello David! I read that you cannot change the height of your window, but I was not sure if you meant physically or something else. So ... One small trick that we have used in the past to get the height of a titlebar is to: Activate the window Store its current height Set the window height to zero Store the new height (which will only be the titlebar) Restore the window to its original height from step 2. This works with most windows and is super fast. Activate or Launch: "Notepad" OR "notepad.exe" Variable Set Integer %N1% from Width of Window Variable Set Integer %N2% from Height of Window Window Resize: Current Win - (Width: %N1%, Height: 0) Variable Set Integer %N3% from Height of Window Window Resize: Current Win - (Width: %N1%, Height: %N2%) <LAUNCHYES3:0:0112Notepad<LAUNCH:notepad.exe><IVAR2:01:09:><IVAR2:02:10:><WSIZE:001N,00000"CURRENT"><IVAR2:03:10:><WSIZE:001N,002N"CURRENT"> Quote Link to comment Share on other sites More sharing options...
David Moen Posted January 6, 2005 Author Report Share Posted January 6, 2005 Thanks that is a good way to get the title bar height. It is too bad there is not a function like "Variable Set Integer to title bar height". That would solve the problem. Thanks again for your help. David Moen Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.