kjcdude Posted November 26, 2007 Share Posted November 26, 2007 (edited) I need a simplified version to connect to a local password protected server. Here's how i do it currently, but the problem is that it requires mouse movements and opening windows. WinWait("Program Manager","FolderView") If Not WinActive("Program Manager","FolderView") Then WinActivate("Program Manager","FolderView") WinWaitActive("Program Manager","FolderView") MouseClick("left",42,16,2) WinWait("My Computer","FolderView") If Not WinActive("My Computer","FolderView") Then WinActivate("My Computer","FolderView") WinWaitActive("My Computer","FolderView") MouseMove(189,101) MouseDown("left") MouseUp("left") Send("\\server00{ENTER}") WinWait("Connect to server00","&User name:") If Not WinActive("Connect to server00","&User name:") Then WinActivate("Connect to server00","&User name:") WinWaitActive("Connect to server00","&User name:") Send("install{TAB}6789{ENTER}") sleep(5000) winclose("server00","") Thanks Edited November 26, 2007 by kjcdude Link to comment Share on other sites More sharing options...
ptrex Posted November 26, 2007 Share Posted November 26, 2007 (edited) @kcjdude A better way to do this is to use a VNC as application or if it is Windows 2000 or higher use RDP. expandcollapse popup#include <GUIConstants.au3> $width = 1024 $height = 768 $oRDP = ObjCreate("MsTscAx.MsTscAx") $GUI = GUICreate("Embedded RDP control Test", $width+20, $height+20, 0, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $GUIActiveX = GUICtrlCreateObj($oRDP, 10, 10, $width, $height) GUICtrlSetResizing ($GUIActiveX,$GUI_DOCKAUTO) GUISetState() ; connect to the server. if this is not done first, the child controls are not rendered. ; which is a problem, because we have to change their styles to prevent clipping $oRDP.Server = "SERVERNAME" $oRDP.Domain = "DOMAIN" $oRDP.UserName = "USER" $oRDP.Connect() ; Determine the class name of the ATL control - it seems to be random from system to system Opt("WinTitleMatchMode", 4) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Opt("WinSearchChildren", 1) ;0=no, 1=search children also $sATLClass = "" $aClasses = StringSplit(WinGetClassList($GUI,""),@LF) For $i = 1 To $aClasses[0] If StringLeft($aClasses[$i],4) = "ATL:" Then $sATLClass = $aClasses[$i] ExitLoop EndIf Next ; get the handles to the controls that must have their styles modified $hUIContainerClass = ControlGetHandle($GUI, "", "[CLASS:UIContainerClass]") $hUIMainClass = ControlGetHandle($GUI, "", "[CLASS:UIMainClass]") $hATL = ControlGetHandle($GUI, "", "[CLASS:"&$sATLClass&"]") ConsoleWrite("$hUIContainerClass (should not be 0 or blank):" & $hUIContainerClass & @crlf) ConsoleWrite("$hUIMainClass (should not be 0 or blank):" & $hUIMainClass & @crlf) ConsoleWrite("$hATL (should not be 0 or blank):" & $hATL & @crlf) ; modify the styles of the child controls to match those set by the offical client application ; this prevents clipping problems - though, I don't know why Const $WS_EX_NOPARENTNOTIFY = 0x4 Const $WS_EX_NOINHERITLAYOUT = 0x100000 $hUIContainerClassStyle = BitOR($WS_CHILD, $WS_CLIPCHILDREN, $WS_CLIPSIBLINGS, $WS_VISIBLE) ; 0x56000000 $hUIContainerClassStyleEx = BitOR($WS_EX_NOINHERITLAYOUT, $WS_EX_NOPARENTNOTIFY) ; 0x00100004 $hUIMainClassStyle = BitOR($WS_CHILD, $WS_CLIPCHILDREN, $WS_CLIPSIBLINGS, $WS_SYSMENU, $WS_VISIBLE) ; 0x56080000 $hUIMainClassStyleEx = 0x0 $hATLStyle = BitOR($WS_CHILD, $WS_CLIPCHILDREN, $WS_CLIPSIBLINGS, $WS_VISIBLE) ; 0x56000000 $hATLStyleEx = 0x0 $guiStyle = BitOR($WS_BORDER, $WS_CAPTION, $WS_CLIPCHILDREN, $WS_CLIPSIBLINGS, $WS_DLGFRAME, $WS_GROUP, $WS_MAXIMIZE, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_TABSTOP, $WS_THICKFRAME, $WS_VISIBLE) ; 0x17CF0100 $guiStyleEx = $WS_EX_WINDOWEDGE ; 0x00000100 _SetStyle($hUIContainerClass,$hUIContainerClassStyle,$hUIContainerClassStyleEx) _SetStyle($hUIMainClass,$hUIMainClassStyle,$hUIMainClassStyleEx) _SetStyle($hATL,$hATLStyle,$hATLStyleEx) _SetStyle($gui,$guiStyle,$guiStyleEx) Func _SetStyle($hwnd,$style,$exstyle) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hwnd, "int", -16, "long", $style) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hwnd, "int", -20, "long", $exstyle) EndFunc ; $WS_EX_NOPARENTNOTIFY and $WS_EX_NOINHERITLAYOUT seem to be fairly important ; This may still be important for other projects with similar problems. AdlibEnable ( "checkconn", 1000) Func checkconn() If $oRDP.Connected = 0 Then Exit EndIf EndFunc While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() Exit regards, ptrex Edited November 26, 2007 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New 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