mbhansen Posted October 16, 2009 Share 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 Link to comment Share on other sites More sharing options...
jebus495 Posted October 17, 2009 Share 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]) Link to comment Share on other sites More sharing options...
mbhansen Posted October 19, 2009 Author Share 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 Link to comment Share on other sites More sharing options...
jebus495 Posted October 19, 2009 Share Posted October 19, 2009 You add it to the code after it's recorded? Link to comment Share on other sites More sharing options...
mbhansen Posted October 23, 2009 Author Share Posted October 23, 2009 That doesn't solve the problem of different resolutions... Link to comment Share on other sites More sharing options...
followgeo Posted April 3, 2010 Share Posted April 3, 2010 The forum search gods have worked again! Thank you for this post. Just saved me huge headaches. =) 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