Sign in to follow this  
Followers 0
goss34

RDP Session In AutoIT Gui

13 posts in this topic

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

Share this post


Link to post
Share on other sites



Can anyone help with this? :graduated:

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Try this uncomplete version:

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
 
$host = "" ;<<<<<<< enter here the host name or ip address
;Remote Desktop ActiveX Control Interfaces -> http://msdn.microsoft.com/en-us/library/aa383022(v=VS.85).aspx
$hGUI = GUICreate("RDP Embedded Sessions", 952, 675, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$oRDP = ObjCreate("MsTscAx.MsTscAx.2") ;http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85).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
3 people like this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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.

post-67499-0-51208500-1334415181_thumb.j

Edited by pilot

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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:

Share this post


Link to post
Share on other sites

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.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_IdleTime()_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()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Edited by ravi88

Share this post


Link to post
Share on other sites

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?


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_IdleTime()_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()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#10 ·  Posted

thnx :pirate:

Share this post


Link to post
Share on other sites

#11 ·  Posted

You're welcome. Good luck.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_IdleTime()_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()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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 :

#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

Share this post


Link to post
Share on other sites

#13 ·  Posted

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.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

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

  • Similar Content

    • FMS
      Saving GUI info external
      By FMS
      Dear reader,
       
      At the moment I'm trying to make a script that is changeble by the users.
      It is a script that type's words for you whish u can change what it should be.
      I was thinking that the users may change the button settings in the second tab whit a pull down menu.
       
      At this point the text that must be typed in are hard coded in the program.
      I know that I must "save" the text in a diffrent file but i don't now how.
      Also mine search on the net or forum wasn't fruitfull.(maybe i was looking wrong;))

      Could somebody push me in the right direction?
      (I'm still al little bit new at this so any help or info is appreciated)
       
      thanks in advanced.
       
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 318, 228, 192, 124) $Tab1 = GUICtrlCreateTab(8, 32, 289, 177) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Btn001 = GUICtrlCreateButton("Button1", 25, 68, 75, 25) $Btn002 = GUICtrlCreateButton("Button2", 110, 68, 75, 25) $Btn003 = GUICtrlCreateButton("Button3", 196, 68, 75, 25) $Btn004 = GUICtrlCreateButton("Button4", 25, 100, 75, 25) $Btn005 = GUICtrlCreateButton("Button5", 110, 100, 75, 25) $Btn006 = GUICtrlCreateButton("Button6", 196, 100, 75, 25) $Btn007 = GUICtrlCreateButton("Button7", 25, 132, 75, 25) $Btn008 = GUICtrlCreateButton("Button8", 110, 132, 75, 25) $Btn009 = GUICtrlCreateButton("Button9", 196, 132, 75, 25) $Btn010 = GUICtrlCreateButton("Button10", 25, 164, 75, 25) $Btn011 = GUICtrlCreateButton("Button11", 110, 164, 75, 25) $Btn012 = GUICtrlCreateButton("Button12", 196, 164, 75, 25) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $Combo1 = GUICtrlCreateCombo("", 144, 72, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, " 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12") $Btn013 = GUICtrlCreateButton("Button13", 40, 168, 75, 25) $Btn014 = GUICtrlCreateButton("Button14", 152, 168, 75, 25) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Btn001 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 1 is pushed") Case $Btn002 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 2 is pushed") Case $Btn003 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 3 is pushed") Case $Btn004 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 4 is pushed") Case $Btn005 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 5 is pushed") Case $Btn006 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 6 is pushed") Case $Btn007 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 7 is pushed") Case $Btn008 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 8 is pushed") Case $Btn009 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 9 is pushed") Case $Btn010 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 10 is pushed") Case $Btn011 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 11 is pushed") Case $Btn012 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 12 is pushed") Case $Btn013 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 13 is pushed") Case $Btn014 send("{ALTDOWN}{TAB}{ALTUP}") Sleep(1000) Send ("Button 14 is pushed") EndSwitch WEnd  
    • BetaLeaf
      [Solved]Gui triggering wrong case events
      By BetaLeaf
      I am puzzled. When I check the radio for "Force Disk Mode", I see "Ram Mode" in ConsoleLog when it should be saying "Disk Mode"(from the consolewrite command). Also, clicking the ok button does not work either. Why is it not working?
       
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $SelectMode = GUICreate("Select Mode", 111, 72, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $DS_SETFOREGROUND)) $DiskMode = GUICtrlCreateRadio("Force Disk Mode", 8, 8, 113, 17) $RamMode = GUICtrlCreateCheckbox("Force Ram Mode", 8, 24, 113, 17) $OkButton = GUICtrlCreateRadio("Ok", 8, 40, 97, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case GUICtrlRead($DiskMode) = $GUI_CHECKED $Mode = 1 ConsoleWrite("Disk Mode" & @CRLF) Case GUICtrlRead($RamMode) = $GUI_CHECKED $Mode = 0 ConsoleWrite("Ram Mode" & @CRLF) Case $OkButton ConsoleWrite("Ok Clicked" & @CRLF) GUISetState(@SW_HIDE) ExitLoop EndSwitch WEnd  
    • TheDcoder
      Help with resizing controls in a resizable window!
      By TheDcoder
      Hello! I am trying make my GUI Controls resize correctly... Here is my GUI's code:
      #include <ButtonConstants.au3> #include <ColorConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> Global $g_hMainGUI = GUICreate("Test GUI", 500, 316, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetBkColor($COLOR_WHITE, $g_hMainGUI) GUICtrlCreateGroup("Box 1", 6, 2, 488, 197) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateLabel("Label", 9, 20, 67, 15) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlCreateCombo("", 77, 14, 334, 21, $CBS_DROPDOWNLIST) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlCreateButton("Button 0", 415, 13, 74, 23) GUICtrlSetResizing(-1, BitOR($GUI_DOCKAUTO, $GUI_DOCKVCENTER, $GUI_DOCKHEIGHT)) GUICtrlCreatelistView("Col 1|Col 2|Col 3", 12, 42, 476, 149, $LVS_SINGLESEL, BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE)) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateGroup("Box 2", 6, 199, 253, 112) ;GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT) GUICtrlCreateButton("Button 1", 11, 214, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 2", 11, 245, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 3", 133, 245, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 4", 133, 214, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 5", 11, 276, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 6", 133, 276, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateGroup("Box 3", 264, 199, 230, 112) ;GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT) GUICtrlCreateButton("Button 7", 269, 214, 220, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 8", 269, 245, 220, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 9", 269, 276, 220, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUISetState() Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($g_hMainGUI) Here is what I need: 

      1. Prevent button 0, Label & Combo from moving down
      2. Prevent expansion of Box 1 & 2
       
      I tried a lot but I can't get the desired result, now my brain hurts!
      Thanks in Advance, TD!
    • gil900
      GUIImageButton* - Create GDIP button with image and with frame
      By gil900
      Hello,
      I worte this:

      $hGUI = GUICreate('', 326, 260, 312, 159) WinSetOnTop($hGUI,'',1) GUISetBkColor(0xF5FF82) GUISetState(@SW_SHOW) _GDIPlus_Startup() $hGUI_hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) $Button1Image = @ScriptDir&'\button.png' ; $Button1Image = 'img_button' ; <- Activate this line if you want the image to be loaded from resources $Button2Image = @ScriptDir&'\button2.png' ; $Button2Image = 'img_button2' ; <- Activate this line if you want the image to be loaded from resources $Button = GUIImageButton_Create($hGUI_hGraphics,$Button1Image,95, 72) Sleep(1000) ; Set frame for the button GUIImageButton_SetSquareFrame($hGUI,$hGUI_hGraphics,$Button,10,0xFF00A300) Sleep(1000) ; Set the image button2.png for the button GUIImageButton_SetNewImage($hGUI_hGraphics,$Button,$Button2Image) Sleep(1000) ; Set the image button1.png for the button GUIImageButton_SetNewImage($hGUI_hGraphics,$Button,$Button1Image) Sleep(1000) ; Set new frame instead of the previous GUIImageButton_SetSquareFrame($hGUI,$hGUI_hGraphics,$Button,5,0xFFFF0505) Sleep(1000) ; Remove the frame from the button GUIImageButton_RemoveSquareFrame($hGUI,$Button) Sleep(1000) ; Set frame again GUIImageButton_SetSquareFrame($hGUI,$hGUI_hGraphics,$Button,1) Sleep(1000) ; Remove only the image from the button GUIImageButton_CleanGraphics($hGUI,$Button,0) ; If the 3 parameter is 1 then it will clean also the frame. *It will not remove the button! only clean the visual output Sleep(1000) ; Set the image button2.png for the button GUIImageButton_SetNewImage($hGUI_hGraphics,$Button,$Button2Image) ; This will remove the button. you can call it without calling GUIImageButton_CleanGraphics before ;~ GUIImageButton_Delete($hGUI,$Button1) ;~ Do ;~ Until GUIGetMsg() = $GUI_EVENT_CLOSE ; To use the button just: ; This will not work if you activated line 80 and will not work during the sleeps... ConsoleWrite('listening to $Button:' & @CRLF) While Sleep(10) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button[0] ; <- *[0] ConsoleWrite('$Button1 Clicked' & @CRLF) EndSwitch WEnd ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_Create ; Description ...: Create button with image ; Syntax ........: GUIImageButton_Create($hGUI_hGraphics, $Image, $x_pos, $y_pos[, $x_size = Default[, $y_size = Default]]) ; Parameters ....: $hGUI_hGraphics - value of _GDIPlus_GraphicsCreateFromHWND($hGUI) ; $Image - Can be path the the image file or resource name ; $x_pos - the x pos of the image in the GUI. ; $y_pos - the y pos of the image in the GUI. ; $x_size - [optional] the x size of the image ; $y_size - [optional] the y size of the image ; ** x size and y size must be the same as the real xy size of the image file! ; Return values .: Button handle (Array): ; [0] is the ctrl id and this is the only important thing. [1] & [2] are for internal use only ; Author ........: gil900 ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_SetSquareFrame ; Description ...: Create frame around the button ; Syntax ........: GUIImageButton_SetSquareFrame($hGUI, $hGUI_hGraphics, Byref $aButton[,$iLineWidth = 1 [, ; $LineColor_rgba = 0xFF000000]]) ; Parameters ....: $hGUI - A handle for the GUI ; $hGUI_hGraphics - value of _GDIPlus_GraphicsCreateFromHWND($hGUI). ; $aButton - value of GUIImageButton_Create ; $iLineWidth - [optional] The width in pixels of the frame. Default is 1. ; $LineColor_rgba - [optional] the color value - [0xFF & RGB code]. ; Default is 0xFF000000. ; Return values .: None ; Author ........: gil900 ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_SetNewImage ; Description ...: Set new image over the previous one. ** The new image must be the same size! ; Syntax ........: GUIImageButton_SetNewImage($hGUI_hGraphics, $aButton, $Image) ; Parameters ....: $hGUI_hGraphics - value of _GDIPlus_GraphicsCreateFromHWND($hGUI). ; $aButton - value of GUIImageButton_Create ; $Image - Can be path the the image file or resource name ; Return values .: None ; Author ........: gil900 ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_RemoveSquareFrame ; Description ...: Remove only the frame around the image(if exists) ; Syntax ........: GUIImageButton_RemoveSquareFrame($hGUI, Byref $aButton) ; Parameters ....: $hGUI - A handle for the GUI ; $aButton - value of GUIImageButton_Create ; Return values .: None ; Author ........: gil900 ; Example .......: No ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_Delete ; Description ...: Remove the button ; Syntax ........: GUIImageButton_Delete($hGUI, Byref $aButton) ; Parameters ....: $hGUI - A handle for the GUI ; $aButton - value of GUIImageButton_Create ; Return values .: None ; Author ........: gil900 ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_CleanGraphics ; Description ...: Clean ONLY the graphics of the button. Can clean only the image without the frame or the image+frame((if exists)) ; * It will not delete the button. ; Syntax ........: GUIImageButton_CleanGraphics($hGUI, Byref $aButton[, $CleanFrame = 1]) ; Parameters ....: $hGUI - A handle for the GUI ; $aButton - value of GUIImageButton_Create ; $CleanFrame - [optional] 1 = clean image+frame(if exists) ; 2 = clean image only ; . Default is 1. ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; ===============================================================================================================================  
      Download full code with the images:
      GUIImageButton - r2.rar
      GUIImageButton.rar
      Tested on Autoit 3.3.14.2
      If the title is not good enough then you can edit it and and write better one.
       
      Hope you found it useful. If so then please leave a comment. It took a long time to share this piece of code with the documentation
    • DavidLago
      GUI Interaction (VB6)
      By DavidLago
      Hello. 
      Not sure this is the right forum. If I'm wrong, please, let me know.
      I have a task that I really don't know where to begin at. I have a legacy application built in VB6 (yeah, I know) and lately it has been reported to slow down some of the hours of the day and I'm supposed to have a end-user-experience log for this.
      I have worked with IE before, doing things like _IEFormGetCollection, then _IEFormElementGetCollection, and manipulating @extended tags, also, _IEFormElementGetObjByName, _IEFormElementSetValue and _IEFormSubmit at the end. Another example is _IEImgGetCollection, then working with the variable properties, like $xyz.src.
      What I need to do is basically the same.
      - Collecting GUIForms or elements and Setting values into forms (like _IEFormElementSetValue) 
      - Submitting the info to generate an order on another frame of the GUI, and measure the timing.
       
      What I need to know:
      What function or section to be based upon. I have searched in the help file for over a hour with no luck. I've found some stuff within _WinAPI, GDIPlus, and GUIReference, though I wasn't able to find a suitable function to work with this. I have also searched and read some topics in our forum, but most of them refers to AutoIt GUIs. If I missed something, please, educate me.
      Of course, I'll post whatever I can share about what could be helpful for other users.