Jump to content

Notepad tutorial problems.


 Share

Recommended Posts

I did a bit of searching before posting and didn't find anything relevant to *my* situation so, here goes.

CODE
Run("notepad.exe")

WinActive("Untitled - Notepad")

Send("Hello, Michael. How are you today?")

WinClose("Untitled - Notepad")

;WinWaitActive("Notepad", "&Save")

WinWaitActive("Notepad")

Send("!n")

Specifically, I cannot use WinWaitActive with &Save as text, because on my installation of Windows XP SP2, I get only &Yes, &No, or Cancel as alternative text. That is why I just default to "Notepad." Anyway...

The code above appears to execute just fine, but then my keyboard is toast. Everything I touch (as in keys) appears to do something odd. Actually, not odd at all... it simulates the CTRL key and I cannot "unstick" it. So after running the above code, if I hit ESC for example, my Start menu pops open (CTRL+ESC is the same as hitting the Windows key). If I hit the "d" key it inserts the current date into the editor I'm using. And so on and so on...

So what is going on and how can I fix my keyboard after running the above? I've thought of a couple other things to try, but didn't feel like rebooting my computer right this moment so I went on to other things that needed fixing.

Link to comment
Share on other sites

"ControlSetText or ControlSend might solve your problem"

Thanks. That affirms what I thought might solve the problem. I'll try it at next boot (here in 5 minutes) and post back.

I think your keyboard layout is messed up.

How exactly? Specifically, what makes you think it is screwed and what might fix it?

I installed/enabled Unicode support for Asian languages about a year ago and haven't actually had any problems stem from this until AutoIt. Could this be the culprit and if so, again, how might I solve it?

Thanks for the quick replies!

Edited by fowmow
Link to comment
Share on other sites

Welcome to the forum.

We may need to change that tutorial to something like this:

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

In your first post you have:

Run("notepad.exe")

WinActive("Untitled - Notepad")

Send("Hello, Michael. How are you today?")

.....

I can only hope that this is a typo and not what you attempted to run. The "WinActive line" of code is not what you want for the second line. If it is a typo, remember to copy/paste code to the forum to show us exactly what is running.

If the code in your original post (OP) is what you ran, then some - if not all - of the text in the "Send line" of code could have been sent to some other window or the desktop before notepad appeared. I have no clue why your Ctrl keys seems to be stuck down since this script does not use that key, but I have had scripts do this and the work around is to repeatly press the Ctrl and/or Alt key after the script exits. [if I could find a script that causes this to always happen, I would report the issue in the forum.]

Welcome again,

-MSP-

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Welcome to the forum.

Thank you.

I can only hope that this is a typo and not what you attempted to run. The "WinActive line" of code is not what you want for the second line. If it is a typo, remember to copy/paste code to the forum to show us exactly what is running.

Oh dear, it seems as I went back and forth from creating a syntax and auto-complete file for EditPlus (my editor of choice) I accidentally used WinActive instead of WinWaitActive.

That solved the problem in itself!

If the code in your original post (OP) is what you ran, then some - if not all - of the text in the "Send line" of code could have been sent to some other window or the desktop before notepad appeared. I have no clue why your Ctrl keys seems to be stuck down since this script does not use that key, but I have had scripts do this and the work around is to repeatly press the Ctrl and/or Alt key after the script exits. [if I could find a script that causes this to always happen, I would report the issue in the forum.]

Noted for the future... juse in case. :)

Many thanks for the assistance and the welcome, herewasplato.

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