Jump to content

send enter


Recommended Posts

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
Link to comment
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}")

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

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.

Link to comment
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.

Link to comment
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

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