Sign in to follow this  
Followers 0
Olish

Send function doesn't send any keystroke...

6 posts in this topic

#1 ·  Posted (edited)

Good morning everybody!

I just installed AutoIt v3 and I tried some sample scripts like the one that write some text in the Wordpad. But no script do this action.

I can see Notepad opening but no text is writen and Notepad is not closed.

Moreover, an icon in the systray appear but it doesn't indicate that the script is paused...

I'm speaking about the example script named notepad1.au3.

Here is the script:

;

; AutoIt Version: 3.0

; Language: English

; Platform: Win9x/NT

; Author: Jonathan Bennett (jon@hiddensoft.com)

;

; Script Function:

; Opens Notepad, types in some text and then quits.

;

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)

$answer = MsgBox(4, "AutoIt Example (English Only)", "This script will run Notepad type in some text and then quit. Run?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)

; If "No" was clicked (7) then exit the script

If $answer = 7 Then

MsgBox(0, "AutoIt", "OK. Bye!")

Exit

EndIf

; Run Notepad

Run("notepad.exe")

; Wait for the Notepad become active - it is titled "Untitled - Notepad" on English systems

WinWaitActive("Untitled - Notepad")

; Now that the Notepad window is active type some text

Send("Hello from Notepad.{ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}")

Sleep(500)

Send("+{UP 2}")

Sleep(500)

; Now quit by pressing Alt-f and then x (File menu -> Exit)

Send("!f")

Send("x")

; Now a screen will pop up and ask to save the changes, the window is called

; "Notepad" and has some text "Yes" and "No"

WinWaitActive("Notepad", "No")

Send("n")

; Now wait for Notepad to close before continuing

WinWaitClose("Untitled - Notepad")

; Finished!

Please help me. What can I do? Thank you a lot.

Olivier, from France.

Edited by Olish

Olivier, from France.Free Wake On LAN script

Share this post


Link to post
Share on other sites



You may have to change the window titles to whatever they are in french version of windows. I have tried it and it works ok with the english version.

BTW

Welcome to the best forums on the internet.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hello,

I've the same problem.

But I solv some.

I use a german OS.

Hence:

;
; AutoIt Version: 3.0
; Language:    English
; Platform:    Win9x/NT
; Author:        Jonathan Bennett (jon@hiddensoft.com)
;
; Script Function:
;   Opens Notepad, types in some text and then quits.
;


; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
$answer = MsgBox(4, "AutoIt Example (English Only)", "This script will run Notepad type in some text and then quit.  Run?")


; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
    MsgBox(0, "AutoIt", "OK.  Bye!")
    Exit
EndIf


; Run Notepad
Run("notepad.exe")


; Wait for the Notepad become active - it is titled "Untitled - Notepad" on English systems
; Wait for the Notepad become active - it is titled "Unbenannt - Notepad" on German systems
WinWaitActive("Unbenannt - Editor")


; Now that the Notepad window is active type some text
Send("Hello from Notepad.{ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}")
Sleep(500)
Send("+{UP 2}")
Sleep(500)


; Now quit by pressing Alt-f and then x (File menu -> Exit)
; Send("!f")
Send("!{F4}")
; Send("x")


; Now a screen will pop up and ask to save the changes, the window is called
; "Notepad" and has some text "Yes" and "No"
; WinWaitActive("Notepad", "No")
WinWaitActive("Editor", "Nein")
Send("!n")


; Now wait for Notepad to close before continuing
; WinWaitClose("Untitled - Notepad")
WinWaitClose("Unbenannt - Editor")


; Finished!

I've got it but this seams for me mysterious cous it is an example of AutiIt

ok first is the language ok but

Send("!n")

Send("!{F4}")

should be claer for any example.

I've started today with AutoIt3 and this is also for me clear why it doesn't work correctly.

surfer

Edited by surfer

Share this post


Link to post
Share on other sites

Do you have a file menu in the german version or is it something else.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Thank you a lot for helping me. It works good...

Olivier, form France.

Hi,

there is although a German help file in the download area.

So long, mit freundlichen Grüßen :-)

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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  
Followers 0