DippyGirl Posted July 27, 2011 Posted July 27, 2011 (edited) Hi, Just started learning AutoIt - discovered (and solved) the same issue as most noobs with the Autoit notepad tutorial - i.e. not recognising the 'do you want to save changes .... ' text - ok so followed the advice to experiment by replacing the Send() func with ControlClick but stuck again ( its like wading through treacle, this!! ) Here's my code - can anyone tell me why its not closing the dialog box as it does when i use: Send("!n") - Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text.") WinClose("Untitled - Notepad") WinWaitActive("Notepad") ;Send("!n") ControlClick("Notepad", "", "[CLASS:Button; TEXT:Do&n't Save; INSTANCE:2]") thanks Edited July 27, 2011 by DippyGirl
bogQ Posted July 27, 2011 Posted July 27, 2011 (edited) nwm dumb commentuse CLASS and INSTANCE and itl workRun("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text.") WinClose("Untitled - Notepad") WinWaitActive("[CLASS:#32770]") ;Send("!n") ControlClick("[CLASS:#32770]", "", "[CLASS:Button; INSTANCE:2]") Edited July 27, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
newbill Posted July 30, 2011 Posted July 30, 2011 I am just starting with autoit and followed the same tutorial with the same problem. I guessed that the problem was that WinWaitActive("Notepad", "Do you want to save") was not recognizing the window so I identified the class of the window, using Start Menu \ AutoIt v3 \ AutoIt Window Info as [Class:#32770] and modified the line to:- WinWaitActive("[Class:#32770]") The working script is Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text.") WinClose("Untitled - Notepad") WinWaitActive("[Class:#32770]") Send("!n") Hope this helps newbill
sleepydvdr Posted July 30, 2011 Posted July 30, 2011 One question: wouldn't the class be different for different versions of the OS? #include <ByteMe.au3>
AdmiralAlkex Posted July 30, 2011 Posted July 30, 2011 @newbill Class 32770 is a standard class and will NOT work. Take Paint as an example, it's the same quit dialog, only the title seems to be different. What happened here is very simple, the tutorial is written for WinXP (probably) and the text changed in WinVista. Just use AutoIt Window Info to get the actual text on your OS. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
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