Sign in to follow this  
Followers 0
holzfelix

send enter

18 posts in this topic

hello

i am trying to improve connecting to an von network

runwait("Rasphone.exe -d HTWG")
Sleep(3000)
Send("{Enter}")

the vpn panel opens but the send enter dosn't work

why?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

hello

i am trying to improve connecting to an von network

runwait("Rasphone.exe -d HTWG")
Sleep(3000)
Send("{Enter}")

the vpn panel opens but the send enter dosn't work

why?

Under scite there is a menu bar called Tools if you downloaded the full version of scite4autoit.

Click Tools > Au3Info and try getting information on the control and use ControlSend/Controlclick to do what you need.

Edited by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

thank you i've tried it but dosn't work at all ...

why isn't it possible to only send enter... if i open the panel with

runwait("Rasphone.exe -d HTWG")

and the press manually enter on my keyboard it works fine ... whats the differens between manually and send("{Enter}")

Share this post


Link to post
Share on other sites

Actually there is no difference. The matter is that if you have to do it by software your program needs a handle of the control/window in which it has to send the enter keystroke.

So, to me, it sounds like you haven't used au3infocorrectly. Post the code of your ControlSend code to see if we can understand something from that.


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

AutoItSetOption("WinTitleMatchMode", 2)
AutoItSetOption("MouseCoordMode", 0)
runwait("Rasphone.exe -d HTWG")
Sleep(3000)
ControlSend("Verbindung mit 'HTWG' herstellen","","{Enter}");

that was my code i tryed with

Share this post


Link to post
Share on other sites

Try to read the remarks in the help file for ControlSend and see if you got any of the things listed in there that can cause a conflict.

http://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm

Other I can think of is, by checking the help file, try instead of putting "Verbindung mit 'HTWG' herstellen", the class of the window, in a format like help file shows [CLASS: xxxx] (listed in Au3Info as Class:)

Sorry, nothing else I can think of


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

AutoItSetOption("WinTitleMatchMode", 2)
run("Rasphone.exe -d HTWG")
WinActivate("Verbindung mit 'HTWG' herstellen")
;Send("{ENTER}")
ControlClick("Verbindung mit 'HTWG' herstellen","","CLASSNN:Button4")

dosn't work ...

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

So you tried with clicks huh?

Try this one:

;===============================================================================
; Function Name:  _MouseClickPlus()
; Version added:  0.1
; Description:    Sends a click to window, not entirely accurate, but works
;                 minimized.
; Parameter(s):   $Window     =  Title of the window to send click to
;                 $Button     =  "left" or "right" mouse button
;                 $X          =  X coordinate
;                 $Y          =  Y coordinate
;                 $Clicks     =  Number of clicks to send
; Remarks:        You MUST be in "MouseCoordMode" 0 to use this without bugs.
; Author(s):      Insolence <insolence_9@yahoo.com>
;===============================================================================
Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1)

    Local $MK_LBUTTON = 0x0001
    Local $WM_LBUTTONDOWN = 0x0201
    Local $WM_LBUTTONUP = 0x0202
    Local $MK_RBUTTON = 0x0002
    Local $WM_RBUTTONDOWN = 0x0204
    Local $WM_RBUTTONUP = 0x0205
    Local $WM_MOUSEMOVE = 0x0200

    Local $i = 0

    Select
        Case $Button = "left"
            $Button = $MK_LBUTTON
            $ButtonDown = $WM_LBUTTONDOWN
            $ButtonUp = $WM_LBUTTONUP
        Case $Button = "right"
            $Button = $MK_RBUTTON
            $ButtonDown = $WM_RBUTTONDOWN
            $ButtonUp = $WM_RBUTTONUP
    EndSelect

    If $X = "" Or $Y = "" Then
        $MouseCoord = MouseGetPos()
        $X = $MouseCoord[0]
        $Y = $MouseCoord[1]
    EndIf

    For $i = 1 To $Clicks
        DllCall("user32.dll", "int", "SendMessage", _
                "hwnd", WinGetHandle($Window), _
                "int", $WM_MOUSEMOVE, _
                "int", 0, _
                "long", _MakeLong($X, $Y))

        DllCall("user32.dll", "int", "SendMessage", _
                "hwnd", WinGetHandle($Window), _
                "int", $ButtonDown, _
                "int", $Button, _
                "long", _MakeLong($X, $Y))

        DllCall("user32.dll", "int", "SendMessage", _
                "hwnd", WinGetHandle($Window), _
                "int", $ButtonUp, _
                "int", $Button, _
                "long", _MakeLong($X, $Y))
    Next
EndFunc   ;==>_MouseClickPlus

Func _MakeLong($LoWord, $HiWord)
    Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc   ;==>_MakeLong

It's written by a guy called Insolence and it worked wonders for me! It's like an advanced mouseclick function, maybe it'll do the work for you.

Edited by Newb

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

RunWait() - Runs an external program and pauses script execution until the program finishes.

So any code after the RunWait line doesn't get run until..

Try it with Run() instead.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Gawsh, if it's really that, i'll smash my head on the desk ;)


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

I tryed run but thats not the result^^

AutoItSetOption("WinTitleMatchMode", 2)
run("Rasphone.exe -d HTWG")
WinActivate("Verbindung mit 'HTWG' herstellen")
;Send("{ENTER}")
ControlClick("Verbindung mit 'HTWG' herstellen","","CLASSNN:Button4

nobody could help me?

Share this post


Link to post
Share on other sites

Hey i had a same problem with some Send() commands...

Are you using Win 7 ??

I solved my problem with that:

#RequireAdmin

When you give your script admin rights it may work.

Tell me if it worked for you too.

Share this post


Link to post
Share on other sites

great idea but dosn't fix the problem

is this correct:

ControlClick("Verbindung mit 'HTWG' herstellen","","CLASSNN:Button4")

is that such a special problem?

Share this post


Link to post
Share on other sites

Does this work?

AutoItSetOption("WinTitleMatchMode", 2)
Run("Rasphone.exe -d HTWG")
WinWaitActive("Verbindung mit 'HTWG' herstellen")
Send("{ENTER}")

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

i've already tried this ... sorry no dosn't work ...

don't understand it ...

Share this post


Link to post
Share on other sites

I don't know if it's different on the German version of Windows, or if it's different in Windows 7, but in Win7 using the English version there's no quotes around the connection name. So, maybe it should be "Verbindung mit HTWG herstellen" for the window title.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Ok I tried it myself with this:

AutoItSetOption("WinTitleMatchMode", 2)
Run("Rasphone.exe -d VPN-Verbindung")
WinWaitActive('Verbindung mit "VPN-Verbindung" herstellen')
Send("{ENTER}")

I changed the ' and " in the WinWaitActive() command.

the rest worked for me fine.

1 person likes this

Share this post


Link to post
Share on other sites

Great ;)

now it works i nee a sleep between the starting the rasphone.exe and activate the window + changing ' in "

thanks a lot :)

AutoItSetOption("WinTitleMatchMode", 2)

run("Rasphone.exe -d HTWG")
Sleep(2000)
WinActivate('Verbindung mit "HTWG" herstellen')
Send("{ENTER}")

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