Jump to content
Sign in to follow this  
trebliG

Sending ALT-n not working in Notepad Tutorial

Recommended Posts

trebliG

When I followed the Notepad tutorial (from Online Documentation), the last line Send ("!n") to execute or click the Don't Save button does not work. An AutoIt icon appears below the screen showing "Script Paused" is all I get when I run the npad.au3 tutorial program and the Notepad dialog does not get dismissed. I am using Vista Business.

Share this post


Link to post
Share on other sites
Authenticity

Opt('WinTitleMatchMode', 4)
Run('Notepad.exe')
WinWaitActive('Untitled')

Send('keys')
Sleep(1000)
WinClose('Untitled')
WinWaitActive('[REGEXPTITLE:^Notepad$]')
Send('!n')

Try this sample.

You need to suspend the script according to an expected event because otherwise it won't find the correct window this send is intended for and thus may sleep infinitely or pause because it's waiting for a specific window.

Share this post


Link to post
Share on other sites
trebliG

Opt('WinTitleMatchMode', 4)
Run('Notepad.exe')
WinWaitActive('Untitled')

Send('keys')
Sleep(1000)
WinClose('Untitled')
WinWaitActive('[REGEXPTITLE:^Notepad$]')
Send('!n')

Try this sample.

You need to suspend the script according to an expected event because otherwise it won't find the correct window this send is intended for and thus may sleep infinitely or pause because it's waiting for a specific window.

Thanks Authenticity!

I just replaced the WinWaitActive statement with the one you suggested and it works!!!

hmmm... I wonder if they would make a change to the documentation so new users won't run into the same problem I encountered!?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.