Sign in to follow this  
Followers 0
DippyGirl

notepad.exe tutorial

5 posts in this topic

#1 ·  Posted (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 by DippyGirl

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

nwm dumb comment

use CLASS and INSTANCE and itl work

Run("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 by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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.

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

One question: wouldn't the class be different for different versions of the OS?


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0