holzfelix Posted April 7, 2012 Share Posted April 7, 2012 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? Link to comment Share on other sites More sharing options...
Skitty Posted April 7, 2012 Share Posted April 7, 2012 (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 April 7, 2012 by ApudAngelorum Link to comment Share on other sites More sharing options...
holzfelix Posted April 7, 2012 Author Share Posted April 7, 2012 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 More sharing options...
Newb Posted April 7, 2012 Share Posted April 7, 2012 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 More sharing options...
holzfelix Posted April 8, 2012 Author Share Posted April 8, 2012 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 Link to comment Share on other sites More sharing options...
Newb Posted April 8, 2012 Share Posted April 8, 2012 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.htmOther 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 More sharing options...
holzfelix Posted April 8, 2012 Author Share Posted April 8, 2012 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 ... Link to comment Share on other sites More sharing options...
Newb Posted April 8, 2012 Share Posted April 8, 2012 (edited) So you tried with clicks huh? Try this one: expandcollapse popup;=============================================================================== ; 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 April 8, 2012 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 More sharing options...
somdcomputerguy Posted April 8, 2012 Share Posted April 8, 2012 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. Link to comment Share on other sites More sharing options...
Newb Posted April 8, 2012 Share Posted April 8, 2012 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 More sharing options...
holzfelix Posted April 9, 2012 Author Share Posted April 9, 2012 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? Link to comment Share on other sites More sharing options...
Apfelkiller Posted April 9, 2012 Share Posted April 9, 2012 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. Link to comment Share on other sites More sharing options...
holzfelix Posted April 9, 2012 Author Share Posted April 9, 2012 great idea but dosn't fix the problem is this correct: ControlClick("Verbindung mit 'HTWG' herstellen","","CLASSNN:Button4") is that such a special problem? Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 9, 2012 Share Posted April 9, 2012 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. Link to comment Share on other sites More sharing options...
holzfelix Posted April 9, 2012 Author Share Posted April 9, 2012 i've already tried this ... sorry no dosn't work ... don't understand it ... Link to comment Share on other sites More sharing options...
BrewManNH Posted April 9, 2012 Share Posted April 9, 2012 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 GudeHow 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 More sharing options...
Apfelkiller Posted April 9, 2012 Share Posted April 9, 2012 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. holzfelix 1 Link to comment Share on other sites More sharing options...
holzfelix Posted April 9, 2012 Author Share Posted April 9, 2012 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}") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now