Jump to content

Using AutoIt with Windows 7 pro


removed
 Share

Recommended Posts

I just downloaded and installed AutoIt v3.3.8.1.

I am running it on a Windows 7 Pro 64 bit system.

Wonderful document you put together for the newbie!

I am using the wonderful tutorial posted under - Learning to To Script with AutoIt V3.

I am having trouble with the second example, the notepad automation.

It will open notepad just fine, but does not send the text to notepad.

Any ideas on how to make it work in Windows 7?

Here is my code (from the tutorial):

Run("notepad.exe")
WinActive("Untitled - Notepad")
SendKeepActive("Untitled - Notepad", "This is some text.")

Link to comment
Share on other sites

Either change WinActive to WinWaitActive (so the script waits until the window is active) or check the window title of Notepad - maybe the title has changed with Windows 7.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I am also on Win 7 64 bit.  I think you are using "sendkeepactive" by accident.  Try "send" as in the help file to actually send the text.

Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("This is some text.")

The sendkeepactive function is just to keep the window open during send ... not to send text.

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to comment
Share on other sites

and use

WinWaitActive("[CLASS:Notepad]")

Otherwise, non English systems will wait forever
In German locale e.g., the title is "Unbenannt - Editor"
 
This code runs perfectly on my German machine

Run("notepad")
WinActivate("[CLASS:Notepad]")
WinWaitActive("[CLASS:Notepad]")
SendKeepActive("[CLASS:Notepad]")
Send("This is some text.")
Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

Thanks to everyone who responded!

It is now working, the revised code is:

Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
Send("This is some text.")

I have 2 follow on questions:

1) Why does SendKeepActive not work?

2) While this works, I get aUser Account Control popup where I have to click on "Yes" to proceed. Any ideas on how to avoid the UAC popup?

Link to comment
Share on other sites

Please refer to my earlier post as to why SendKeepActive does not work.  That is not the intended use of that function.  It is also not what is in the tutorial example you were trying to follow.  You accidentally used the wrong function.  Perhaps you were using Scite and it auto-completed the command for you and you?  Either way, please read the help file.  It explains what each function does.

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

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