Aratorin Posted October 24, 2008 Share Posted October 24, 2008 (edited) Ok, so I just started using Autoit today. I'm going through the tutorials, and I'm stuck on the second one. My script looks like this:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; 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") Send("!n")But when I run it, it gets stuck at the save dialog and won't go any further:Any idea what I'm doing wrong? I compared my script to the tutorial script, and it looks exactly the same to me. I even tried modifying "Do you want to save" to "Do you want to save changes to Untitled?", but that didn't work. If it matters, I'm running Vista Home Premium 64bit, and I've tried running the script as both x64 and x86. Edited November 4, 2008 by Aratorin Link to comment Share on other sites More sharing options...
jvanegmond Posted October 24, 2008 Share Posted October 24, 2008 Try getting the title of the window dialog using the AutoIt Window Info tool as the tutorial suggests. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Aratorin Posted October 24, 2008 Author Share Posted October 24, 2008 Try getting the title of the window dialog using the AutoIt Window Info tool as the tutorial suggests.I did that. The title of the information window is Notepad. For some reason it seems like the script is never recognizing that the info window is active. Link to comment Share on other sites More sharing options...
jvanegmond Posted October 24, 2008 Share Posted October 24, 2008 Maybe you can try this: Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text.") $InitActive = WinGetHandle("[active]") ; Gets the current active window WinClose("Untitled - Notepad") While WinGetHandle("[active]") == $InitActive ; Compare that window against the window that is active now Sleep(100) ; Do nothing while it doesn't show up WEnd WinWaitActive("Notepad", "Do you want to save") Send("!n") Maybe a little advanced, but it will fix the problem probably. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Aratorin Posted October 24, 2008 Author Share Posted October 24, 2008 I actually got it to work by changing WinWaitActive("Notepad", "Do you want to save") to WinWaitActive("Notepad"). Is there any reason autoit wouldn't be able to detect the text in the dialog box? Is this a known issue with 64 bit or Vista? Link to comment Share on other sites More sharing options...
TunaSalad Posted October 24, 2008 Share Posted October 24, 2008 (edited) In my experience with the WinXXXXX functions like WinClose, WinActivate. WinExists, etc... the TEXT parameter you can optionally pass in never worked well for me so I never use that argument, on top of the fact that most of time I need to write language independent scripts and therefore can't hardcode English (or any other language) strings. So I'd suggest you to replace the following line: WinWaitActive("Notepad", "Do you want to save") for this one WinWaitActive("Notepad") EDIT: Added code Tags Edited October 28, 2008 by TunaSalad Why crabs don't give money to charity..... because they are shell-fish!! PS: Don't be a crab and share your scripts with the community! ;-) Link to comment Share on other sites More sharing options...
Cw2K1 Posted October 24, 2008 Share Posted October 24, 2008 Please always use Code Tags while posting your codes Enjoy the complexity.Feel the power of simplicity. Link to comment Share on other sites More sharing options...
crouzilles Posted January 15, 2011 Share Posted January 15, 2011 (edited) Hi all. I know this topic is over 2 years old, but I believe any new info one comes across should always be shared. So me too I am new to AutoIt, and me too I came across this problem. But by using the "AutoIt Window Info tool", I discovered that if I click on the "Visible text" tab, I only get "&Save" "Do&n't Save" and "Cancel" options, but I don't get the phrase "Do you want to save changes to Untitled?" I believe this phrase is actually more like an image and not really text, this is why AutoIt cannot recognise it as a text element. I am very happy to be proven wrong on this of course. Yours sincerely Crouzilles Edited January 15, 2011 by crouzilles Link to comment Share on other sites More sharing options...
kylomas Posted January 15, 2011 Share Posted January 15, 2011 aratorin, just ran the code as posted and worked perfectly. WinXP SP3 kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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