Sign in to follow this  
Followers 0
laphlaw

GUI 'grays out' when changing icon

6 posts in this topic

After compiling my script with an icon that I made, my GUI changed a bit. It appeared as though my list boxes that I had created were grayed out. Everything still worked fine, but I think that the change could throw some people off. Before using this icon (using the default one), the GUI looked just fine, as the list boxes were correctly their white color. I didn't change anything in the code, just the icon. What would cause this?

Don't know if it helps, but I made the icon using Easy Icon Maker.

Share this post


Link to post
Share on other sites



Could you pls post your script ...


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

put icon in same folder as script and add this to your script

#Compiler_Icon=whatever.ico

oh wait thats for when using AutoIt3Wrapper

download SciTE4AutoIt3.exe

and you can add your own icon by choosing compile from the tools menu

what am i talking about you can do it just using Aut2Exe

if you right click and choose compile you won't get the choice

your program is messed up because you edited the .exe and corrupted it

Edited by CWorks

Share this post


Link to post
Share on other sites

Instead of having people try to guess via random stabs-in-the-dark, I'm going to say this

The help you receive is directly proportional to the forums ability to help you, which in turn is both inversely proportional to the difficulty/complexity of your question, and directly proportional to how specific on information your are. Do you get what I'm asking for?

Highlight below for a hint!

You post code = We help

Share this post


Link to post
Share on other sites

;Included Files
;==========================
#include <GUIConstants.au3>
#include <file.au3>
;==========================

;Environment Variables -- Change as needed in settings.ini
;=================================================
$LocalDir = @ScriptDir
$RemoteDir="C$\Automation8100"
$product = "DX8100 Server ver. 1.0.00.2011"
$ATPGUIVersion = "1.0.00." & IniRead(@ScriptDir & "\Settings.ini", "Build", "Build","Not Found");reads build from ini
$ProgramPath = "C:\Program Files\DX8100\DX8000Shell.exe"
$Machine="Server";this is to diferentiate between server/client confusions
$ProductFolder="Automation8100";used in RunSelected function
$AutoUpdatePath="\\10.80.0.101\nst_share\automation project\DX8100\AutomaticUpdate\Server"
;=================================================


;Retrieve updates from superb
;=================================================
$User=IniRead(@ScriptDir & "\Settings.ini","User","User","Not Found")
$Password=IniRead(@ScriptDir & "\Settings.ini","Password","Password","Not Found")
If $User <> "" And $Password <> "" Then
    RunWait(@ComSpec & ' /c net use \\10.80.0.101\NST_Share /u:' & $User & ' ' & $Password, '', @SW_HIDE)
    FileCopy($AutoUpdatePath & "\AutomaticUpdate.exe", @ScriptDir & "\", 1)
EndIf

;Run automaticupdate.exe
If FileExists(@ScriptDir & "\AutomaticUpdate.exe") Then
    RunWait(@ScriptDir & "\AutomaticUpdate.exe")
EndIf

FileInstall('psexec.exe', @SystemDir & '\')
Opt("TrayIconDebug", 1)

;grab info from original settings.ini on updates
$OriEmail=IniRead(@ScriptDir & "\Settings.ini", "", "Address","rgarcia@pelco.com")
$OriFirstDX8000=IniRead(@ScriptDir & "\Settings.ini", "8KIP", "IP","10.80.129.73")
$OriSecondDX8000=IniRead(@ScriptDir & "\Settings.ini", "2nd8KIP", "IP","10.80.2.218")
$OriEA=IniRead(@ScriptDir & "\Settings.ini", "ClientIP", "IP","10.80.2.219")
$OriDrive=IniRead(@ScriptDir & "\Settings.ini", "Drive", "Path","rgarcia")
$OriDriveUserName=IniRead(@ScriptDir & "\Settings.ini", "User", "User","rgarcia")
$OriDrivePassword=IniRead(@ScriptDir & "\Settings.ini", "Password", "Password","")
$OriClient1IP=IniRead(@ScriptDir & "\Clients.ini", $Machine & " 1", "IP", "")
;=================================================


;first time wizard for settings.ini and clients.ini
;===================================================================================================
================================================
If IniRead($LocalDir & "\Settings.ini", "FirstTime", "FirstRun", "Not Found") = "Yes" or IniRead($LocalDir & "\Clients.ini", "Server 1", "IP", "Not Found") = "" Then
    MsgBox(0,"Attention", "The following wizard will walk you through the setup process.  Click OK to continue")
    
;Client 1 IP address
    $Client1 = InputBox('Pre-run Setup', 'At least one DX8100 IP address must be set to run scripts on.  Please enter in a DX8100 IP address  (MUST BE A 16-CHANNEL!)', $OriClient1IP)
    IniWrite($LocalDir & "\Clients.ini", "Server 1", "IP", $Client1)
        
;Emergency email address
    $email=InputBox("Setup Wizard", "Please set up the following setting: " & @CRLF & "Email Address (for Emergency Email testing): ", $OriEmail)
    IniWrite($LocalDir & "\Settings.ini", "Email", "Address", $email)
;Secondary DX8000 IP address
    $SecondDX8000=InputBox("Setup Wizard", "Enter in the IP address of another DX8000/8100 that the scripts will use in automation. " & @CRLF & "(IMPORTANT: This must be a valid IP, and the DX8000 must be a 16-channel unit)", $OriSecondDX8000)
    IniWrite($LocalDir & "\Settings.ini", "NetworkedIP", "IP", $SecondDX8000)
;Emergency Agent IP address
    $EA=InputBox("Setup Wizard", "Enter in the IP address of the client machine that will receive the Emergency Agent video alerts (this will be the machine the script runs on):", $OriEA)
    IniWrite($LocalDir & "\Settings.ini", "ClientIP", "IP", $EA)
;Export drive
    $drive=InputBox("Setup Wizard", "The automation script needs a folder to export data for export testing.  Enter in the drive name of your superb public share folder (i.e. rgarcia, nhunter, etc.):", $OriDrive)
    IniWrite($LocalDir & "\Settings.ini", "Drive", "Path", $drive)
;Drive username
    $driveUsername=InputBox("Setup Wizard", "Enter in your username for this drive (the same used for superb):", $OriDriveUserName)
    IniWrite($LocalDir & "\Settings.ini", "User", "User", $driveUsername)
;Drive password
    $drivePassword=InputBox("Setup Wizard", "Enter in your password (the same used for superb):", $OriDrivePassword, "*")
    IniWrite($LocalDir & "\Settings.ini", "Password", "Password", $drivePassword)
;First run is now off
    IniWrite($LocalDir & "\Settings.ini", "FirstTime", "FirstRun", "No")
    MsgBox(0,'Finished!', 'The automation setup has been complete!  These settings can be changed at any time under File -> Run Wizard, or Edit -> Edit Settings/Edit Server IPs.  Click OK to continue.')
    If FileExists(@ScriptDir & "\Readme.txt") Then
        Run("notepad.exe " & $LocalDir &  "\Readme.txt")
        WinActivate("Readme")
        WinWaitActive("Readme", "", 5)
    EndIf
EndIf
;===================================================================================================
================================================


;Creates the 'torun.ini' file in the script directory
;===============================================================================
If FileExists("ToRun.ini") Then FileDelete("ToRun.ini");ensure it didn't already exist
CreateTempIni(0)
;===============================================================================



;== Create Main GUI, tabs, File Menu
;===============================================================================
$GUI_Main = GUICreate("Automated Test Plan (Server)", 850, 415, 192, 125)
GUICtrlCreateTab(8, 1, 825, 390)

;File menu
$FileMenu = GUICtrlCreateMenu("&File")
$menu_ClearLog = GUICtrlCreateMenuitem("Clear Log", $FileMenu)
$menu_Wizard = GUICtrlCreateMenuitem("Run Wizard", $FileMenu)
$menu_Updates = GUICtrlCreateMenuitem("Grab Updates", $FileMenu)

;Edit menu
$EditMenu = GUICtrlCreateMenu("&Edit")
$menu_EditIPs = GUICtrlCreateMenuitem("Edit Server/Client IPs", $EditMenu)
$menu_EditSettings = GUICtrlCreateMenuitem("Edit Settings", $EditMenu)

;Help menu
$HelpMenu = GUICtrlCreateMenu("&Help")
$menu_Readme = GUICtrlCreateMenuitem("View Readme", $HelpMenu)
$menu_About = GUICtrlCreateMenuitem("About", $HelpMenu)
;===============================================================================


;================================Server Tab====================================================

;Tree items
;------------------------------------------------------------------------------
GUICtrlCreateTabItem("Server (DVR)")
$ServerList = GUICtrlCreateTreeView(16, 35, 95, 320)
$LocalServer= GUICtrlCreateTreeViewItem("Local Machine", $ServerList)
$Server1 = GUICtrlCreateTreeViewItem("Server 1", $ServerList)
$Server2 = GUICtrlCreateTreeViewItem("Server 2", $ServerList)
$Server3 = GUICtrlCreateTreeViewItem("Server 3", $ServerList)
$Server4 = GUICtrlCreateTreeViewItem("Server 4", $ServerList)
;------------------------------------------------------------------------------

;Scripts Group
;------------------------------------------------------------------------------
GUICtrlCreateLabel("Available Scripts (++Denotes script has extra settings)", 290, 40, 260, 17)
GUICtrlCreateLabel("Selected Scripts", 590,40, 125, 17)
$bServerAddAll = GUICtrlCreateButton("Add All", 321, 330, 80, 25)
$bServerRemoveAll = GUICtrlCreateButton("Remove All", 415, 330, 80, 25)
$bServerAdd = GUICtrlCreateButton("Add >>", 520, 134, 65, 25)
$bServerRemove = GUICtrlCreateButton("<< Remove", 520, 174, 65, 25)
$bServerRunSelected = GUICtrlCreateButton("Run &Selected", 630, 330, 75, 25)
$ServerScriptList = GUICtrlCreateList("", 290, 54, 225, 279)
$ServerScriptsToRun = GUICtrlCreateList("", 590, 54, 225, 279)
$cbServerLoop= GUICtrlCreateCheckbox("Loop", 725, 335, 65, 17)
;~ $cbServerLoop= GUICtrlCreateCheckbox("Loop", 725, 335, 65, 17)
ListFiles();Add available scripts in the Exe directory
;------------------------------------------------------------------------------

;Server info group
;------------------------------------------------------------------------------
GUICtrlCreateGroup("Server Info", 144, 30, 137, 100)
$lblServerIP= GUICtrlCreateLabel("IP: ", 149, 54, 100, 17)
$bServerPing = GUICtrlCreateButton("P&ing DVR", 150, 72, 75, 25)
$bServerViewLog = GUICtrlCreateButton("View &Log", 150, 102, 75, 25)
;------------------------------------------------------------------------------

;Hot Keys Group
;------------------------------------------------------------------------------
GUICtrlCreateGroup("Hot Keys (local only)", 144, 155, 137, 75)
GUICtrlCreateLabel("-Kill running script: Ctrl+C", 149, 175, 125, 17)
GUICtrlCreateLabel("-Kill GUIPrep: Home", 149, 205, 115, 17)
;------------------------------------------------------------------------------

;Remote Script control group
;------------------------------------------------------------------------------
GUICtrlCreateGroup("Remote Script Controls", 144, 258, 137, 95)
$bServerProcessKill = GUICtrlCreateButton("&Kill Running Processes", 150, 315, 125, 25)
$bServerViewPic = GUICtrlCreateButton("View Live &Picture", 150, 280, 125, 25)  
;------------------------------------------------------------------------------

;================================End Server Tab====================================================






; Show main gui, click the tree highlight the first server
;===============================================================================
GUISetState(@SW_SHOW, $GUI_Main)
If WinExists('Readme') then WinActivate('Readme');in case the readme is open
;Initially gray out remote buttons
ControlDisable("Automated Test Plan", "", "&Kill Running Processes")
ControlDisable("Automated Test Plan", "", "View Live &Picture")
ControlDisable("Automated Test Plan", "", "P&ing DVR")
ControlClick('Automated Test Plan', 'Add All', 7)

;Set the default to server 1
$Sec="Server 1"
$ServerIP= IniRead($LocalDir & '\Clients.ini', 'Server 1', 'IP', 'Not Found')
GUICtrlSetData($lblServerIP, "IP: " & $serverIP)


;===============================================================================


;GUI Functionality -- Server Tab
;===================================================================================================
===========================================================
While 1
    $msg = GUIGetMsg(1)
    
    Select
        
    ;===============================================================================
    ;== Button: X, main GUI
    ;===============================================================================
        Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $GUI_Main
            FileDelete($LocalDir & "\ToRun.ini")
            If @error Then MsgBox(0, "Error", "Error deleting temp file!")
            ProcessClose('LivePic.exe')
            ExitLoop
            
    ;===============================================================================
    ;== Server tree
    ;===============================================================================
        Case $msg[0] = $Server1 Or $msg[0] = $Server2 Or $msg[0] = $Server3 Or $msg[0] = $Server4
;~          MsgBox(0,'',GUICtrlRead($serverlist))
            $sec = _CtrlIDtoSec(GUICtrlRead($serverlist));send the control ID and convert it to the readable section
;~          MsgBox(0,'',$sec)
            ControlEnable("Automated Test Plan", "", "&Kill Running Processes")
            ControlEnable("Automated Test Plan", "", "View Live &Picture")
            ControlEnable("Automated Test Plan", "", "P&ing DVR")
        ;Get the client's IP
            $ServerIP= IniRead($LocalDir & '\Clients.ini', $sec, 'IP', 'Not Found')
            GUICtrlSetData($lblServerIP, "IP: " & $serverIP)
            
        Case $msg[0] = $LocalServer
            $sec =  "Local Machine" 
            
        ;Gray out the remote controls
            ControlDisable("Automated Test Plan", "", "&Kill Running Processes")
            ControlDisable("Automated Test Plan", "", "View Live &Picture")
            ControlDisable("Automated Test Plan", "", "P&ing Server")
            GUICtrlSetData($lblServerIP, "IP: Local Machine")
            
        ;===============================================================================
        ;== Button: View Log
        ;===============================================================================
        Case $msg[0] = $bServerViewLog
            
            $pos = WinGetPos('Automated Test Plan')
            $size = WinGetClientSize('Automated Test Plan')
            ToolTip('Loading Log...', $pos[0]+ ($size[0] / 2), $pos[1]+ ($size[1] / 2))
            
            
            If $sec = "Local Machine" Then
                If FileExists($LocalDir & '\WebLog\TestPlan.html') = 0 Then
                    ToolTip('')
                    MsgBox(0, 'Error', 'No existing log!')
                Else
                    Run(@ComSpec & ' /c ' & $LocalDir & '\WebLog\TestPlan.html', '', @SW_HIDE)
                    ToolTip('')
                    WinWaitActive("Test Plan Log", "", 10)
                    If not WinExists("Test Plan Log") Then MsgBox(0, "Error", "Unable to load log with browser.  Browser may not be working correctly.")
                EndIf
                
            Else
                $username = IniRead($LocalDir & '\Clients.ini', $sec, 'Username', 'Not Found')
                $password = IniRead($LocalDir & '\Clients.ini', $sec, 'Password', 'Not Found')
                RunWait(@ComSpec & ' /c net use \\' & $ServerIP& '\C$ /u:' & $username & ' ' & $password, '', @SW_HIDE)
                If FileExists('\\' & $ServerIP & '\' & $RemoteDir & '\WebLog\TestPlan.html') = 0 Then
                    MsgBox(0, 'Error', 'No existing log!')
                    ToolTip('')
                Else
                    Run(@ComSpec & ' /c \\' & $ServerIP & '\' & $RemoteDir & '\WebLog\TestPlan.html', '', @SW_HIDE)
                    WinWaitActive("Test Plan Log", "", 10)
                    If not WinExists("Test Plan Log") Then MsgBox(0, "Error", "Unable to load log with browser.  Browser may not be working correctly.")
                    ToolTip('')
                EndIf
            EndIf
            
            
        ;===============================================================================
        ;== Button: View Live Picture
        ;===============================================================================
        Case $msg[0] = $bServerViewPic
            If Not ProcessExists('LivePic.exe') Then
                $pos = WinGetPos('Automated Test Plan')
                $size = WinGetClientSize('Automated Test Plan')
                ToolTip('Please Wait...', $pos[0]+ ($size[0] / 2), $pos[1]+ ($size[1] / 2))
                
                $username = IniRead($LocalDir & '\Clients.ini', $sec, 'Username', 'Not Found')
                $password = IniRead($LocalDir & '\Clients.ini', $sec, 'Password', 'Not Found')
                RunWait(@ComSpec & ' /c net use \\' & $ServerIP& '\C$ /u:' & $username & ' ' & $password, '', @SW_HIDE)
                
            ;Ensure screencapture.exe exists
                If FileExists("\\" & $ServerIP& "\" & $RemoteDir& "\ScreenCapture.exe") = 0 Then
                    FileCopy($LocalDir & "\ScreenCapture.exe", "\\" & $ServerIP& "\" & $RemoteDir& "\", 1)
                EndIf
                
            ;Case livescreenshot.jpg doesn't exist ("virgin" machine)
                If FileExists("\\" & $ServerIP& "\" & $RemoteDir& "\LiveScreenshot.jpg") = 0 Then
                    RunWait(@ComSpec & ' /c psexec \\' & $ServerIP& ' -u ' & $username & ' -p ' & $password & ' -i -d C:\Automation8100\ScreenCapture.exe', '', @SW_HIDE)
                    Do
                        Sleep(100)
                    Until FileExists("\\" & $ServerIP& "\" & $RemoteDir& "\LiveScreenshot.jpg") = 1
                    
                    ToolTip('')
                    Run($LocalDir & '\LivePic.exe ' & $serverIP)
                    
                ;Case livescreenshot.jpg does exist
                Else
                    $t = FileGetTime("\\" & $ServerIP& "\" & $RemoteDir& "\LiveScreenshot.jpg");get the creation time of the screenshot
                    
                    RunWait(@ComSpec & ' /c psexec \\' & $ServerIP& ' -u ' & $username & ' -p ' & $password & ' -i -d C:\Automation8100\ScreenCapture.exe', '', @SW_HIDE)
                    
                ;Wait until new screenshot has been generated
                    Do
                        $current = FileGetTime("\\" & $ServerIP& "\" & $RemoteDir& "\LiveScreenshot.jpg")
;~              MsgBox(0, "Modified time:", $current[3] & ":" & $current[4] & ":" & $current[5])
                    Until $t[3] <> $current[3] Or $t[4] <> $current[4] Or $t[5] <> $current[5]
                    
                    ToolTip('')
                    Run($LocalDir & '\LivePic.exe ' & $serverIP)
                EndIf
            EndIf
            
            
        ;===============================================================================
        ;== Button: Run Selected
        ;===============================================================================
        Case $msg[0] = $bServerRunSelected
            $pos = WinGetPos('Automated Test Plan')
            $size = WinGetClientSize('Automated Test Plan')
            ToolTip('Please Wait...', $pos[0]+ ($size[0] / 2), $pos[1]+ ($size[1] / 2))
            
            
        ;=============================================================;
            Select
            ;-----------------------------------------
            ;-----------Local Exection----------------
            ;-----------------------------------------
            Case $sec = "Local Machine"
                If Not FileExists ($ProgramPath) Then
                    MsgBox(0,'Error', 'The program ' & $ProgramPath & ' is not found on this computer!')
                    Exit
                Else
                
                ;Install files/folders, if necessary
                    If FileExists($LocalDir & "\WebLog") = 0 Then
                        DirCreate($LocalDir & "\WebLog\MasterScreenshots")
                        DirCreate($LocalDir & "\WebLog\CapturedScreenshots")
                        DirCreate($LocalDir & "\WebLog\PerformanceLogs")
                    EndIf
                    
                
                ;-------------looped---------------
                    If GUICtrlRead($cbServerLoop) = $GUI_CHECKED Then
                        
                        ToolTip('')
                        
                    ;case guiprep hasn't been run
                        If IniRead($LocalDir & '\ToRun.ini', 'GUIPrep', 'Ready', 'Not Found') <> 'Yes' Then
                            $choice = MsgBox(0, 'Run GUIPrep?', 'The "GUIPrep" function has not been run yet.  Running a script without first preparing the GUI will likely cause the script to fail.  Run GUIPrep?')
;~                  If $choice=6 Then
                            RunWait($LocalDir & '\GUIPrep.exe')
                            IniWrite($LocalDir & "\torun.ini", "GUIPrep", "Ready", "Yes")
                            RunWait($LocalDir & '\LocalMaster.exe "loop" "' & $sec & '"')
                        Else
                            RunWait($LocalDir & '\LocalMaster.exe "loop" "' & $sec & '"')
                        EndIf
                        
;~              EndIf
                        
                    EndIf
                    
                ;------------not looped----------------
                    If GUICtrlRead($cbServerLoop) = $GUI_UNCHECKED Then
                        ToolTip('')
                        
                    ;case guiprep hasn't been run
                        If IniRead($LocalDir & '\ToRun.ini', 'GUIPrep', 'Ready', 'Not Found') <> 'Yes' Then
                            $choice = MsgBox(0, 'Run GUIPrep?', 'The "GUIPrep" function has not been run yet.  Running a script without first preparing the GUI will likely cause the script to fail.  Run GUIPrep?')
;~                  If $choice=1 Then
                            RunWait($LocalDir & '\GUIPrep.exe')
                            IniWrite($LocalDir & "\torun.ini", "GUIPrep", "Ready", "Yes")
                            RunWait($LocalDir & '\LocalMaster.exe "NoLoop" "' & $sec & '"')
                        Else
                            RunWait($LocalDir & '\LocalMaster.exe "NoLoop" "' & $sec & '"')
                        EndIf
                        
;~              EndIf
                        
                    EndIf
                EndIf
                ;-----------------------------------------
                ;-----------Remote Exection----------------
                ;-----------------------------------------
                Case Else
                    If FileExists('\\' & $ServerIP& '\' & $RemoteDir& '\busy.tmp') Then
                        ToolTip('')
                        MsgBox(0, 'Attention!', 'Another script is currently being run on this computer. ' & @CRLF & 'It is recommended that you wait until this process finishes, or choose another computer on the tree.  Check the live screenshot or log to see the status of the script.')
                    Else
                        If GUICtrlRead($cbServerLoop) = 1 Then
                            FileDelete('\\' & $ServerIP& '\c$\' & $LocalDir & '\Exe\*.exe') ;Delete previous exes
                            
                        ;Get username and password and run the scripts
                            $username = IniRead($LocalDir & '\Clients.ini', $sec, 'Username', 'Not Found')
                            $password = IniRead($LocalDir & '\Clients.ini', $sec, 'Password', 'Not Found')
                            RunSelected($serverIP, $username, $password, "loop", $RemoteDir)
                        Else
                            FileDelete('\\' & $ServerIP& '\c$\' & $LocalDir & '\Exe\*.exe')
                            
                        ;Get username and password and run the scripts
                            $username = IniRead($LocalDir & '\Clients.ini', $sec, 'Username', 'Not Found')
                            $password = IniRead($LocalDir & '\Clients.ini', $sec, 'Password', 'Not Found')
                            RunSelected($serverIP, $username, $password, "", $RemoteDir)
                        EndIf
                        ToolTip('')
                    EndIf
            EndSelect
            
            
        ;=============================================================;
            
        ;===============================================================================
        ;== Add button functions
        ;===============================================================================
        Case $msg[0] = $bServerAdd
            $selectedscript = GUICtrlRead($ServerScriptList)
            IniWrite($LocalDir & "\torun.ini", $selectedscript & ".exe", "Run", "1")
            GUICtrlSetData($ServerScriptsToRun, $selectedscript)
            
        ;===============================================================================
        ;== Remove Button functions
        ;===============================================================================
        Case $msg[0] = $bServerRemove
            $selectedscript = GUICtrlRead($ServerScriptsToRun)
            IniWrite($LocalDir & "\torun.ini", $selectedscript & ".exe", "Run", "0")
            GUICtrlSetData($ServerScriptsToRun, "")
            $sections = IniReadSectionNames($LocalDir & "\torun.ini")
            For $i = 1 To $sections[0]
                If IniRead($LocalDir & "\torun.ini", $sections[$i], "Run", "Not Found") = 1 Then
                    GUICtrlSetData($ServerScriptsToRun, StringTrimRight($sections[$i], 4))
                EndIf
            Next
            
        ;===============================================================================
        ;== Add all button functions
        ;===============================================================================
        Case $msg[0] = $bServerAddAll
            $GUIPrepStatus = IniRead($LocalDir & "\ToRun.ini", "GUIPrep", "Ready", "Not Found")
            FileDelete($LocalDir & "\ToRun.ini")
            If @error Then MsgBox(0, "Error", "Error deleting temp file!")
            CreateTempIni(1)
            IniWrite($LocalDir & "\ToRun.ini", "GUIPrep", "Ready", $GUIPrepStatus)
            $files = _FileListToArray ($LocalDir & "\Exe", "*.exe", 1)
            For $i = 1 To $files[0]
                GUICtrlSetData($ServerScriptsToRun, StringTrimRight($files[$i], 4))
            Next
            
            
        ;===============================================================================
        ;== Remove all button functions
        ;===============================================================================
        Case $msg[0] = $bServerRemoveAll
            $GUIPrepStatus = IniRead($LocalDir & "\ToRun.ini", "GUIPrep", "Ready", "Not Found")
            FileDelete($LocalDir & "\ToRun.ini")
            If @error Then MsgBox(0, "Error", "Error deleting temp file!")
            CreateTempIni(0)
            IniWrite($LocalDir & "\ToRun.ini", "GUIPrep", "Ready", $GUIPrepStatus)
            GUICtrlSetData($ServerScriptsToRun, "")
            
        ;===============================================================================
        ;== Button: Ping
        ;===============================================================================
        Case $msg[0] = $bServerPing
            $pos = WinGetPos('Automated Test Plan')
            $size = WinGetClientSize('Automated Test Plan')
            ToolTip('Please Wait...', $pos[0]+ ($size[0] / 2), $pos[1]+ ($size[1] / 2))
            $sec = _CtrlIDtoSec(GUICtrlRead($serverlist))
            $ServerIP= IniRead($LocalDir & '\Clients.ini', $sec, 'IP', 'Not Found')
            $testonline = Ping($serverIP)
            If $testonline Then
                ToolTip('')
                MsgBox(0, 'Success', $sec & ' is online!')
            Else
                ToolTip('')
                MsgBox(0, "Error", "Server unreachable.  Either the server is offline, application is not running, or IPSec is on.")
            EndIf
            
        ;===============================================================================
        ;== Button: Kill Processes
        ;===============================================================================
        Case $msg[0] = $bServerProcessKill
            $username = IniRead($LocalDir & '\Clients.ini', $sec, 'Username', 'Not Found')
            $password = IniRead($LocalDir & '\Clients.ini', $sec, 'Password', 'Not Found')
            Run(@ComSpec & ' /c psexec \\' & $ServerIP& ' -u ' & $username & ' -p ' & $password & ' -i -d C:\Automation8100\ProcessKill.exe')
            
            
        ;===============================================================================
        ;== Menu Item: Edit IPs
        ;===============================================================================
        Case $msg[0] = $menu_EditIPs
            Run("notepad " & $LocalDir & "\Clients.ini")
            
        ;===============================================================================
        ;== Menu Item: Edit Settings
        ;===============================================================================
        Case $msg[0] = $menu_EditSettings
            Run("notepad " & $LocalDir & "\Settings.ini")
            
        ;===============================================================================
        ;== Menu Item: About
        ;===============================================================================
        Case $msg[0] = $menu_About
            MsgBox(0, "Automated Test Plan", "Product: " & $product & @CRLF & @CRLF & "Automated Test Plan: " & $ATPGUIVersion)
            
    ;===============================================================================
    ;== Menu Item: Clear log
        Case $msg[0] = $menu_ClearLog
            $ClearLog = MsgBox(4, 'Clear Log?', 'Are you sure?')
            If $ClearLog = 6 Then
                If $sec = 'Local Machine' Then
                    FileDelete($LocalDir & "\WebLog\*.html")
                    FileDelete($LocalDir & "\WebLog\CapturedScreenshots\*.*")
                    FileDelete($LocalDir & "\WebLog\PerformanceLogs\*.*")
                Else
                    $username = IniRead($LocalDir & '\Clients.ini', $sec, 'Username', 'Not Found')
                    $password = IniRead($LocalDir & '\Clients.ini', $sec, 'Password', 'Not Found')
                    FileDelete("\\" & $ServerIP & "\" & $RemoteDir & "\Weblog\*.html")
                    FileDelete("\\" & $ServerIP & "\" & $RemoteDir & "\Weblog\CapturedScreenshots\*.*")
                    FileDelete("\\" & $ServerIP & "\" & $RemoteDir & "\Weblog\PerformanceLogs\*.*")
                EndIf
            EndIf
    ;===============================================================================
        

    ;== Menu Item: Run Wizard
    ;===============================================================================
        Case $msg[0] = $menu_Wizard
            Wizard()
        
        
    ;===============================================================================
    ;==Grab updates
    ;===============================================================================
        Case $msg[0] = $menu_Updates
        RunWait(@ScriptDir & "\GrabUpdates.exe")
        
    ;===============================================================================
    ;== Menu Item: View Readme
    ;===============================================================================
        Case $msg[0] = $menu_Readme
            Run("notepad " & $LocalDir & "\Readme.txt")
    EndSelect
WEnd

;~ Exit

;===============================================================================
;== Functions
;===============================================================================
Func _CtrlIDtoSec($nID)
    
;The control ID can change, so be aware!!
    Select

        Case $nID = 17
            $sec = 'Server 1'
        Case $nID = 18
            $sec = 'Server 2'
        Case $nID = 19
            $sec = 'Server 3'
        Case $nID = 20
            $sec = 'Server 4'
        Case Else
            $sec="Local Machine"
    EndSelect
    
    Return $sec
EndFunc  ;==>_CtrlIDtoSec




Func ListFiles()
    $filelist = _FileListToArray ($LocalDir & "\Exe", "*.exe", 1); list files to an array.
        
    GUICtrlSetData($filelist, ""); set list to empty.
    For $x = 1 To $filelist[0]; for loop to place the files in the list.
        GUICtrlSetData($ServerScriptList, (StringTrimRight($filelist[$x], 4)) & "|", 1); string trim the last 4 characters ( .exe )
    Next
EndFunc  ;==>ListFiles






Func RunSelected($ip, $username, $password, $parameter, $RemoteDir)
    
    
    RunWait(@ComSpec & ' /c net use \\' & $ip & '\C$ /u:' & $username & ' ' & $password, '', @SW_HIDE) 

    
            $ProductFolder = IniRead(@ScriptDir & "\Settings.ini", "ProductFolder", "Folder", "Not Found") 
        
        ;Install files/folders
            DirCreate("\\" & $ip & "\" & $RemoteDir)
            DirCreate("\\" & $ip & "\" & $RemoteDir & "\WebLog\MasterScreenshots")
            If @error Then MsgBox(0, 'Error', 'Error creating directory.  Error: ' & @error)
            DirCreate("\\" & $ip & "\" & $RemoteDir & "\WebLog\CapturedScreenshots")
            DirCreate("\\" & $ip & "\" & $RemoteDir & "\WebLog\PerformanceLogs")
            DirCreate("\\" & $ip & "\" & $RemoteDir & "\EXE")
            
        ;Install necessary files
            FileCopy(@ScriptDir & "\Master.exe", "\\" & $ip & "\" & $RemoteDir & "\", 1)
            FileCopy(@ScriptDir & "\ProcessKill.exe", "\\" & $ip & "\" & $RemoteDir & "\", 1)
            FileCopy(@ScriptDir & "\ScreenCapture.exe", "\\" & $ip & "\" & $RemoteDir & "\", 1)
            FileCopy(@ScriptDir & "\GUIPrep.exe", "\\" & $ip & "\" & $RemoteDir & "\", 1)
            FileCopy(@ScriptDir & "\Settings.ini", "\\" & $ip & "\" & $RemoteDir & "\", 1)
            FileCopy(@ScriptDir & "\Clients.ini", "\\" & $ip & "\" & $RemoteDir & "\", 1)
            FileCopy(@ScriptDir & "\DefaultSettings.bak", "\\" & $ip & "\" & $RemoteDir & "\")
            FileCopy(@ScriptDir & "\NIC.ini", "\\" & $ip & "\" & $RemoteDir & "\")
            FileCopy(@ScriptDir & "\typeperf.exe", "\\" & $ip & "\C$\WINNT\System32\")
    
    
;Delete any previous exes on the remote machine
    FileDelete("\\" & $ip & "\" & $RemoteDir & "\Exe\*.exe")
    
;Reads which ones are "on", and copies those to the specified IP address
    $sections = IniReadSectionNames($LocalDir & "\ToRun.ini")
    For $i = 1 To $sections[0]
        If IniRead($LocalDir & "\ToRun.ini", $sections[$i], "Run", "Not Found") = 1 Then
            FileCopy($LocalDir & '\EXE\' & $sections[$i], '\\' & $ip & '\' & $RemoteDir & '\Exe\', 1)
            If Not FileExists('\\' & $ip & '\' & $RemoteDir & '\WebLog\MasterScreenshots\' & StringTrimRight($sections[$i], 4) & '.jpg') Then FileCopy($LocalDir & '\WebLog\MasterScreenshots\' & StringTrimRight($sections[$i], 4) & '.jpg', '\\' & $ip & '\' & $RemoteDir & '\WebLog\MasterScreenshots\', 1)
        EndIf
    Next


;Call the master script and pass it a parameter to loop or not
    RunWait(@ComSpec & ' /c psexec \\' & $ip & ' -u ' & $username & ' -p ' & $password & ' -i -d C:\' & $ProductFolder & '\Master.exe ' & $parameter)

    
EndFunc  ;==>RunSelected




Func CreateTempIni($iOnOff)
;Read the Exe directory for available scripts to an array
    $files = _FileListToArray ($LocalDir & "\EXE\", "*.*", 1)
    For $i = 1 To $files[0]
        $files[$i] = "[" & $files[$i] & "]" & @CRLF & "Run=" & $iOnOff
    Next
    
;Write them to an array
    For $i = 1 To $files[0]
        FileWriteLine($LocalDir & "\ToRun.ini", $files[$i] & @CRLF & @CRLF)
    Next
    
;Set default that GUIPrep hasn't been run
    FileWriteLine($LocalDir & "\ToRun.ini", "[GUIPrep]" & @CRLF)
    FileWriteLine($LocalDir & "\ToRun.ini", "Ready=No" & @CRLF & @CRLF)
    
;Returns an array of all the sections in the ini
    $sections = IniReadSectionNames($LocalDir & "\ToRun.ini")
    If @error Then Return MsgBox(0, 'Error', 'Unable to read ini sections to an array.  Error: ' & @error)
EndFunc  ;==>CreateTempIni



Func Wizard()
    MsgBox(0,"Attention", "The following wizard will walk you through the setup process.  Click OK to continue")
;Emergency email address
    $email=InputBox("Setup Wizard", "Please set up the following setting: " & @CRLF & "Email Address (for Emergency Email testing): ", "rgarcia@pelco.com")
    IniWrite($LocalDir & "\Settings.ini", "Email", "Address", $email)
;Secondary DX8000 IP address
    $SecondDX8000=InputBox("Setup Wizard", "Enter in the IP address of another DX8000/8100 that the scripts will use in automation. " & @CRLF & "(IMPORTANT: This must be a valid IP, and the DX8000 must be a 16-channel unit)", "10.80.2.128")
    IniWrite($LocalDir & "\Settings.ini", "NetworkedIP", "IP", $SecondDX8000)
;Emergency Agent IP address
    $EA=InputBox("Setup Wizard", "Enter in the IP address of the client machine that will receive the Emergency Agent video alerts (this will be the machine the script runs on):", "10.80.2.219")
    IniWrite($LocalDir & "\Settings.ini", "ClientIP", "IP", $EA)
;Export drive
    $drive=InputBox("Setup Wizard", "The automation script needs a folder to export data for export testing.  Enter in the drive name of your superb public share folder (i.e. rgarcia, nhunter, etc.):", "rgarcia")
    IniWrite($LocalDir & "\Settings.ini", "Drive", "Path", $drive)
;Drive username
    $driveUsername=InputBox("Setup Wizard", "Enter in your username for this drive (the same used for superb):", "rgarcia")
    IniWrite($LocalDir & "\Settings.ini", "User", "User", $driveUsername)
;Drive password
    $drivePassword=InputBox("Setup Wizard", "Enter in your password (the same used for superb):", "")
    IniWrite($LocalDir & "\Settings.ini", "Password", "Password", $drivePassword)
;First run is now off
    IniWrite($LocalDir & "\Settings.ini", "FirstTime", "FirstRun", "No")
    MsgBox(0,'Finished!', 'The automation setup has been complete!  These settings can be changed at any time under File -> Run Wizard, or Edit -> Edit Settings.  Click OK to continue.')
EndFunc  ;==>Wizard

You're probably not going to be able to run it, since it requires the presence of other files...

but anyway, that's what it is. The GUI looks fine until I change the icon.

Share this post


Link to post
Share on other sites

well i guess you missed my post

your program is messed up because you edited the .exe and corrupted it

go to start menu\Programs\AutoIt v3\Compile Script to .exe

from here you can choose the icon to use


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