mbhansen Posted October 16, 2009 Posted October 16, 2009 Greetings, I am testing out AutoIt and would like to 'duplicate' the following script using the a recorder. ; Script Start - Add your code below here Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text.") WinClose("Untitled - Notepad") WinWaitActive("Notepad", "Do you want to save") ControlClick("Notepad", "Do you want to save", 6) WinWaitActive("Save As", "") ControlSetText("Save As", "", 1148, "test.txt") ControlClick("Save As", "", "[TEXT:&Save]") ; WinWaitActive("Save As", "Do you want to replace") If WinWaitActive("Save As", "Do you want to replace", 1) Then ControlClick("Save As", "Do you want to replace", "[TEXT:&Yes]") EndIf I've tried both the Au3Recorder and the MacroGenerator. The Au3Recorder works fine, but it uses x,y coordinates for mouse clicks and this will break down on other users computers or even if the Notepad window opens in a different location. I understand the MacroGenerator uses control names rather than x,y coordinates, but it seems to get confused by the Start | Run action. Is there a configuration/option for the Au3Recorder to support control names? As a newbie am I missing something with the MacroGenerator? Thanks, Matt
jebus495 Posted October 17, 2009 Posted October 17, 2009 What do you mean by confused? As for the x and y thing you could always add WinGetPos() to the coordinates as a variable so that it clicks the right spot regardless of the windows position. Or you could add a WinMove() early in the script so that it's always in the right spot. Example of the first thing: $offset = WinGetPos("Untitled - Notepad") MouseClick("left", 300 + $offset[0], 300 + $offset[1])
mbhansen Posted October 19, 2009 Author Posted October 19, 2009 When I use the MacroGenerator the result script stalls at the first step; when I record Start Menu <click> | Run <click>. It never clicks the 'Run' box. Same computer, same resolution, etc. If I add a "WinMove" then how do I actually record the script? Make sure mouse is in the same location everytime I hit record? With any coordinates, what happens when I run the script on a computer with different resolution? It seems to me the Recorder should record Window title and ControlId or ControlClassNN, not x, y coordinates. Thanks, Matt
mbhansen Posted October 23, 2009 Author Posted October 23, 2009 That doesn't solve the problem of different resolutions...
followgeo Posted April 3, 2010 Posted April 3, 2010 The forum search gods have worked again! Thank you for this post. Just saved me huge headaches. =)
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