Jump to content
Sign in to follow this  
sinafoye

Send() not working in npad example

Recommended Posts

sinafoye

I was trying out the tutorial script npad, which was working great, except the final line of code Send("!n") does not work. The message box comes up, but the yes button is highlighted and it just hangs there. I have noticed there is an icon on the taskbar, and when I right click on it, it shows the script is paused. Can anyone tell me what I have done wrong? I wasn't able to find anything in the help on pausing or unpausing a script - Thanks!

Share this post


Link to post
Share on other sites
Helge

Well, what language is your OS ? If it's non-English you will have to modify it to the corresponding titles

and text. Regarding the pause-issue, the script isn't paused before you actually click the tray-icon, so

there's nothing wrong there.

Share this post


Link to post
Share on other sites
sinafoye

Well, what language is your OS ? If it's non-English you will have to modify it to the corresponding titles

and text. Regarding the pause-issue, the script isn't paused before you actually click the tray-icon, so

there's nothing wrong there.

I am using Windows XP Pro - English. This is a complete copy of the code I typed:

Run ("notepad.exe")

WinWaitActive ("Untitled - Notepad")

Send ("This is some text")

Winclose ("Untitled - Notepad")

WinWaitActive ("Notepad", "The text in the Unititled file has changed")

Send("!n")

The code just before the last Send executes beautifully. Any ideas what I am doing wrong?

Share this post


Link to post
Share on other sites
_Kurt

Perhaps adding a small sleep before the "!n" ?


Awaiting Diablo III..

Share this post


Link to post
Share on other sites
sinafoye

Perhaps adding a small sleep before the "!n" ?

I'm sorry to sound so dense, but what do you mean? Or was that a haha?

Share this post


Link to post
Share on other sites
_Kurt

I'm sorry to sound so dense, but what do you mean? Or was that a haha?

Of course it wasn't a haha. I just ment that perhaps the script requires a short sleep (as in a "wait") before it presses ALT+N, so like this:

Run ("notepad.exe")
WinWaitActive ("Untitled - Notepad")
Send ("This is some text")
Winclose ("Untitled - Notepad")
WinWaitActive ("Notepad", "The text in the Untitled file has changed")
Sleep(250)
Send("!n")

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites
Jos

It is exact sience:

you have:

WinWaitActive ("Notepad", "The text in the Unititled file has changed")

should be

WinWaitActive ("Notepad", "The text in the Untitled file has changed")


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                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
Helge

Unititled ? How about Untitled instead ? :)

WinWaitActive ("Notepad", "The text in the Untitled file has changed")

If you copied that script directly from the helpfile without modifying it then you might have a old version

of AutoIt installed, where this typo hadn't been fixed.

Share this post


Link to post
Share on other sites
sinafoye

Of course it wasn't a haha. I just ment that perhaps the script requires a short sleep (as in a "wait") before it presses ALT+N, so like this:

Run ("notepad.exe")
WinWaitActive ("Untitled - Notepad")
Send ("This is some text")
Winclose ("Untitled - Notepad")
WinWaitActive ("Notepad", "The text in the Untitled file has changed")
Sleep(250)
Send("!n")

Kurt

Sorry, I didn't know there was a sleep command. Anyway, I inserted that command and it is still doing the same thing. By the way, why does the script add an icon to the tray and not remove it when the script finishes (which it may not be doing?)

Share this post


Link to post
Share on other sites
sinafoye

Thanks everyone. I didn't notice the typo. Once I corrected it, it ran beautifully. Is there any place where I can get more sample code to help me learn the commands? Thanks again!

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.