Jump to content

Sending ALT-n not working in Notepad Tutorial


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...