Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

RDP Session In AutoIT Gui

rdp gui embed

  • Please log in to reply
12 replies to this topic

#1 goss34

goss34

    Wayfarer

  • Active Members
  • Pip
  • 57 posts

Posted 22 September 2011 - 07:23 AM

Hi Guys,

I have been scouring the forums but cant find what i want so i am hoping someone can help me out by pointing me in the right direction or starting me off with how to build the script from scratch.

What i want to be able to achieve is:
  • Have the script hunt for a machine that is available from a group of say 4 (how it will know its available i dont know?)
  • When a free machine is found launch an RDP session within the autoit window (scaling the window to fit in the GUI)
First off is this possible?


Second, can someone help me get started?

Thanks
Dan







#2 goss34

goss34

    Wayfarer

  • Active Members
  • Pip
  • 57 posts

Posted 30 September 2011 - 05:45 PM

Can anyone help with this? :graduated:

#3 UEZ

UEZ

    Never say never

  • MVPs
  • 4,814 posts

Posted 30 September 2011 - 07:45 PM

Try this uncomplete version:

AutoIt         
#include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3>   $host = "" ;<<<<<<< enter here the host name or ip address ;Remote Desktop ActiveX Control Interfaces -> <a href='http://msdn.microsoft.com/en-us/library/aa383022(v=VS.85' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsoft.com/en-us/library/aa383022(v=VS.85</a>).aspx $hGUI = GUICreate("RDP Embedded Sessions", 952, 675, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $oRDP = ObjCreate("MsTscAx.MsTscAx.2") ;<a href='http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85</a>).aspx $oRDP_Ctrl = GUICtrlCreateObj($oRDP, 64, 44, 800, 600) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE) $oRDP.DesktopWidth = 800 $oRDP.DesktopHeight = 600 $oRDP.Fullscreen = False $oRDP.ColorDepth = 16 $oRDP.AdvancedSettings3.SmartSizing = True $oRDP.Server = $host $oRDP.UserName = "" ;<<<<<<< enter here the user name $oRDP.Domain = "" $oRDP.AdvancedSettings2.ClearTextPassword = "" $oRDP.ConnectingText = "Connecting to " & $host $oRDP.DisconnectedText = "Disconnected from " & $host $oRDP.StartConnected = True $oRDP.Connect()   GUISetState(@SW_SHOW, $hGUI) ;~ ConsoleWrite($oRDP.GetErrorDescription() & @CRLF) While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             $oRDP.Disconnect()             Exit     EndSwitch WEnd


It will open a RDP session embedded in the GUI.

Br,
UEZ

Edited by UEZ, 30 September 2011 - 08:56 PM.

  • Jfish, JLogan3o13 and pilot like this

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#4 pilot

pilot

    Seeker

  • Active Members
  • 5 posts

Posted 14 April 2012 - 03:01 PM

Thanks UEZ.

Exactly the one I'm searching for. The above script works as expected. But it only runs when I run this script from SciTE4AutoIt3 editor.

After I build this script as exe, that exe fails to connect that system. It just hangs and displays a message 'Connecting to 172.16.0.160'. I didn't modify this script expect the following lines.

$host = "172.16.0.160"
$oRDP.UserName = "administrator"

Exe should be perfectly same as the script. I'm just wondering how it works like a charm when I run from the editor but the exe hangs to connect.

Any Help is appreciated. If you need any more information to help me please let me know.

Thanks in advance for your help.

Attached Thumbnails

  • rdp.JPG

Edited by pilot, 14 April 2012 - 03:06 PM.


#5 ByteSniper

ByteSniper

    Seeker

  • New Members
  • 1 posts

Posted 16 August 2012 - 01:01 PM

Thankd UEZ
I've added some change to the original.
you need to create an ini file RDP_QC.ini in the same location as the au3 or exe file.


[Serveurs]
Server1 = Server1
Server2 = Server2
Server3 = Server3

enjoy !


#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>


Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$hGUI = GUICreate("Form1", 1401, 801, 193, 115)
GUISetOnEvent($GUI_EVENT_CLOSE, "hGUIClose")

$Connect = GUICtrlCreateButton("Connect", 1272, 16, 115, 33, 0)
GUICtrlSetOnEvent(-1, "ConnectClick")
$Password = GUICtrlCreateInput("", 1272, 200, 115, 23, $ES_PASSWORD)
GUICtrlSetOnEvent(-1, "ConnectClick")
$oRDP = ObjCreate("MsTscAx.MsTscAx.2") ;http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85).aspx
$oRDP_Ctrl = GUICtrlCreateObj($oRDP, 4, 4, 1232, 792)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE)
GUICtrlSetStyle($oRDP_Ctrl , $WS_EX_STATICEDGE)
$oRDP.DesktopWidth = 1240
$oRDP.DesktopHeight = 800
$oRDP.Fullscreen = False
$oRDP.ColorDepth = 16
$oRDP.AdvancedSettings3.SmartSizing = True


$serveur = GUICtrlCreateCombo("", 1272, 50, 120, 23)
GUICtrlSetData(-1, "", "")
GUICtrlSetFont(-1, 9, 800, 0, "Courier new")
GUICtrlSetOnEvent(-1, "ConnectClick")

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Call("Load_srv")
While 1
Sleep(100)
WEnd
Func ConnectClick()
$host = GUICtrlRead($serveur,1) ;<<<<<<< enter here the host name or ip address
if $host <> "" Then
$oRDP.Server = $host
$oRDP.UserName = "" ;<<<<<<< enter here the user name
$oRDP.Domain = ""
$oRDP.AdvancedSettings2.ClearTextPassword = GUICtrlRead($Password)
$oRDP.ConnectingText = "Connecting to " & $host
$oRDP.DisconnectedText = "Disconnected from " & $host
$oRDP.StartConnected = True
$oRDP.connect()
endIf
EndFunc

func Load_srv()
$var = IniReadSection(@ScriptDir & "\RDP_QC.ini","Serveurs")
For $i = 1 To $var[0][0]
;~ MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1])
GUICtrlSetData($serveur,$var[$i][1])
Next
endFunc

Func hGUIClose()
exit
EndFunc

#6 ravi88

ravi88

    Seeker

  • Normal Members
  • 4 posts

Posted 31 January 2013 - 09:27 AM

Hi referring to the above scripts plss guide me how to execute tasks on the remote system for e.g. taking a basic task as running calc.exe...it would be of grrt help :rambo:

#7 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 16,850 posts

Posted 31 January 2013 - 10:53 AM

Please don't resurrect old threads, especially when you just want to learn something that can be found via the help file. My suggestion, read the help file as this will be a great source of help.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 20/07/2014


#8 ravi88

ravi88

    Seeker

  • Normal Members
  • 4 posts

Posted 31 January 2013 - 11:20 AM

sorry :'( but i have timing constraint...i just wanted to have minimum guidance o:)

Edited by ravi88, 31 January 2013 - 11:22 AM.


#9 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 16,850 posts

Posted 31 January 2013 - 11:31 AM

I can give you guidance, what I can't do is speed up the process of you learning it. The help file is a great place to start, trust me. If you have little time, then perhaps an alternative source would be an option?

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 20/07/2014


#10 ravi88

ravi88

    Seeker

  • Normal Members
  • 4 posts

Posted 31 January 2013 - 12:10 PM

thnx :pirate:

#11 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 16,850 posts

Posted 31 January 2013 - 12:17 PM

You're welcome. Good luck.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 20/07/2014


#12 Benchozer

Benchozer

    Seeker

  • Normal Members
  • 1 posts

Posted 16 July 2014 - 06:49 AM

Hi everybody,

 

I need to resize the "Rdp embedded sessions" in order to resize $oRDP in the same size without borders

 

Anybody can help me ?

Thanks

 

I have the following code :

Plain Text         
#include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> $host = "" ;<<<<<<< enter here the host name or ip address $hGUI = GUICreate("Terminal server", 900, 700, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME)) $oRDP = ObjCreate("MsTscAx.MsTscAx.2") $oRDP_Ctrl = GUICtrlCreateObj($oRDP, 0, 0, 900, 700) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE) s$oRDP.DesktopWidth = 900 $oRDP.DesktopHeight = 700 $oRDP.Fullscreen = False $oRDP.ColorDepth = 16 $oRDP.AdvancedSettings3.SmartSizing = True $oRDP.Server = $host $oRDP.UserName = "" ;<<<<<<< enter here the user name $oRDP.Domain = "" $oRDP.AdvancedSettings2.ClearTextPassword = "" $oRDP.ConnectingText = "Connecting to " & $host $oRDP.DisconnectedText = "Disconnected from " & $host $oRDP.StartConnected = True $oRDP.Connect() GUISetState(@SW_SHOW, $hGUI) $oShel = ObjCreate("shell.application") $oShel_Ctrl = GUICtrlCreateObj($oShel, 0, 0, 900, 700) GUICtrlSetStyle($oShel_Ctrl , $WS_VISIBLE) Send("#r") Send ("C:\Program Files (x86)\scripts\PSTools\******.bat") Send("{ENTER}") While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             $oRDP.Disconnect()             Exit     EndSwitch WEnd

Edited by Benchozer, 16 July 2014 - 07:39 AM.


#13 JLogan3o13

JLogan3o13

    115 and holding

  • MVPs
  • 3,874 posts

Posted 16 July 2014 - 12:46 PM

Benchozer, did you not see above where people were instructed to start a new thread, rather than resurrecting an old one?? The language has changed a lot since this thread began; what worked then might not be the same now. If you want assistance with your issue, start a new thread and explain in detail what you're trying to do, and what problems you're encountering.


Programming is like sex...one mistake and you have to support it for a lifetime.

My Scripts:Include Source with Compiled Script, Disk Maintenance for Windows XP, "Deal-A-Day" Sites, Windows Firewall UDF






Also tagged with one or more of these keywords: rdp, gui, embed

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users