Jump to content

RDC SCRIPT


Recommended Posts

Focus on lines 336 439 I have a lot commented because I was trying different things but it wasnt working. When you open up rdc the script has to somehow compensate for all available screen resolutions so that it can click on the user input field to start transferring the input data (username, password)

So on line 23-25 is the user input credential (does not need to be cross checked or anything)

When a user selects the computer they want to remote to the scripts cross checks the name against an ini file.

Below is the script i have. please help me out on this one and let me know if i wasnt clear enough on what i am trying to accomplish. thanks guys :D

;~ Data OPERATIONS GUI

#AutoIt3Wrapper_outfile=Hot Key RDC.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Add_Constants=n

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#Include <GuiComboBox.au3>
#Include <GuiToolbar.au3>
#include <ButtonConstants.au3>
#Include <WinAPI.au3>
#include <Misc.au3>
#include <GUIConstants.au3>
If _Singleton("Hot Key RDC", 1) = 0 Then
   ; We know the script is already running. Let the user know.
    MsgBox(0, "Data Operations Quick Keys", "The Application is already running on your machine")
    Exit
Endif

;CREDENTIAL CHECK
;~ $username = InputBox("Username","Username:","","")
;~ $password = InputBox("Password","Password:","","*")

;third row def. production disk2 builders
Global $Button_PD1, $Button_PD2, $Button_PD3

;Below third row 4th column DISK2 TEST and disk to pst 
Global $Button_CC1, $Button_CC2, $Button_CC3, $Button_CC4, $Button_CC5

;Below third row 5th column DISK2 TEST and disk to pst 
Global $Button_SC1, $Button_SC2, $Button_SC3, $Button_SC4



;Below 1st row 2nd column spreadsheets 
Global $Button_SP1, $Button_SP2, $Button_SP3, $Button_SP4

;Below 2st row 2nd column spreadsheets 
Global $Button_WS1, $Button_WS2, $Button_WS3, $Button_WS4, $Button_WS5, $Button_WS6, $Button_WS7, $Button_WS8, $Button_WS9
Global $Button_MMGO, $Button_MMSQLGO, $Button_MMCGO, $Button_TSTGO, $Button_PSTGO, $Button_DSK2GO

Global $Button_OVERTST, $Button_SvrChk, $Button_Consolelogin
;***************************************************************************************************

*************************************************************

;top label HEADERS and specifying that this window is rezisable
$GUI = GUICreate("DATA OPERATIONS QUICK KEYS", 430, 455, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MINIMIZEBOX)
;~ $GUI = GUICreate("DATA OPERATIONS QUICK KEYS", 430, 440, -1, -1, BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
;context menu
$contextMenu = GuiCtrlCreateContextMenu()
GuiCtrlCreateMenuItem("Context Menu", $contextMenu)
GuiCtrlCreateMenuItem("", $contextMenu);separator
GuiCtrlCreateMenuItem("&Properties", $contextMenu)
;resize function
GUICtrlSetResizing(-1, $GUI_DOCKAUTO) 
GuiCtrlCreatePic("\\finch\ceregen_it\JEGONZ\Public\pics\TPS-pic.JPG", 0, 0, 0, 0)
;SETTING BACKGROUND COLOR OF GUI
GUISetBkColor(0xFFFFFF)
;***************************************************************************************************

*************************************************************

;GUICtrlCreateLabel("DATA OPERATIONS LAYOUT", 135, 10)
$font = "Arial Bold"
GUISetFont(9, 400, 0, $font) 
GUICtrlCreateLabel("Test Virtual Servers", 10, 85)
GUICtrlCreateLabel("Post Prod Machines", 10, 123)
GUICtrlCreateLabel("Disk2 Builders", 10, 160)
GUICtrlCreateLabel("Sync Servers", 10, 196)
GUICtrlCreateLabel("Server Console Login", 10, 232)
GUICtrlCreateLabel("Server Connection CHK", 10, 268)

GUICtrlCreateGroup("Quick Scripts", 155, 190, 132, 102)
GUICtrlCreateGroup("Console Controls", 155, 295, 132, 122)
GUICtrlCreateGroup("Spread Sheets", 155, 85, 132, 102)
GuiCtrlCreateGroup("MDMT2", 295, 85, 127, 42)
GUICtrlCreateGroup("Web Sites", 295, 130, 132, 202)
GUICtrlCreateLabel("SQL QA", 17, 320)
GUICtrlCreateLabel("RDC", 17, 355)
GUICtrlCreateLabel("MMC", 17, 390)
GuiCtrlCreateGroup("PRD Controls", 6, 305, 90, 125)
GUISetFont(8.5, 400, 0, "") 
;***************************************************************************************************

*************************************************************

; INPUT
$MMSQLInput = GuiCtrlCreateInput("Prog", 15, 335, 35, 20)
$MMInput = GuiCtrlCreateInput("Prog", 15, 370, 35, 20)
$MMCInput = GuiCtrlCreateInput("Prog", 15, 405, 35, 20)
$TSTInput = GuiCtrlCreatecombo("Choose Machine", 10, 100, 105, 20)
GUICtrlSetData(-1, "MMH1TESTVM1 |MMMETESTVM1 |MMD1TESTVM2 |MMD2TESTVM2 |MMCATESTVM3|MMEZTESTVM3 |MMM3TESTVM4 |MMEFTESTVM4 |MM8TTESTVM5 |MMSDTESTVM5 |MME8TESTVM6 |MMOXTESTVM6 |MM9ZTESTVM7 |MM9QTESTVM7 |MMBYTESTVM8 |MMDNTESTVM8 |MMCQTESTVM9 |MMF1TESTVM9")
$PSTInput = GuiCtrlCreatecombo("Choose Machine", 10, 137, 105, 20)
GUICtrlSetData(-1, "TPS-TRAIN-01|TPS-TRAIN-02|TPS-TRAIN-03|TPS-TRAIN-04|TPS-TRAIN-05|TPS-TRAIN-06|TPS-TRAIN-07|TPS-TRAIN-08|TPS-TRAIN-09|TPS-TRAIN-10|TPS-TRAIN-11|TPS-TRAIN-12|TPS-TRAIN-13|TPS-TRAIN-14|TPS-TRAIN-15|TPS-TRAIN-16|TPS-TRAIN-17|TPS-TRAIN-18")
$DSK2Input = GuiCtrlCreatecombo("Choose Machine", 10, 174, 105, 20)
GUICtrlSetData(-1, "DISK2|DISK2-PRD|LWHERM-PST|DISK2-TEST|CCHURS-TESTING")
$SNCInput = GuiCtrlCreatecombo("Choose Machine", 10, 210, 105, 20)
GUICtrlSetData(-1, "BLUE JAY|GREEN JAY|BROWN JAY|SALMON|MIDASTRNSRV02")

$ConsoleInput = GuiCtrlCreatecombo("Choose Machine", 10, 246, 105, 20)
GUICtrlSetData(-1, "BLUE JAY|GREEN JAY|BROWN JAY|SALMON|MIDASTRNSRV02")

$CheckInput = GuiCtrlCreatecombo("Choose Machine", 10, 282, 105, 20)
GUICtrlSetData(-1, "BLUE JAY|GREEN JAY|BROWN JAY|SALMON|MIDASTRNSRV02")
;***************************************************************************************************

*************************************************************

;first row of buttons
Opt("GUICoordMode", 1)
;SETTING COLOR OF BUTTONS
GUICtrlSetDefBkColor(0xD1D9E5)
;***************************************************************************************************

*************************************************************

;MDMT2
$Button_PD1 = GUICtrlCreateButton("TST", 300, 100, 35, 20)
$Button_PD2 = GUICtrlCreateButton("PST", 340, 100, 35, 20)
$Button_PD3 = GUICtrlCreateButton("PRD", 380, 100, 35, 20)


;~;Below 4th row second column DISK2 TEST and disk to pst 
$Button_CC1 = GUICtrlCreateButton("PST Machines", 160, 310, 120, 20)
$Button_CC2 = GUICtrlCreateButton("Training Laptops", 160, 330, 120, 20)
$Button_CC3 = GUICtrlCreateButton("TST VMs & Hosts", 160, 350, 120, 20)
$Button_CC4 = GUICtrlCreateButton("Sync Servers", 160, 370, 120, 20)
$Button_CC5 = GUICtrlCreateButton("Disk2 Builders", 160, 390, 120, 20)

;Below 5th row second column DISK2 TEST and disk to pst 
$Button_SC1 = GUICtrlCreateButton("BO Common Error Fix", 160, 205, 120, 20)
$Button_SC2 = GUICtrlCreateButton("User Overwritten Script", 160, 225, 120, 20)
$Button_SC3 = GUICtrlCreateButton("Sql Version Check", 160, 245, 120, 20)
$Button_SC4 = GUICtrlCreateButton("Red Bubbles", 160, 265, 120, 20)

;Below 1st row second column spreadsheet
$Button_SP1 = GUICtrlCreateButton("Midas Master Programs", 160, 100, 120, 20)
$Button_SP2 = GUICtrlCreateButton("Midas Passwords", 160, 120, 120, 20)
$Button_SP3 = GUICtrlCreateButton("PST Training Room", 160, 140, 120, 20)
$Button_SP4 = GUICtrlCreateButton("TST Synch Status", 160, 160, 120, 20)
;Below 2nd row second column WEBSITES
$Button_WS1 = GUICtrlCreateButton("Team Track", 300, 145, 120, 20)
$Button_WS2 = GUICtrlCreateButton("Team Space", 300, 165, 120, 20)
$Button_WS3 = GUICtrlCreateButton("Magic Helpdesk", 300, 185, 120, 20)
$Button_WS4 = GUICtrlCreateButton("Zabbix", 300, 205, 120, 20)
$Button_WS5 = GUICtrlCreateButton("Site Scope", 300,225, 120, 20)
$Button_WS6 = GUICtrlCreateButton("Prod Polling", 300, 245, 120, 20)
$Button_WS7 = GUICtrlCreateButton("Altris Midas Report", 300, 265, 120, 20)
$Button_WS8 = GUICtrlCreateButton("Lyceum", 300, 285, 120, 20)
$Button_WS9 = GUICtrlCreateButton("ETL Advance Monitor", 300, 305, 120, 20)
;Below 1st row 3rd column prog name
$Button_MMSQLGO = GUICtrlCreateButton("GO", 50, 335, 30, 20)
$Button_MMGO = GUICtrlCreateButton("GO", 50, 370, 30, 20)
$Button_MMCGO = GUICtrlCreateButton("GO", 50, 405, 30, 20)
$Button_TSTGO = GUICtrlCreateButton("GO", 115, 100, 30, 20)
$Button_PSTGO = GUICtrlCreateButton("GO", 115, 137, 30, 20)
$Button_DSK2GO = GUICtrlCreateButton("GO", 115, 173, 30, 20)
$Button_SNCGO = GUICtrlCreateButton("GO", 115, 210, 30, 20)

$Button_Consolelogin = GUICtrlCreateButton("GO", 115, 246, 30, 20)
$Button_Check = GUICtrlCreateButton("GO", 115, 282, 30, 20)
;~ $Button_OVERTST = GUICtrlCreateButton("TST User Overwrite", 300, 390, 120, 20)
;***************************************************************************************************

*************************************************************

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
    Case $msg = $Button_PD1
        ShellExecute( @ProgramFilesDir & "\Monsanto\MDMT2\mdmt windows application.exe")
    Case $msg = $Button_PD2
        ShellExecute( @ProgramFilesDir & "\Monsanto\MDMT2 Test\mdmt windows application.exe")   
;***************************************************************************************************

*************************************************************       

    Case $msg = $Button_CC1
        ShellExecute("mmc.exe",'"\\finch\ceregen_it\JEGONZ\Public\Consoles\Training Lab Post Prod.msc"')        
    Case $msg = $Button_CC2
        ShellExecute("mmc.exe",'"\\finch\ceregen_it\JEGONZ\Public\Consoles\Training Laptops.msc"')
    Case $msg = $Button_CC3
        ShellExecute("mmc.exe",'"\\finch\ceregen_it\JEGONZ\Public\Consoles\VM Test Environment.msc"')
    Case $msg = $Button_CC4
        ShellExecute("mmc.exe",'"\\finch\ceregen_it\JEGONZ\Public\Consoles\Servers.msc"')
    Case $msg = $Button_CC5
        ShellExecute("mmc.exe",'"\\finch\ceregen_it\JEGONZ\Public\Consoles\disk2.msc"') 
;***************************************************************************************************

*************************************************************

Case $msg = $Button_SC1
        ShellExecute("isqlw.exe")
        Sleep(1000)
        ShellExecute("notepad.exe", "\\finch\ceregen_it\JEGONZ\Public\db scripts\BO_Common_cleanup_bad_messages.sql")
;***************************************************************************************************

*************************************************************

    Case $msg = $Button_SC2
        ShellExecute("isqlw.exe")
        Sleep(1000)
        ShellExecute("notepad.exe", "\\finch\ceregen_it\JEGONZ\Public\db scripts\user overwritten.txt")
    Case $msg = $Button_SC3
        ShellExecute("isqlw.exe")
        Sleep(1000)
        ShellExecute("notepad.exe", "\\finch\ceregen_it\JEGONZ\Public\db scripts\sql version check.txt")
    Case $msg = $Button_SC4
        ShellExecute("isqlw.exe")
        Sleep(1000)
        ShellExecute("notepad.exe", "\\finch\ceregen_it\JEGONZ\Public\db scripts\bubbles.sql")  
;***************************************************************************************************

*************************************************************

    Case $msg = $Button_SP1
        ShellExecute("EXCEL.EXE","http://w3dom.monsanto.com/teamspace/tm4139.nsf/0/49C56BD9C400330B8625754B0015E069/$file/MIDASMasterProgramInfo.xlsx?OpenElement", "", "")
    Case $msg = $Button_SP2
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://w3.monsanto.com/asp/ts4.asp?tsid=4139&resid=BD14183C86C3CA2886257547006CED60R", "", "")
    Case $msg = $Button_SP3
        ShellExecute("EXCEL.EXE")
        Sleep(500)
        ShellExecute("\\FINCH\IT_PROJECTS\DeploymentandSupport\TechnicalServices\Private\Training room setup.xlsx", "", "") 
        Case $msg = $Button_SP4
;~      ShellExecute("EXCEL.EXE")
;~      Sleep(500)
        ShellExecute("\\FINCH\IT_PROJECTS\DeploymentandSupport\TechnicalServices\Private\TEST program synch progress.xlsx", "", "") 
;***************************************************************************************************

*************************************************************       

    Case $msg = $Button_WS1
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://w3.teamtrack.monsanto.com/tmtrack/tmtrack.dll?", "", "")
    Case $msg = $Button_WS2
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://w3.monsanto.com/asp/ts4.asp?tsid=4139", "", "")
    Case $msg = $Button_WS3
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://screechowl/magicsshd", "", "")  
;***************************************************************************************************

*************************************************************   

    Case $msg = $Button_WS4
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://stpuxa00/zabbix/screens.php?fullscreen=0&screenid=81", "", "")
    Case $msg = $Button_WS5
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://164.144.128.44:8888/SiteScope/userhtml/DetailTPSPROD.html", "", "")
    Case $msg = $Button_WS6
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://mbkmx2d1/ProdPolling/PollingMain.asp", "", "")  
    Case $msg = $Button_WS7
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://na1000ans00/Altiris/NS/Admin/Reports/report_summary.aspx?Guid=303d60d7-f3be-4b6d-ac6f-593023155711", "", "")
    Case $msg = $Button_WS8
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://w3.lyceum.monsanto.com/signin", "", "")
    Case $msg = $Button_WS9
        ShellExecute( @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE", "http://w3t.rubicon.monsanto.com/etl-admin/displayEnvSelection.do", "", "")     
;***************************************************************************************************

*************************************************************
    
;~  Case $msg = $Button_OVERTST
;~      ShellExecute("TST VM SNC.exe", "", "\\finch\ceregen_it\JEGONZ\Public\TST VM SNC.exe", "", "")

    Case $msg = $Button_MMSQLGO
        $MMName = GUICtrlRead($MMSQLInput)
        $MMList = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\machines.ini","Machines",$MMName, 1)
        If $MMList = 0 Then
            $Loginname = InputBox("Login Name","Please Input Login Name For Database Access: SA or SYNCHRO","","")
            $Pass = InputBox("Password","Please Input Password For DB Access:","","")
            ShellExecute("isqlw.exe")
            Sleep(2000)
            $ConnectHandle = WinGetHandle("Connect to SQL Server", "")
            WinWaitActive($ConnectHandle, "", 5)
            ControlSend($ConnectHandle, "", "[CLASS:Edit; INSTANCE:1]", "{DELETE 20}")
            ControlSend($ConnectHandle, "", "[CLASS:Edit; INSTANCE:1]", $MMList&"\MIDAS")
            ControlClick($ConnectHandle, "", "[ID:1022]")
            ControlSend($ConnectHandle, "", "[CLASS:Edit; INSTANCE:2]", "{DELETE 20}")
            ControlSend($ConnectHandle, "", "[CLASS:Edit; INSTANCE:2]", $Loginname)
            ControlSend($ConnectHandle, "", "[CLASS:Edit; INSTANCE:3]", $Pass)
            Sleep(1000)
            ControlClick($ConnectHandle, "", "[ID:1]")
            Else
                MsgBox(0,"Error","No Machine Listed for this Program",-1,$GUI)
            EndIf
            
    Case $msg = $Button_MMGO
        $MMName = GUICtrlRead($MMInput)
        $MMList = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\machines.ini","Machines",$MMName, 1)
        If $MMList = 0 Then
            ShellExecute("mstsc.exe")
            WinWaitActive("Remote Desktop Connection", "", 30)
            sleep(500)
            Send("^a")
            Send('{DEL 5}')
            Sleep(1000)
            send($MMList)
            Sleep(500)
            Send('{SPACE 2}')
            sleep(500)
            Send('{ENTER}')
            Else
                MsgBox(0,"Error","No Machine Listed for this Program",-1,$GUI)
        EndIf
        
        Case $msg = $Button_MMCGO
        $MMName = GUICtrlRead($MMCInput)
        $MMList = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\machines.ini", "Machines", $MMName, 1)
        If $MMList = 0 Then
            ShellExecute("mmc.exe", '"\\finch\ceregen_it\JEGONZ\Public\Consoles\MMC.msc"')
            Sleep(4500)
            $StartHandle = WinGetHandle("classname=MMCMainFrame", "")
            WinWaitActive($StartHandle, "", 10)
            WinSetState($StartHandle, "", @SW_MAXIMIZE)
            Send("!f")
            Sleep(500)
            Send('{RIGHT 4}')
            Sleep(1000)
            Send('{DOWN 2}')
            Sleep(500)
            Send('{ENTER}')
            Sleep(500)
            Send("!f")
            Sleep(500)
            Send('{DOWN 4}')
            Sleep(500)
            Send('{ENTER}')
            $Snap = WinGetHandle("Add/Remove ", "")
            WinWaitActive($Snap, "", 5)
            ControlClick($Snap, "", "[ID:4008]")
            Sleep(500)
            $Add = WinGetHandle("Add Standalone", "")
            WinWaitActive($Snap, "", 5)
            ControlSend($Add, "", "[CLASS:SysListView32; INSTANCE:1]", "Computer")
            Sleep(1000)
            ControlClick($Add, "", "[ID:1]")
            Sleep(1000)
            $Man = WinGetHandle("Computer Management", "")
            WinWaitActive($Man, "", 5)
            ControlClick($Man, "", "[ID:973]")
            Sleep(500)
            ControlSend($Man, "", "[CLASS:Edit; INSTANCE:1]", $MMList)
            Sleep(500)
            ControlClick($Man, "", "[ID:12325]")
            Sleep(500)
            ControlClick($Add, "", "[ID:2]")
            Sleep(500)
            ControlClick($Snap, "", "[ID:1]")
            Sleep(500)
            Send('{DOWN}')
            Sleep(500)
            Send('{RIGHT}')
        Else
            MsgBox(0, "Error", "No Machine Listed for this Program", -1, $GUI)
        EndIf
        
;*********************************************  **********************  **********************  **********************  **********************      
    Case $msg = $Button_TSTGO
        $TSTName = GUICtrlRead($TSTInput)
        $TSTList = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\TestRDC.ini", "TestVM", $TSTName, 1)
;~      If $TSTList = 0 Then
;~          ShellExecute("mstsc.exe")
;~          WinWaitActive("Remote Desktop Connection", "", 10)
;~          sleep(500)
;~          Send("^a")
;~          Send('{DEL 5}')
;~          Sleep(1000)
;~          send($TSTList)
;~          Sleep(500)
;~          Send('{SPACE 2}')
;~          sleep(500)
;~          Send('{ENTER}')
;~          Sleep(1000)
        ;WinMove($TSTName, "", 0, 0, 800, 640)
;~          WinSetState($TSTName , "", @SW_MAXIMIZE)
;~          Sleep(1000)
;~          $RDChandle = WinGetHandle($TSTName& "- Remote Desk", "")
;~          Opt("WinTitleMatchMode", 4)
;~          $Pos = WinGetPos($RDChandle)
;~              If $Pos[2] <> @DesktopWidth Then $Pos[2] = @DesktopWidth - $Pos[2]
;~              If $Pos[3] <> @DesktopHeight Then 
;~              $Pos[3] = @DesktopHeight - ($Pos[3] + 32)
;~              Else
;~              $Pos[3] -= 32
;~              EndIf
;~              $Form1 = ($Pos[2], $Pos[3], -1, -1)
;~          $Retval = WinWaitActive($TSTList, "", 10)
;~          If $Retval = 0 Then
;~              MsgBox(0,"Unable to Connect ","The specified remote computer could not be reached",-1,$GUI)
;~          If @DesktopWidth & @DesktopHeight = $Form1 Then
;~; do this     Send('{ENTER}')         
;~          Sleep(1000)
;~          Opt("MouseCoordMode", 0)
;~          Sleep(500)
;~          Opt("MouseCoordMode", 2)
;~          Sleep(500)
;~          MouseClick("Left", 680, 410, 2, 1)
;~          Sleep(500)
;~          Opt("MouseCoordMode", 1)
;~          Sleep(500)      
;~          Send("")
;~          Sleep(500)
;~          Send('{DEL}')
;~          Sleep(1000)
;~          Send($username)
;~          Sleep(1000)
;~          Send('{TAB}')
;~          Send($password)
;~          Sleep(1000)
;~          Else
;~          MsgBox(0,"Unable to Connect ","The specified remote computer could not be reached",-1,$GUI)

;~          EndIf
;~      EndIf
;~  EndIf   
;~      
        
        If $TSTList = 0 Then
            ShellExecute("mstsc.exe")
            WinWaitActive("Remote Desktop Connection", "", 10)
            sleep(500)
            Send("^a")
            Send('{DEL 5}')
            Sleep(1000)
            send($TSTList)
            Sleep(500)
            Send('{SPACE 2}')
            sleep(500)
            Send('{ENTER}')
;~          WinWaitActive($TSTList, "", 10)
            WinWaitActive($TSTName, "", 10)
            Sleep(1000)
            Send('{ENTER}')
            Sleep(1000)
            WinSetState($TSTName , "", @SW_MAXIMIZE)
            Sleep(1000)
;~      ;WinMove($TSTName, "", 0, 0, 800, 600)
;~      ;Sleep(1000)
;~      ;$size = WinGetPos($TSTName)
;~      ;MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
;~      ;Opt("MouseCoordMode", 0)
;~          Sleep(500)
;~          MouseClick("Left", 680, 430, 2, 1)
;~          Sleep(500)
;~      ;Opt("MouseCoordMode", 1)
;~          Sleep(500)      
;~          Send("")
;~          Sleep(500)
;~          Send('{DEL}')
;~          Sleep(1000)

;~          Send($username)
;~          Sleep(1000)
;~          Send('{TAB}')
;~          Send($password)
;~          Sleep(1000)
;~      ;Send('{ENTER}')
        Else
            MsgBox(0,"Unable to Connect ","The specified remote computer could not be reached",-1,$GUI)

        EndIf
;~          
            
            
            
    
    Case $msg = $Button_PSTGO
        $PSTName = GUICtrlRead($PSTInput)
        $PSTList = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\PSTRDC.ini", "TrainMachines", $PSTName, 1)
        If $PSTList = 0 Then
            ShellExecute("mstsc.exe")
            WinWaitActive("Remote Desktop Connection", "", 10)
            sleep(500)
            Send("^a")
            Send('{DEL 5}')
            Sleep(1000)
            send($PSTList)
            Sleep(500)
            Send('{SPACE 2}')
            sleep(500)
            Send('{ENTER}')
            WinWaitActive($PSTList, "", 10)
            Sleep(1000)
            Send('{ENTER}')
            Else
                MsgBox(0,"Unable to Connect ","The specified remote computer could not be reached",-1,$GUI)

            EndIf
    Case $msg = $Button_DSK2GO
        $DSK2Name = GUICtrlRead($DSK2Input)
        $DSK2List = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\DSK2.ini", "DSK2", $DSK2Name, 1)
        If $DSK2List = 0 Then
            ShellExecute("mstsc.exe")
            WinWaitActive("Remote Desktop Connection", "", 10)
            sleep(500)
            Send("^a")
            Send('{DEL 5}')
            Sleep(1000)
            send($DSK2List)
            Sleep(500)
            Send('{SPACE 2}')
            sleep(500)
            Send('{ENTER}')
            WinWaitActive($DSK2List, "", 10)
            Sleep(1000)
            Send('{ENTER}')
            Else
                MsgBox(0,"Unable to Connect ","The specified remote computer could not be reached",-1,$GUI)

            EndIf
    Case $msg = $Button_SNCGO
            $SNCName = GUICtrlRead($SNCInput)
         $SNCList = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\SNC.ini", "SNC", $SNCName, 1)
        If $SNCList = 0 Then    
            ShellExecute("mstsc.exe")
            WinWaitActive("Remote Desktop Connection", "", 10)
            sleep(500)
            Send("^a")
            Send('{DEL 5}')
            Sleep(1000)
            send($SNCList)
            Sleep(500)
            Send('{SPACE 2}')
            sleep(500)
            Send('{ENTER}')
            WinWaitActive($SNCList, "", 10)
            Sleep(1000)
            Send('{ENTER}')
            Else
                MsgBox(0,"Unable to Connect ","The specified remote computer could not be reached",-1,$GUI)

            EndIf
        
    Case $msg = $Button_Consolelogin
        $ConsoleName = GUICtrlRead($consoleInput)
         $ConsoleList = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\SNC.ini", "SNC", $ConsoleName, 1)
        If $ConsoleList = 0 Then
            Run(@ComSpec & " /c " & "mstsc /v:"&$ConsoleList&" /console", "")
                    Else
                    MsgBox(0,"Unable to Connect ","The specified remote computer could not be reached",-1,$GUI)

                EndIf
    
    Case $msg = $Button_Check
        $CheckName = GUICtrlRead($CheckInput)
         $CheckList = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\SNC.ini", "SNC", $CheckName, 1)
        If $CheckList = 0 Then
            ShellExecute("cmd.exe")
                WinWaitActive("C:\WINDOWS\system32\cmd.exe", "", 10)
                Sleep(500)
                Send("qwinsta /server:"&$CheckList)
                Sleep(500)
                Send("{ENTER}")
                Else
                    MsgBox(0,"Unable to Connect ","The specified remote computer could not be reached",-1,$GUI)

                EndIf
            
            
            
            
        
        EndSelect
    
WEnd
Link to comment
Share on other sites

  • 3 weeks later...

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