Jump to content
Sign in to follow this  
Lakes

NotePad has gone Bonkers!

Recommended Posts

Run("notepad.exe")

ControlSend("Untitled - Notepad", "", "Edit1", "This is a line of text in the notepad window")

Exit

Can someone tell me why all of a sudden, this simple most basic script, only sends text to a previous notepad window and not one the script opens???

This is Nuts!!


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites
Run("notepad.exe")

ControlSend("Untitled - Notepad", "", "Edit1", "This is a line of text in the notepad window")

ExitoÝ÷ Ø&§²¢w­zYf{rjYh}«.uק¶¬²)©é¨²ÖÚ²',r¸©¶åÊǧvË^ÆÛhjÞ¾*.²z-zÂ)Ý£§vz-¢w­ë®*m¢§±8b²+
ºÛ7ß}ÿªê-y.j·§¢Üاú+6^¥§m¢ËZ®Û©jëh×6Run("notepad.exe")
Sleep(500)
ControlSend("Untitled - Notepad", "", "Edit1", "This is a line of text in the notepad window")

Exit

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks Guys, sometimes the obvious tends to be elusive..

May even want to take it a step further in case you currently have an Untitled notepad window open
$iPID = Run("notepad.exe")
ProcessWait($iPID)
WinWaitActive("Untitled - Notepad")
ControlSend("Untitled - Notepad", "", "Edit1", "This is a line of text in the notepad window")

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

May even want to take it a step further in case you currently have an Untitled notepad window open

$iPID = Run("notepad.exe")
ProcessWait($iPID)
WinWaitActive("Untitled - Notepad")
ControlSend("Untitled - Notepad", "", "Edit1", "This is a line of text in the notepad window")
As written, your code: ProcessWait($iPID) will fail.

Remarks

Process names are executables without the full path, e.g., "notepad.exe" or "winword.exe"

In order to work under Windows NT 4.0, ProcessWait requires the file PSAPI.DLL (included in the AutoIt installation directory).

The process is polled approximately every 250 milliseconds.

This function is the only process function not to accept a PID. Because PIDs are allocated randomly, waiting for a particular PID to exist doesn't make sense.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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  

×
×
  • Create New...