Sign in to follow this  
Followers 0
dufran3

GUI and Array examples in my RDT

6 posts in this topic

I was going to post this in example scripts, but I'm actually looking for suggestions to. I'm mainly posting this because I would like people to be able to learn some things from it. The newer autoit users may find it helpful. I will give you a rundown of what this script is supposed to do. The RDT.au3, which is the main file, creates a gui with 5 tabs with checkboxes in each tab. All the checkboxes are dynamically created using a For loop( I didn't write that loop, I got it from a member of the forums, thx!) when you select what you want installed, it then calls the _Install function, which loops through each tab and each checkbox, then calls the function associated with that checkbox, this is where the multi-dimensonal array came in handy. All the functions are in a seperate functions.au3 file, but I didn't include that because those are just install routines, and it makes registry changes. I wanted people to be able to run this without worry, so I didn't include that file. If you have any suggestions about anything that maybe I did an awkward way...or looks funny to you. Please do tell!!!! THXXX!!! I hope that people will benefit from this.

Attached are all the files you need in the proper directory structure to run the gui. Let me know what you think.

;RDT for AutoIt Forum
#cs
        KMC PC Customization with GUI
    
        Author: Kevin Sanders
    
        Description:
        The purpose of this script is to setup and customize a computer before deployment.
        There are options that let you choose what to install and what not to install.
    
        License:  This script can be freely copied and distributed, as long as it is not
                sold for ANY fee (including "distrobution" costs.)  Any modification to
                this script must be submitted to the original author if the modified script
                is distributed in any manner.  Any modification must include this header
                information with this licence, disclaimer and original author information in tact.
    
        Disclaimer: The author is not responsible for any damage or harm caused by this
                    script.  USE AT YOUR OWN RISK.  There is no warranty, express or implied.
                    

        Revision History
        03-08-2007  Testing1: - Initial Testing
                              - Added Tabs
                              - Added Items using "StringSplit"
        03-15-2007  Testing2: - Programs, Software, and Settings Tab
                              - Changed items from "StringSplit" to using a multidimensional array
                              - Added mouse-over feature on buttons
                              - Changed Xskin GUI images and also header image
                              - Named it "Rapid Deployment Tool"
        03-28-2007  2.0:
                              - Changed buttons from being xskin, to using custom made images for buttons faces
                              - Changed background color of tab
                              - Changed Selectall and Deselect all functions for each tab into one function with select case statements
                              - Added icons Tab
        03-28-2007  2.1:
                              - Renamed "Programs" tab to "Clinical"
                              - Changed all refrences to "Programs" and "prog" to "clinical"
                              - Renamed "Desktop Software" to "Desktop"
                              - Changed all refrences to "Desktop Software" and "soft" to "Desktop"
                              - Added icons to the tabs
                              - Added Misc Tab
        03-29-2007  2.2:
                              - Removed commented lines and cleaned up white space
                              - Changed tab icons to be located on fs1
                              - Using FileInstall to install icons locally
                              - Removed Icons tab and moved all contents to Misc tab
                              - Added Muse, Centricity and Kelley's Paging to Misc Tab(no functions for them yet)
                              - Added Printkey to Desktop tab(no function yet)
                              - Added 3M to Clinical tab(no function yet)
                              - Increased size og GUI and Tab by 25 pixels height and width
                              - Added back icon tab, but renamed to shorcut
                              - Moved Muse, Centricity and Kelley's Paging to Shortcut tab(still no functions)
                              - Changed Misc tab to Other
                              - Added debug logging features
        04-02-2007            - Changed buttons images. Now using custom images using _HoverButton
        04-10-2007  2.3:
                              - Changed buttons to use the _hoverbutton
                              - Changed button images to not have text on the image, adding text after
                              - Changed While loop so that it would not run the cpu so hard
                              - Added additional debug logging
        04-11-2007            - Changed the way the file log is worded inside of the Install function
                              - Added "levels" of debug using options 0, 1 and 2. 0 = no debug, 1 = normal debug, 2 = strong debug
                              - Changed array size to [4], to accomodate the Call function. Added Dummy parameter to functions
        04-13-2007  2.5
                              - Added Microsoft .Net2.0 installer to Other tab
                              - Added "Disable System Beep" under settings tab
        05-04-2007            - Added more logging, specifically in the Clinical loop
        06-04-2007            - Changed the checkbox label to be a part of the checkbox. Allows you to click the label to check the box.
        06-26-2007            - Added ".NET 1.1" to Other tab
        07-09-2007            - Added include files from functions.au3 due to incompatibility with new autoit version
        07-10-2007            - Added Electronic Signature Pads under clinical tab
#CE     


#include <Log_Functions.au3>
;#include <Functions2.3.au3>   <Did not include in Forum Post. This function runs all applictions and has several registry changes. So I didn't include it.
#include <GuiTab.au3>
#include <date.au3>
#include <Misc.au3>
#include <process.au3>
#include <PathFull.au3>
#include <_ButtonHover.au3>
#include <IE.au3>
#include <XSkinTabs.au3>

Opt("GUIOnEventMode", 1)

;Variables
$LocalIconPath = @WindowsDir & '\icons\'
$Skin_Folder = 'C:\Temp\xSkin'
$Icon_Folder = $Skin_Folder
$TempFolder = 'C:\Temp\RDT\'
$TempFolder_Icons = $TempFolder & 'icons\'
GLOBAL $CareManagerVersion = '7.29'
GLOBAL $StarNavigatorVersion = '11'
GLOBAL $JavaVersion = '1.4.2_13'
$XButton_Location = @ScriptDir & '\xSkin\Xbutton'
$RemoteIconPath = @ScriptDir & '\icons\'
GLOBAl $KMCDebug = 2 ;1 = normal debug 2 = strong 0 = no debug


DirCreate($TempFolder)
DirCreate($TempFolder_Icons)
GLOBAL $LogFileOpen = FileOpen('C:\Temp\RDT\RDTSetup.log', 1)

;Write Log File Header
_WriteLogFile($LogFileOpen,'-------------------------------------------------------')
_WriteLogFile($LogFileOpen, 'Starting script ' & @MDAY & "-" & @MON & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
_WriteLogFile($LogFileOpen, "Started by user: " & @UserName)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Checking for Xskin directory at "C:\Temp\XSkin"')
EndIf
;/Debug

;Check if Xskin directory exists
If Not FileExists("C:\Temp\Xskin") Then
    DirCreate('C:\Temp\Xskin')
EndIf

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Copying Xskin GUI files to temp directory')
EndIf
;/Debug


;Install Files to Temp Directory
FileInstall(@ScriptDir & '\xSkin.bmp', $Skin_Folder & '.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\1.bmp', $Skin_Folder & '\1.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\2.bmp', $Skin_Folder & '\2.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\3.bmp', $Skin_Folder & '\3.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\4.bmp', $Skin_Folder & '\4.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\5.bmp', $Skin_Folder & '\5.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\6.bmp', $Skin_Folder & '\6.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\6.bmp', $Skin_Folder & '\7.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\skin.dat', $Skin_Folder & '\skin.dat', 1)
FileInstall(@ScriptDir & '\xSkin\logo_kmc.jpg', $Skin_Folder & '\logo_kmc.jpg', 1)
;/FileInstall

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating GUI')
EndIf
;/Debug

;Create Xskin GUI
$Main = XSkinGUICreate ('Rapid Deployment Tool', 425, 525, $Skin_Folder)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Setting GUI Options')
EndIf
;/Debug

;Set GUI Options
FileCopy($RemoteIconPath & 'monitor.ico',$TempFolder_Icons & 'monitor.ico', 1)
TraySetIcon($TempFolder_Icons & 'monitor.ico')
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating GUI Picture')
EndIf
;/Debug

;Create Image on GUI
GUICtrlCreatePic($Skin_Folder & "\logo_kmc.jpg", 25, 37, 368, 53)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Tab')
EndIf
;/Debug

;Create TAB
$Tab = XSkinColorTabCreate(20, 90, 389, 402, 0xdbdbdb);$over_color) ;GUI_BKCOLOR_TRANSPARENT)

;|===========|
;Clinical Tab|
;|===========|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab1---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'clinical.ico',$TempFolder_Icons & 'clinical.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Clinical Tab Item')
EndIf
;/Debug

$ClinicalTab = GUICtrlCreateTabItem("Clinical")
GUICtrlSetImage (-1, $TempFolder_Icons & 'clinical.ico', 0)


;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating array for Clinical Tab')
EndIf
;/Debug

Dim $aClinical[15][4] = [ _
                ['3M','_3MInstall','0', '0'], _
                ['Appointments Pro OPR','_InstallApptsProOPR','0','0'], _
                ['Appointments Pro OPSS','_InstallApptsProOPSS','0','0'], _
                ['Care Manager ' & $CareManagerVersion,'_InstallCareManager','0','0'], _
                ['ds.Pathfinder','_InstalldsPathfinder','0','0'], _
                ['Electronic Signature Pads','_ESP','0','0'], _
                ['HES','_InstallHES','0','0'], _
                ['HPF Workstation 10.0','_InstallHPF','0','0'], _
                ['LaserArc','_LaserArcInstall','0','0'], _
                ['ReDoc','_InstallRedoc','0','0'], _
                ['ReportXpress','_InstallReportXpress','0','0'], _
                ['Softmed','_SSIinstall','0','0'], _
                ['Star Navigator ' & $StarNavigatorVersion,'_InstallStar','0','0'], _
                ['Tsystem (Laptop)','_InstallTsystemLaptop','0','0'], _
                ['Tsystem (PC)','_InstallTsystemPC','0','0'] _
            ]

Dim $aClinicalSize = Ubound($aClinical)
Dim $ClinicalXSkinID[ ($aClinicalSize + 1) ]
Dim $ClinicalCtrl[ ($aClinicalSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating checkboxes for Clinical tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 150, $nHeight = 20
For $i = 0 to $aClinicalSize - 1
    $ClinicalCtrl[$i] = GUICtrlCreateCheckbox($aClinical[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aClinical[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Clinical tab')
EndIf
;/Debug


;Buttons
        $ClinicalStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalStart, 'Install')
        $ClinicalSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalSelect, '_SelectAll')
        $ClinicalDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalDeselect, '_DeSelectAll')
        $ClinicalExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalExit, 'Exitier')
        
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug

;|=============|
;| Desktop Tab |
;|=============|

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab2---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'desktop.ico',$TempFolder_Icons & 'desktop.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Desktop Tab Item')
EndIf
;/Debug

$DesktopTab = GUICtrlCreateTabItem("Desktop")
GUICtrlSetImage (-1, $TempFolder_Icons & 'desktop.ico', 0)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Desktop Tab')
EndIf
;/Debug

Dim $aDesktop[12][4] = [ _
                ['Adobe Acrobat 7.0','_InstallAcrobat','1','0'], _
                ['Adobe Flash Player','_InstallFlashPlayer','1','0'], _
                ['Java ' & $JavaVersion,'_InstallJava','1','0'], _
                ['Microsoft Office XP Pro w/ SP3','_InstallOfficeXPPro','0','0'], _
                ['Microsoft Office XP Standard w/ SP3','_InstallOfficeXPStandard','0','0'], _
                ['Microsoft Office XP SP3','_InstallOfficeXPSP3','0','0'], _
                ['Microsoft Project','_ProjectInstall','0','0'], _
                ['Microsoft Publisher','_PublisherInstall','0','0'], _
                ['Microsoft Visio','_VisioInstall','0','0'], _
                ['QuickTime','_QuickTime','1','0'], _
                ['PrintKey','_PrintKeyInstall','0','0'], _
                ['Sophos Anti-Virus','_InstallSophos','1','0'] _
            ]

Dim $aDesktopSize = Ubound($aDesktop)
Dim $deskXSkinID[ ($aDesktopSize + 1) ]
Dim $DeskCtrl[ ($aDesktopSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Desktop tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 200, $nHeight = 20
For $i = 0 to $aDesktopSize - 1
    $DeskCtrl[$i] = GUICtrlCreateCheckbox($aDesktop[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aDesktop[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Desktop tab')
EndIf
;/Debug


;Buttons
        $DesktopStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopStart, 'Install')
        $DesktopSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopSelect, '_SelectAll')
        $DesktopDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopDeselect, '_DeSelectAll')
        $DesktopExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopExit, 'Exitier')
        
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug

;|============|
;|Settings Tab|
;|============|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab3---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'settings.ico',$TempFolder_Icons & 'settings.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Settings Tab Item')
EndIf
;/Debug

$SettingsTab = GUICtrlCreateTabItem("Settings")
GUICtrlSetImage (-1, $TempFolder_Icons & 'settings.ico', 0)

;Function Variables
$szAutoUpPass = 'HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU'
$szClassicThemePass = 'Windows Classic'

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Settings Tab')
EndIf
;/Debug

Dim $aSettings[14][4] = [ _
                ['Add Domain Users','_AddDomainUsers','1', '0'], _
                ['Classic Control Panel','_ClassicControlPanel','1','0'], _
                ['Classic Start Menu','_ClassicStart','1','0'], _
                ['Classic Windows Theme','_ClassicTheme','1',$szClassicThemePass], _
                ['Disable Auto Updates','_DisAutoUp','1',$szAutoUpPass], _
                ['Disable Firewall','_DisFirewall','1','0'], _
                ['Disable System Beep','_DisableSystemBeep','1','0'], _
                ['Disable Print Balloon','_disprintballoon','1','0'], _
                ['Icon Cleanup','_IconCleanup','1','0'], _
                ['Internet Explorer Settings','_IESettings','1','0'], _
                ['Mute Sound','_Mute','1','0'], _
                ['Power Settings(Laptop)','_PowerLaptop','0','0'], _
                ['Power Settings(PC)','_PowerPC','0','0'], _
                ['Remove Windows Messenger','_RemMessenger','1','0'] _
            ]

Dim $aSettingsSize = Ubound($aSettings)
Dim $settXSkinID[ ($aSettingsSize + 1) ]
Dim $SettCtrl[ ($aSettingsSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Settings')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 200, $nHeight = 20
For $i = 0 to $aSettingsSize - 1
    $SettCtrl[$i] = GUICtrlCreateCheckbox($aSettings[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aSettings[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Settings tab')
EndIf
;/Debug

;Buttons
        $SettingsStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsStart, 'Install')
        $SettingsSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsSelect, '_SelectAll')
        $SettingsDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsDeselect, '_DeSelectAll')
        $SettingsExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsExit, 'Exitier')
        
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug

;|============|
;|Shortcut Tab|
;|============|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab4---------------')
EndIf
;/Debug


FileCopy($RemoteIconPath & 'shortcut.ico',$TempFolder_Icons & 'shortcut.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Shortcuts Tab Item')
EndIf
;/Debug

$ShortcutTab = GUICtrlCreateTabItem("Shortcuts")
GUICtrlSetImage (-1, $TempFolder_Icons & 'shortcut.ico', 0)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Shortcuts Tab')
EndIf
;/Debug

Dim $aShortcut[6][4] = [ _
                ['Centricity Web','_iCentricityWeb','0','0'], _
                ['Chart Connect','_iChartConnect','0','0'], _
                ["Kelley's Paging",'_iKelleysPaging','0','0'], _
                ['Muse','_iMuse','0','0'], _
                ['Portal','_iPortalIcon','0','0'], _
                ['Schedule Quest','_iScheduleQuest','0','0'] _
            ]
            
Dim $aShortcutSize = Ubound($aShortcut)
Dim $ShortcutXSkinID[ ($aShortcutSize + 1) ]
Dim $ShortcutCtrl[ ($aShortcutSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Shortcuts tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 100, $nHeight = 20
For $i = 0 to $aShortcutSize - 1
    $ShortcutCtrl[$i] = GUICtrlCreateCheckbox($aShortcut[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aShortcut[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Shortcuts tab')
EndIf
;/Debug

;Buttons
        $ShortcutsStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsStart, 'Install')
        $ShortcutsSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsSelect, '_SelectAll')
        $ShortcutsDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsDeselect, '_DeSelectAll')
        $ShortcutsExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsExit, 'Exitier')
        
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug
;|===========|
;| Other Tab |
;|===========|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab5---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'other.ico',$TempFolder_Icons & 'other.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Other Tab Item')
EndIf
;/Debug

$OtherTab = GUICtrlCreateTabItem("Other")
GUICtrlSetImage (-1, $TempFolder_Icons & 'other.ico', 0)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Other Tab')
EndIf
;/Debug

Dim $aOther[4][4] = [ _
                ['De-Crapifier','_DeCrapifier','0','0'], _
                ['Microsoft .NET 1.1','_DotNet11Install','0','0'], _
                ['Microsoft .NET 2.0','_InstallDotNet20','0','0'], _
                ['Outlook Script','_OutlookScript','0','0'] _
            ]
            
Dim $aOtherSize = Ubound($aOther)
Dim $OtherXSkinID[ ($aOtherSize + 1) ]
Dim $otherCtrl[ ($aOtherSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Other tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 100, $nHeight = 20
For $i = 0 to $aOtherSize - 1
    $OtherCtrl[$i] = GUICtrlCreateCheckbox($aOther[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aOther[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Other tab')
EndIf
;/Debug

;Buttons
        $OtherStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherStart, 'Install')
        $OtherSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherSelect, '_SelectAll')
        $OtherDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherDeselect, '_DeSelectAll')
        $OtherExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherExit, 'Exitier')
        
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab5---------------')
EndIf
;/Debug

GUISetOnEvent($GUI_EVENT_CLOSE, "exitier", $Main)
GUISetState()
GUICtrlSetState($Tab, $GUI_ONTOP)

While 1 ;GUIGetMsg() <> $GUI_EVENT_CLOSE
    _CheckHoverAndPressed ($Main)
    Sleep(10)
WEnd

FileClose($LogFileOpen)

If $FailedFlag == 1 Then
    _SMTPMessage()
EndIf

Func Install()
    ;Debug
    If $KMCDebug == 2 or 3 Then _WriteLogFile($LogFileOpen, 'Entering Install function')
    
    GUISetState(@SW_HIDE,$main)
    
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering loop for Clinical Tab')
    ;Loop through Clinical Array
    For $i = 0 to $aClinicalSize - 1
        $checkboxstatus = GUICtrlRead($ClinicalCtrl[$i])
        If (($checkboxstatus == 1) And ($aClinical[$i][0] <> 'HES')) Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Clinical: ' & '"' & $aClinical[$i][0] & '"' & " has control ID: " & $ClinicalCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aClinical[$i][1] & ' is the function name assigned to control ID: ' & $ClinicalCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aClinical[$i][1] & ' and passing it: ' & $aClinical[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aClinical[$i][0] & '"')
            ;Debug Profiling
            $aClinicalStartTime = TimerInit()
            ;Calling Function
            Call($aClinical[$i][1],$aClinical[$i][3])
            ;Debug Profiling
            $aClinicalEndTime = int(TimerDiff($aClinicalStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aClinicalEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Clinical Tab')
    
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering loop for Desktop Tab')
    ;Loop through Desktop Array
    For $i = 0 to $aDesktopSize -1
        $checkboxstatus = GUICtrlRead($DeskCtrl[$i])
        If (($checkboxstatus == 1) And ($aDesktop[$i][0] <> 'Sophos Anti-Virus')) Then
                If $KMCDebug == 3 Then
                _WriteLogFile($LogFileOpen,'Desktop Tab: ' & '"' & $aDesktop[$i][0] & '"' & " has control ID: " & $DeskCtrl[$i] & ' and is checked')
                _WriteLogFile($LogFileOpen, $aDesktop[$i][1] & ' is the function name assigned to control ID: ' & $DeskCtrl[$i])
                EndIf
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen, 'Calling: ' & $aDesktop[$i][1] & ' and passing it: ' & $aDesktop[$i][3])
                EndIf
                If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aDesktop[$i][0] & '"')
                ;Debug Profiling
                $aDesktopStartTime = TimerInit()
                ;Calling Function
                Call($aDesktop[$i][1],$aDesktop[$i][3])
                ;Debug Profiling
                $aDesktopEndTime = int(TimerDiff($aDesktopStartTime)) / 1000
                ;Writing to Log
                If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aDesktopEndTime & ' second(s)')
            ;EndIf
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Desktop Tab')
    
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Settings Tab')
    ;Loop through Settings Array
    For $i = 0 to $aSettingsSize -1
        $checkboxstatus = GUICtrlRead($SettCtrl[$i])
        If $checkboxstatus == 1 Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Settings Tab: ' & '"' & $aSettings[$i][0] & '"' & " has control ID: " & $SettCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aSettings[$i][1] & ' is the function name assigned to control ID: ' & $SettCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aSettings[$i][1] & ' and passing it: ' & $aSettings[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aSettings[$i][0] & '"')
            ;Debug Profiling
            $aSettingsStartTime = TimerInit()
            ;Calling Function
            Call($aSettings[$i][1], $aSettings[$i][3])
            ;Debug Profiling
            $aSettingsEndTime = int(TimerDiff($aSettingsStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aSettingsEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Settings Tab')
    
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Shortcuts Tab')
    ;Loop through Shortcut Array
    For $i = 0 to $aShortcutSize -1
        $checkboxstatus = GUICtrlRead($ShortcutCtrl[$i])
        If $checkboxstatus == 1 Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Shortcut Tab: ' & '"' & $aShortcut[$i][0] & '"' & " has control ID: " & $ShortcutCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aShortcut[$i][1] & ' is the function name assigned to control ID: ' & $ShortcutCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aShortcut[$i][1] & ' and passing it: ' & $aShortcut[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aShortcut[$i][0] & '"')
            ;Debug Profiling
            $aShortcutStartTime = TimerInit()
            ;Calling Function
            Call($aShortcut[$i][1],$aShortcut[$i][3])
            ;Debug Profiling
            $aShortcutEndTime = int(TimerDiff($aShortcutStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aShortcutEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Shortcuts Tab')
    
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Other Tab')
    ;Loop through Other Array
    For $i = 0 to $aOtherSize -1
        $checkboxstatus = GUICtrlRead($OtherCtrl[$i])
        If $checkboxstatus == 1 Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Other Tab: ' & '"' & $aOther[$i][0] & '"' & " has control ID: " & $OtherCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aOther[$i][1] & ' is the function name assigned to control ID: ' & $OtherCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aOther[$i][1] & ' and passing it: ' & $aOther[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aOther[$i][0] & '"')
            ;Debug Profiling
            $aOtherStartTime = TimerInit()
            ;Calling Function
            Call($aOther[$i][1],$aOther[$i][3])
            ;Debug Profiling
            $aOtherEndTime = int(TimerDiff($aOtherStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aOtherEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Other Tab')
    
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Clinical Tab for HES check')
    ;Loop Through Clinical Array for HES
    For $i = 0 to $aClinicalSize - 1
        If StringInStr($aClinical[$i][0], 'HES') Then
            $checkboxstatus = GUICtrlRead($ClinicalCtrl[$i])
            If $checkboxstatus == 1 Then
                If $KMCDebug == 3 Then
                _WriteLogFile($LogFileOpen,'Clinical Tab: ' & '"' & $aClinical[$i][0] & '"' & " has control ID: " & $ClinicalCtrl[$i] & ' and is checked')
                _WriteLogFile($LogFileOpen, $aClinical[$i][1] & ' is the function name assigned to control ID: ' & $ClinicalCtrl[$i])
                EndIf
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen, 'Calling: ' & $aClinical[$i][1] & ' and passing it: ' & $aClinical[$i][3])
                EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aClinical[$i][0] & '"')
            ;Debug Profiling
            $aClinicalStartTime = TimerInit()
            ;Calling Function
            Call($aClinical[$i][1],$aClinical[$i][3])
            ;Debug Profiling
            $aClinicalEndTime = int(TimerDiff($aClinicalStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aClinicalEndTime & ' second(s)')
            EndIf
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Clinical Tab for HES check')

    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Desktop Tab for Sophos check')
    ;Loop Through Desktop Array for Sophos
    For $i = 0 to $aDesktopSize - 1
        If StringInStr($aDesktop[$i][0], 'Sophos Anti-Virus') Then
            $checkboxstatus = GUICtrlRead($DeskCtrl[$i])
            If $checkboxstatus == 1 Then
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen,'Desktop Tab: ' & '"' & $aDesktop[$i][0] & '"' & " has control ID: " & $DeskCtrl[$i] & ' and is checked')
                _WriteLogFile($LogFileOpen, $aDesktop[$i][1] & ' is the function name assigned to control ID: ' & $DeskCtrl[$i])
                EndIf
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen, 'Calling: ' & $aDesktop[$i][1] & ' and passing it: ' & $aDesktop[$i][3])
                EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aDesktop[$i][0] & '"')
            ;Debug Profiling
            $aDesktopStartTime = TimerInit()
            ;Calling Function
            Call($aDesktop[$i][1],$aDesktop[$i][3])
            ;Debug Profiling
            $aDesktopEndTime = int(TimerDiff($aDesktopStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aDesktopEndTime & ' second(s)')
            EndIf
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Desktop Tab for Sophos check')
    If $KMCDebug == 1 OR 2 OR 3 Then _WriteLogFile($LogFileOpen, 'Removing Temp Directory: "C:\Temp\Xskin"')

    DirRemove('C:\Temp\Xskin',1)
    DirRemove($TempFolder_Icons,1)
    _WriteLogFile($LogFileOpen,'Exiting Script')
    FileClose($LogFileOpen)
    ;If $FailedFlag == 1 Then
    _SMTPMessage()
    ;EndIf
MsgBox(0,'RDT Complete','Script is finished')
    Exit
EndFunc

Func _SelectAll()
    ;Debug
    If $KMCDebug == 3  Then _WriteLogFile($LogFileOpen, 'Entering _SelectAll function')
    
    $current = _GUICtrlTabGetCurFocus($Tab)
    Switch $current
        Case 0
            For $i = 0 To UBound($ClinicalCtrl) - 1
                GUICtrlSetState($ClinicalCtrl[$i], $GUI_CHECKED)
            Next
        Case 1
            For $i = 0 To UBound($deskCtrl) - 1
                GUICtrlSetState($deskCtrl[$i], $GUI_CHECKED)
            Next
        Case 2
            For $i = 0 To UBound($SettCtrl) - 1
                GUICtrlSetState($SettCtrl[$i], $GUI_CHECKED)
            Next
        Case 3
            For $i = 0 to UBound($ShortcutCtrl) - 1
                GUICtrlSetState($ShortcutCtrl[$i], $GUI_CHECKED)
            Next
        Case 4
            For $i = 0 to UBound($OtherCtrl) - 1
                GUICtrlSetState($OtherCtrl[$i], $GUI_CHECKED)
            Next
    EndSwitch
    ;Debug
    If $KMCDebug == 3  Then _WriteLogFile($LogFileOpen, 'Exiting _SelectAll function')
EndFunc


Func _DeselectAll()
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering DeselectAll function')
    
    $current = _GUICtrlTabGetCurFocus($Tab)
    Switch $current
        Case 0
            For $i = 0 To UBound($ClinicalCtrl) - 1
                GUICtrlSetState($ClinicalCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 1
            For $i = 0 To UBound($deskCtrl) - 1
                GUICtrlSetState($deskCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 2
            For $i = 0 To UBound($SettCtrl) - 1
                GUICtrlSetState($SettCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 3
            For $i = 0 to UBound($ShortcutCtrl) - 1
                GUICtrlSetState($ShortcutCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 4
            For $i = 0 to UBound($OtherCtrl) - 1
                GUICtrlSetState($OtherCtrl[$i], $GUI_UNCHECKED)
            Next
    EndSwitch
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting DeselectAll function')
EndFunc

Func _WriteLogFile($sLogPath, $sLogMsg)
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $sDateNow
    Local $sTimeNow
    Local $sMsg
    Local $hOpenFile
    Local $hWriteFile

    $sDateNow = @YEAR & "-" & @MON & "-" & @MDAY
    $sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC
    $sMsg = $sDateNow & " " & $sTimeNow & " : " & $sLogMsg

    $hWriteFile = FileWriteLine($sLogPath, $sMsg)

    If $hWriteFile = -1 Then
        SetError(2)
        Return 0
    EndIf
EndFunc   ;==>_FileWriteLog

Func Exitier()
    DirRemove('C:\Temp\Xskin',1)
    DirRemove($TempFolder_Icons,1)
    Exit
EndFunc   ;==>Exitier

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            Exit
    EndSelect

EndFunc   ;==>SpecialEvents

RDT.zip

Share this post


Link to post
Share on other sites



I know it's a lot to look at. Just let me know if you have any comments.

Share this post


Link to post
Share on other sites

C:\Documents and Settings\ROBERT M\Desktop\RDT\RDT\RDT.au3(660,15) : ERROR: _SMTPMessage(): undefined function.

_SMTPMessage()

~~~~~~~~~~~~~^

C:\Documents and Settings\ROBERT M\Desktop\RDT\RDT\RDT.au3 - 1 error(s), 0 warning(s)

!>11:05:15 AU3Check ended.rc:2

+>11:05:15 AutoIt3Wrapper Finished

>Exit code: 0 Time: 0.667

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

oh crap, yeh. That function is in the functions.au3 file that I did not include. All it does is send an e-mail when it is run.

all that needs to be done is comment line 659 - 661

here is the script with those lines commented

;RDT for AutoIt Forum
#cs
        KMC PC Customization with GUI
   
        Author: Kevin Sanders
   
        Description:
        The purpose of this script is to setup and customize a computer before deployment.
        There are options that let you choose what to install and what not to install.
   
        License:  This script can be freely copied and distributed, as long as it is not
                sold for ANY fee (including "distrobution" costs.)  Any modification to
                this script must be submitted to the original author if the modified script
                is distributed in any manner.  Any modification must include this header
                information with this licence, disclaimer and original author information in tact.
   
        Disclaimer: The author is not responsible for any damage or harm caused by this
                    script.  USE AT YOUR OWN RISK.  There is no warranty, express or implied.
                   

        Revision History
        03-08-2007  Testing1: - Initial Testing
                              - Added Tabs
                              - Added Items using "StringSplit"
        03-15-2007  Testing2: - Programs, Software, and Settings Tab
                              - Changed items from "StringSplit" to using a multidimensional array
                              - Added mouse-over feature on buttons
                              - Changed Xskin GUI images and also header image
                              - Named it "Rapid Deployment Tool"
        03-28-2007  2.0:
                              - Changed buttons from being xskin, to using custom made images for buttons faces
                              - Changed background color of tab
                              - Changed Selectall and Deselect all functions for each tab into one function with select case statements
                              - Added icons Tab
        03-28-2007  2.1:
                              - Renamed "Programs" tab to "Clinical"
                              - Changed all refrences to "Programs" and "prog" to "clinical"
                              - Renamed "Desktop Software" to "Desktop"
                              - Changed all refrences to "Desktop Software" and "soft" to "Desktop"
                              - Added icons to the tabs
                              - Added Misc Tab
        03-29-2007  2.2:
                              - Removed commented lines and cleaned up white space
                              - Changed tab icons to be located on fs1
                              - Using FileInstall to install icons locally
                              - Removed Icons tab and moved all contents to Misc tab
                              - Added Muse, Centricity and Kelley's Paging to Misc Tab(no functions for them yet)
                              - Added Printkey to Desktop tab(no function yet)
                              - Added 3M to Clinical tab(no function yet)
                              - Increased size og GUI and Tab by 25 pixels height and width
                              - Added back icon tab, but renamed to shorcut
                              - Moved Muse, Centricity and Kelley's Paging to Shortcut tab(still no functions)
                              - Changed Misc tab to Other
                              - Added debug logging features
        04-02-2007        - Changed buttons images. Now using custom images using _HoverButton
        04-10-2007  2.3:
                              - Changed buttons to use the _hoverbutton
                              - Changed button images to not have text on the image, adding text after
                              - Changed While loop so that it would not run the cpu so hard
                              - Added additional debug logging
        04-11-2007        - Changed the way the file log is worded inside of the Install function
                              - Added "levels" of debug using options 0, 1 and 2. 0 = no debug, 1 = normal debug, 2 = strong debug
                              - Changed array size to [4], to accomodate the Call function. Added Dummy parameter to functions
        04-13-2007  2.5
                              - Added Microsoft .Net2.0 installer to Other tab
                              - Added "Disable System Beep" under settings tab
        05-04-2007            - Added more logging, specifically in the Clinical loop
        06-04-2007            - Changed the checkbox label to be a part of the checkbox. Allows you to click the label to check the box.
        06-26-2007            - Added ".NET 1.1" to Other tab
        07-09-2007            - Added include files from functions.au3 due to incompatibility with new autoit version
        07-10-2007            - Added Electronic Signature Pads under clinical tab
#CE     


#include <Log_Functions.au3>
;#include <Functions2.3.au3>   <Did not include in Forum Post. This function runs all applictions and has several registry changes. So I didn't include it.
#include <GuiTab.au3>
#include <date.au3>
#include <Misc.au3>
#include <process.au3>
#include <PathFull.au3>
#include <_ButtonHover.au3>
#include <IE.au3>
#include <XSkinTabs.au3>

Opt("GUIOnEventMode", 1)

;Variables
$LocalIconPath = @WindowsDir & '\icons\'
$Skin_Folder = 'C:\Temp\xSkin'
$Icon_Folder = $Skin_Folder
$TempFolder = 'C:\Temp\RDT\'
$TempFolder_Icons = $TempFolder & 'icons\'
GLOBAL $CareManagerVersion = '7.29'
GLOBAL $StarNavigatorVersion = '11'
GLOBAL $JavaVersion = '1.4.2_13'
$XButton_Location = @ScriptDir & '\xSkin\Xbutton'
$RemoteIconPath = @ScriptDir & '\icons\'
GLOBAl $KMCDebug = 2 ;1 = normal debug 2 = strong 0 = no debug


DirCreate($TempFolder)
DirCreate($TempFolder_Icons)
GLOBAL $LogFileOpen = FileOpen('C:\Temp\RDT\RDTSetup.log', 1)

;Write Log File Header
_WriteLogFile($LogFileOpen,'-------------------------------------------------------')
_WriteLogFile($LogFileOpen, 'Starting script ' & @MDAY & "-" & @MON & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
_WriteLogFile($LogFileOpen, "Started by user: " & @UserName)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Checking for Xskin directory at "C:\Temp\XSkin"')
EndIf
;/Debug

;Check if Xskin directory exists
If Not FileExists("C:\Temp\Xskin") Then
    DirCreate('C:\Temp\Xskin')
EndIf

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Copying Xskin GUI files to temp directory')
EndIf
;/Debug


;Install Files to Temp Directory
FileInstall(@ScriptDir & '\xSkin.bmp', $Skin_Folder & '.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\1.bmp', $Skin_Folder & '\1.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\2.bmp', $Skin_Folder & '\2.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\3.bmp', $Skin_Folder & '\3.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\4.bmp', $Skin_Folder & '\4.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\5.bmp', $Skin_Folder & '\5.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\6.bmp', $Skin_Folder & '\6.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\6.bmp', $Skin_Folder & '\7.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\skin.dat', $Skin_Folder & '\skin.dat', 1)
FileInstall(@ScriptDir & '\xSkin\logo_kmc.jpg', $Skin_Folder & '\logo_kmc.jpg', 1)
;/FileInstall

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating GUI')
EndIf
;/Debug

;Create Xskin GUI
$Main = XSkinGUICreate ('Rapid Deployment Tool', 425, 525, $Skin_Folder)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Setting GUI Options')
EndIf
;/Debug

;Set GUI Options
FileCopy($RemoteIconPath & 'monitor.ico',$TempFolder_Icons & 'monitor.ico', 1)
TraySetIcon($TempFolder_Icons & 'monitor.ico')
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating GUI Picture')
EndIf
;/Debug

;Create Image on GUI
GUICtrlCreatePic($Skin_Folder & "\logo_kmc.jpg", 25, 37, 368, 53)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Tab')
EndIf
;/Debug

;Create TAB
$Tab = XSkinColorTabCreate(20, 90, 389, 402, 0xdbdbdb);$over_color) ;GUI_BKCOLOR_TRANSPARENT)

;|===========|
;Clinical Tab|
;|===========|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab1---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'clinical.ico',$TempFolder_Icons & 'clinical.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Clinical Tab Item')
EndIf
;/Debug

$ClinicalTab = GUICtrlCreateTabItem("Clinical")
GUICtrlSetImage (-1, $TempFolder_Icons & 'clinical.ico', 0)


;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating array for Clinical Tab')
EndIf
;/Debug

Dim $aClinical[15][4] = [ _
                ['3M','_3MInstall','0', '0'], _
                ['Appointments Pro OPR','_InstallApptsProOPR','0','0'], _
                ['Appointments Pro OPSS','_InstallApptsProOPSS','0','0'], _
                ['Care Manager ' & $CareManagerVersion,'_InstallCareManager','0','0'], _
                ['ds.Pathfinder','_InstalldsPathfinder','0','0'], _
                ['Electronic Signature Pads','_ESP','0','0'], _
                ['HES','_InstallHES','0','0'], _
                ['HPF Workstation 10.0','_InstallHPF','0','0'], _
                ['LaserArc','_LaserArcInstall','0','0'], _
                ['ReDoc','_InstallRedoc','0','0'], _
                ['ReportXpress','_InstallReportXpress','0','0'], _
                ['Softmed','_SSIinstall','0','0'], _
                ['Star Navigator ' & $StarNavigatorVersion,'_InstallStar','0','0'], _
                ['Tsystem (Laptop)','_InstallTsystemLaptop','0','0'], _
                ['Tsystem (PC)','_InstallTsystemPC','0','0'] _
            ]

Dim $aClinicalSize = Ubound($aClinical)
Dim $ClinicalXSkinID[ ($aClinicalSize + 1) ]
Dim $ClinicalCtrl[ ($aClinicalSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating checkboxes for Clinical tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 150, $nHeight = 20
For $i = 0 to $aClinicalSize - 1
    $ClinicalCtrl[$i] = GUICtrlCreateCheckbox($aClinical[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aClinical[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Clinical tab')
EndIf
;/Debug


;Buttons
        $ClinicalStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalStart, 'Install')
        $ClinicalSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalSelect, '_SelectAll')
        $ClinicalDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalDeselect, '_DeSelectAll')
        $ClinicalExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug

;|=============|
;| Desktop Tab |
;|=============|

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab2---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'desktop.ico',$TempFolder_Icons & 'desktop.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Desktop Tab Item')
EndIf
;/Debug

$DesktopTab = GUICtrlCreateTabItem("Desktop")
GUICtrlSetImage (-1, $TempFolder_Icons & 'desktop.ico', 0)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Desktop Tab')
EndIf
;/Debug

Dim $aDesktop[12][4] = [ _
                ['Adobe Acrobat 7.0','_InstallAcrobat','1','0'], _
                ['Adobe Flash Player','_InstallFlashPlayer','1','0'], _
                ['Java ' & $JavaVersion,'_InstallJava','1','0'], _
                ['Microsoft Office XP Pro w/ SP3','_InstallOfficeXPPro','0','0'], _
                ['Microsoft Office XP Standard w/ SP3','_InstallOfficeXPStandard','0','0'], _
                ['Microsoft Office XP SP3','_InstallOfficeXPSP3','0','0'], _
                ['Microsoft Project','_ProjectInstall','0','0'], _
                ['Microsoft Publisher','_PublisherInstall','0','0'], _
                ['Microsoft Visio','_VisioInstall','0','0'], _
                ['QuickTime','_QuickTime','1','0'], _
                ['PrintKey','_PrintKeyInstall','0','0'], _
                ['Sophos Anti-Virus','_InstallSophos','1','0'] _
            ]

Dim $aDesktopSize = Ubound($aDesktop)
Dim $deskXSkinID[ ($aDesktopSize + 1) ]
Dim $DeskCtrl[ ($aDesktopSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Desktop tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 200, $nHeight = 20
For $i = 0 to $aDesktopSize - 1
    $DeskCtrl[$i] = GUICtrlCreateCheckbox($aDesktop[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aDesktop[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Desktop tab')
EndIf
;/Debug


;Buttons
        $DesktopStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopStart, 'Install')
        $DesktopSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopSelect, '_SelectAll')
        $DesktopDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopDeselect, '_DeSelectAll')
        $DesktopExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug

;|============|
;|Settings Tab|
;|============|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab3---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'settings.ico',$TempFolder_Icons & 'settings.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Settings Tab Item')
EndIf
;/Debug

$SettingsTab = GUICtrlCreateTabItem("Settings")
GUICtrlSetImage (-1, $TempFolder_Icons & 'settings.ico', 0)

;Function Variables
$szAutoUpPass = 'HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU'
$szClassicThemePass = 'Windows Classic'

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Settings Tab')
EndIf
;/Debug

Dim $aSettings[14][4] = [ _
                ['Add Domain Users','_AddDomainUsers','1', '0'], _
                ['Classic Control Panel','_ClassicControlPanel','1','0'], _
                ['Classic Start Menu','_ClassicStart','1','0'], _
                ['Classic Windows Theme','_ClassicTheme','1',$szClassicThemePass], _
                ['Disable Auto Updates','_DisAutoUp','1',$szAutoUpPass], _
                ['Disable Firewall','_DisFirewall','1','0'], _
                ['Disable System Beep','_DisableSystemBeep','1','0'], _
                ['Disable Print Balloon','_disprintballoon','1','0'], _
                ['Icon Cleanup','_IconCleanup','1','0'], _
                ['Internet Explorer Settings','_IESettings','1','0'], _
                ['Mute Sound','_Mute','1','0'], _
                ['Power Settings(Laptop)','_PowerLaptop','0','0'], _
                ['Power Settings(PC)','_PowerPC','0','0'], _
                ['Remove Windows Messenger','_RemMessenger','1','0'] _
            ]

Dim $aSettingsSize = Ubound($aSettings)
Dim $settXSkinID[ ($aSettingsSize + 1) ]
Dim $SettCtrl[ ($aSettingsSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Settings')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 200, $nHeight = 20
For $i = 0 to $aSettingsSize - 1
    $SettCtrl[$i] = GUICtrlCreateCheckbox($aSettings[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aSettings[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Settings tab')
EndIf
;/Debug

;Buttons
        $SettingsStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsStart, 'Install')
        $SettingsSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsSelect, '_SelectAll')
        $SettingsDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsDeselect, '_DeSelectAll')
        $SettingsExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug

;|============|
;|Shortcut Tab|
;|============|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab4---------------')
EndIf
;/Debug


FileCopy($RemoteIconPath & 'shortcut.ico',$TempFolder_Icons & 'shortcut.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Shortcuts Tab Item')
EndIf
;/Debug

$ShortcutTab = GUICtrlCreateTabItem("Shortcuts")
GUICtrlSetImage (-1, $TempFolder_Icons & 'shortcut.ico', 0)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Shortcuts Tab')
EndIf
;/Debug

Dim $aShortcut[6][4] = [ _
                ['Centricity Web','_iCentricityWeb','0','0'], _
                ['Chart Connect','_iChartConnect','0','0'], _
                ["Kelley's Paging",'_iKelleysPaging','0','0'], _
                ['Muse','_iMuse','0','0'], _
                ['Portal','_iPortalIcon','0','0'], _
                ['Schedule Quest','_iScheduleQuest','0','0'] _
            ]
           
Dim $aShortcutSize = Ubound($aShortcut)
Dim $ShortcutXSkinID[ ($aShortcutSize + 1) ]
Dim $ShortcutCtrl[ ($aShortcutSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Shortcuts tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 100, $nHeight = 20
For $i = 0 to $aShortcutSize - 1
    $ShortcutCtrl[$i] = GUICtrlCreateCheckbox($aShortcut[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aShortcut[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Shortcuts tab')
EndIf
;/Debug

;Buttons
        $ShortcutsStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsStart, 'Install')
        $ShortcutsSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsSelect, '_SelectAll')
        $ShortcutsDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsDeselect, '_DeSelectAll')
        $ShortcutsExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug
;|===========|
;| Other Tab |
;|===========|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab5---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'other.ico',$TempFolder_Icons & 'other.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Other Tab Item')
EndIf
;/Debug

$OtherTab = GUICtrlCreateTabItem("Other")
GUICtrlSetImage (-1, $TempFolder_Icons & 'other.ico', 0)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Other Tab')
EndIf
;/Debug

Dim $aOther[4][4] = [ _
                ['De-Crapifier','_DeCrapifier','0','0'], _
                ['Microsoft .NET 1.1','_DotNet11Install','0','0'], _
                ['Microsoft .NET 2.0','_InstallDotNet20','0','0'], _
                ['Outlook Script','_OutlookScript','0','0'] _
            ]
           
Dim $aOtherSize = Ubound($aOther)
Dim $OtherXSkinID[ ($aOtherSize + 1) ]
Dim $otherCtrl[ ($aOtherSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Other tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 100, $nHeight = 20
For $i = 0 to $aOtherSize - 1
    $OtherCtrl[$i] = GUICtrlCreateCheckbox($aOther[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aOther[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Other tab')
EndIf
;/Debug

;Buttons
        $OtherStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherStart, 'Install')
        $OtherSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherSelect, '_SelectAll')
        $OtherDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherDeselect, '_DeSelectAll')
        $OtherExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab5---------------')
EndIf
;/Debug

GUISetOnEvent($GUI_EVENT_CLOSE, "exitier", $Main)
GUISetState()
GUICtrlSetState($Tab, $GUI_ONTOP)

While 1 ;GUIGetMsg() <> $GUI_EVENT_CLOSE
    _CheckHoverAndPressed ($Main)
    Sleep(10)
WEnd

FileClose($LogFileOpen)

;If $FailedFlag == 1 Then
;   _SMTPMessage()
;EndIf

Func Install()
    ;Debug
    If $KMCDebug == 2 or 3 Then _WriteLogFile($LogFileOpen, 'Entering Install function')
   
    GUISetState(@SW_HIDE,$main)
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering loop for Clinical Tab')
    ;Loop through Clinical Array
    For $i = 0 to $aClinicalSize - 1
        $checkboxstatus = GUICtrlRead($ClinicalCtrl[$i])
        If (($checkboxstatus == 1) And ($aClinical[$i][0] <> 'HES')) Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Clinical: ' & '"' & $aClinical[$i][0] & '"' & " has control ID: " & $ClinicalCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aClinical[$i][1] & ' is the function name assigned to control ID: ' & $ClinicalCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aClinical[$i][1] & ' and passing it: ' & $aClinical[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aClinical[$i][0] & '"')
            ;Debug Profiling
            $aClinicalStartTime = TimerInit()
            ;Calling Function
            Call($aClinical[$i][1],$aClinical[$i][3])
            ;Debug Profiling
            $aClinicalEndTime = int(TimerDiff($aClinicalStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aClinicalEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Clinical Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering loop for Desktop Tab')
    ;Loop through Desktop Array
    For $i = 0 to $aDesktopSize -1
        $checkboxstatus = GUICtrlRead($DeskCtrl[$i])
        If (($checkboxstatus == 1) And ($aDesktop[$i][0] <> 'Sophos Anti-Virus')) Then
                If $KMCDebug == 3 Then
                _WriteLogFile($LogFileOpen,'Desktop Tab: ' & '"' & $aDesktop[$i][0] & '"' & " has control ID: " & $DeskCtrl[$i] & ' and is checked')
                _WriteLogFile($LogFileOpen, $aDesktop[$i][1] & ' is the function name assigned to control ID: ' & $DeskCtrl[$i])
                EndIf
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen, 'Calling: ' & $aDesktop[$i][1] & ' and passing it: ' & $aDesktop[$i][3])
                EndIf
                If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aDesktop[$i][0] & '"')
                ;Debug Profiling
                $aDesktopStartTime = TimerInit()
                ;Calling Function
                Call($aDesktop[$i][1],$aDesktop[$i][3])
                ;Debug Profiling
                $aDesktopEndTime = int(TimerDiff($aDesktopStartTime)) / 1000
                ;Writing to Log
                If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aDesktopEndTime & ' second(s)')
            ;EndIf
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Desktop Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Settings Tab')
    ;Loop through Settings Array
    For $i = 0 to $aSettingsSize -1
        $checkboxstatus = GUICtrlRead($SettCtrl[$i])
        If $checkboxstatus == 1 Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Settings Tab: ' & '"' & $aSettings[$i][0] & '"' & " has control ID: " & $SettCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aSettings[$i][1] & ' is the function name assigned to control ID: ' & $SettCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aSettings[$i][1] & ' and passing it: ' & $aSettings[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aSettings[$i][0] & '"')
            ;Debug Profiling
            $aSettingsStartTime = TimerInit()
            ;Calling Function
            Call($aSettings[$i][1], $aSettings[$i][3])
            ;Debug Profiling
            $aSettingsEndTime = int(TimerDiff($aSettingsStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aSettingsEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Settings Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Shortcuts Tab')
    ;Loop through Shortcut Array
    For $i = 0 to $aShortcutSize -1
        $checkboxstatus = GUICtrlRead($ShortcutCtrl[$i])
        If $checkboxstatus == 1 Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Shortcut Tab: ' & '"' & $aShortcut[$i][0] & '"' & " has control ID: " & $ShortcutCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aShortcut[$i][1] & ' is the function name assigned to control ID: ' & $ShortcutCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aShortcut[$i][1] & ' and passing it: ' & $aShortcut[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aShortcut[$i][0] & '"')
            ;Debug Profiling
            $aShortcutStartTime = TimerInit()
            ;Calling Function
            Call($aShortcut[$i][1],$aShortcut[$i][3])
            ;Debug Profiling
            $aShortcutEndTime = int(TimerDiff($aShortcutStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aShortcutEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Shortcuts Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Other Tab')
    ;Loop through Other Array
    For $i = 0 to $aOtherSize -1
        $checkboxstatus = GUICtrlRead($OtherCtrl[$i])
        If $checkboxstatus == 1 Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Other Tab: ' & '"' & $aOther[$i][0] & '"' & " has control ID: " & $OtherCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aOther[$i][1] & ' is the function name assigned to control ID: ' & $OtherCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aOther[$i][1] & ' and passing it: ' & $aOther[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aOther[$i][0] & '"')
            ;Debug Profiling
            $aOtherStartTime = TimerInit()
            ;Calling Function
            Call($aOther[$i][1],$aOther[$i][3])
            ;Debug Profiling
            $aOtherEndTime = int(TimerDiff($aOtherStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aOtherEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Other Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Clinical Tab for HES check')
    ;Loop Through Clinical Array for HES
    For $i = 0 to $aClinicalSize - 1
        If StringInStr($aClinical[$i][0], 'HES') Then
            $checkboxstatus = GUICtrlRead($ClinicalCtrl[$i])
            If $checkboxstatus == 1 Then
                If $KMCDebug == 3 Then
                _WriteLogFile($LogFileOpen,'Clinical Tab: ' & '"' & $aClinical[$i][0] & '"' & " has control ID: " & $ClinicalCtrl[$i] & ' and is checked')
                _WriteLogFile($LogFileOpen, $aClinical[$i][1] & ' is the function name assigned to control ID: ' & $ClinicalCtrl[$i])
                EndIf
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen, 'Calling: ' & $aClinical[$i][1] & ' and passing it: ' & $aClinical[$i][3])
                EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aClinical[$i][0] & '"')
            ;Debug Profiling
            $aClinicalStartTime = TimerInit()
            ;Calling Function
            Call($aClinical[$i][1],$aClinical[$i][3])
            ;Debug Profiling
            $aClinicalEndTime = int(TimerDiff($aClinicalStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aClinicalEndTime & ' second(s)')
            EndIf
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Clinical Tab for HES check')

    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Desktop Tab for Sophos check')
    ;Loop Through Desktop Array for Sophos
    For $i = 0 to $aDesktopSize - 1
        If StringInStr($aDesktop[$i][0], 'Sophos Anti-Virus') Then
            $checkboxstatus = GUICtrlRead($DeskCtrl[$i])
            If $checkboxstatus == 1 Then
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen,'Desktop Tab: ' & '"' & $aDesktop[$i][0] & '"' & " has control ID: " & $DeskCtrl[$i] & ' and is checked')
                _WriteLogFile($LogFileOpen, $aDesktop[$i][1] & ' is the function name assigned to control ID: ' & $DeskCtrl[$i])
                EndIf
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen, 'Calling: ' & $aDesktop[$i][1] & ' and passing it: ' & $aDesktop[$i][3])
                EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aDesktop[$i][0] & '"')
            ;Debug Profiling
            $aDesktopStartTime = TimerInit()
            ;Calling Function
            Call($aDesktop[$i][1],$aDesktop[$i][3])
            ;Debug Profiling
            $aDesktopEndTime = int(TimerDiff($aDesktopStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aDesktopEndTime & ' second(s)')
            EndIf
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Desktop Tab for Sophos check')
    If $KMCDebug == 1 OR 2 OR 3 Then _WriteLogFile($LogFileOpen, 'Removing Temp Directory: "C:\Temp\Xskin"')

    DirRemove('C:\Temp\Xskin',1)
    DirRemove($TempFolder_Icons,1)
    _WriteLogFile($LogFileOpen,'Exiting Script')
    FileClose($LogFileOpen)
    ;If $FailedFlag == 1 Then
    _SMTPMessage()
    ;EndIf
MsgBox(0,'RDT Complete','Script is finished')
    Exit
EndFunc

Func _SelectAll()
    ;Debug
    If $KMCDebug == 3  Then _WriteLogFile($LogFileOpen, 'Entering _SelectAll function')
   
    $current = _GUICtrlTabGetCurFocus($Tab)
    Switch $current
        Case 0
            For $i = 0 To UBound($ClinicalCtrl) - 1
                GUICtrlSetState($ClinicalCtrl[$i], $GUI_CHECKED)
            Next
        Case 1
            For $i = 0 To UBound($deskCtrl) - 1
                GUICtrlSetState($deskCtrl[$i], $GUI_CHECKED)
            Next
        Case 2
            For $i = 0 To UBound($SettCtrl) - 1
                GUICtrlSetState($SettCtrl[$i], $GUI_CHECKED)
            Next
        Case 3
            For $i = 0 to UBound($ShortcutCtrl) - 1
                GUICtrlSetState($ShortcutCtrl[$i], $GUI_CHECKED)
            Next
        Case 4
            For $i = 0 to UBound($OtherCtrl) - 1
                GUICtrlSetState($OtherCtrl[$i], $GUI_CHECKED)
            Next
    EndSwitch
    ;Debug
    If $KMCDebug == 3  Then _WriteLogFile($LogFileOpen, 'Exiting _SelectAll function')
EndFunc


Func _DeselectAll()
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering DeselectAll function')
   
    $current = _GUICtrlTabGetCurFocus($Tab)
    Switch $current
        Case 0
            For $i = 0 To UBound($ClinicalCtrl) - 1
                GUICtrlSetState($ClinicalCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 1
            For $i = 0 To UBound($deskCtrl) - 1
                GUICtrlSetState($deskCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 2
            For $i = 0 To UBound($SettCtrl) - 1
                GUICtrlSetState($SettCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 3
            For $i = 0 to UBound($ShortcutCtrl) - 1
                GUICtrlSetState($ShortcutCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 4
            For $i = 0 to UBound($OtherCtrl) - 1
                GUICtrlSetState($OtherCtrl[$i], $GUI_UNCHECKED)
            Next
    EndSwitch
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting DeselectAll function')
EndFunc

Func _WriteLogFile($sLogPath, $sLogMsg)
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $sDateNow
    Local $sTimeNow
    Local $sMsg
    Local $hOpenFile
    Local $hWriteFile

    $sDateNow = @YEAR & "-" & @MON & "-" & @MDAY
    $sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC
    $sMsg = $sDateNow & " " & $sTimeNow & " : " & $sLogMsg

    $hWriteFile = FileWriteLine($sLogPath, $sMsg)

    If $hWriteFile = -1 Then
        SetError(2)
        Return 0
    EndIf
EndFunc   ;==>_FileWriteLog

Func Exitier()
    DirRemove('C:\Temp\Xskin',1)
    DirRemove($TempFolder_Icons,1)
    Exit
EndFunc   ;==>Exitier

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            Exit
    EndSelect

EndFunc   ;==>SpecialEvents

Share this post


Link to post
Share on other sites

It's still there a couple hundred lines farther down:

FileClose($LogFileOpen)
    ;If $FailedFlag == 1 Then
    _SMTPMessage()
    ;EndIf
MsgBox(0,'RDT Complete','Script is finished')
    Exit
EndFunc

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Freak! I think that was left over, I was testing where I should implement that function call. sorry bout that

;RDT for AutoIt Forum
#cs
        KMC PC Customization with GUI
   
        Author: Kevin Sanders
   
        Description:
        The purpose of this script is to setup and customize a computer before deployment.
        There are options that let you choose what to install and what not to install.
   
        License:  This script can be freely copied and distributed, as long as it is not
                sold for ANY fee (including "distrobution" costs.)  Any modification to
                this script must be submitted to the original author if the modified script
                is distributed in any manner.  Any modification must include this header
                information with this licence, disclaimer and original author information in tact.
   
        Disclaimer: The author is not responsible for any damage or harm caused by this
                    script.  USE AT YOUR OWN RISK.  There is no warranty, express or implied.
                   

        Revision History
        03-08-2007  Testing1: - Initial Testing
                              - Added Tabs
                              - Added Items using "StringSplit"
        03-15-2007  Testing2: - Programs, Software, and Settings Tab
                              - Changed items from "StringSplit" to using a multidimensional array
                              - Added mouse-over feature on buttons
                              - Changed Xskin GUI images and also header image
                              - Named it "Rapid Deployment Tool"
        03-28-2007  2.0:
                              - Changed buttons from being xskin, to using custom made images for buttons faces
                              - Changed background color of tab
                              - Changed Selectall and Deselect all functions for each tab into one function with select case statements
                              - Added icons Tab
        03-28-2007  2.1:
                              - Renamed "Programs" tab to "Clinical"
                              - Changed all refrences to "Programs" and "prog" to "clinical"
                              - Renamed "Desktop Software" to "Desktop"
                              - Changed all refrences to "Desktop Software" and "soft" to "Desktop"
                              - Added icons to the tabs
                              - Added Misc Tab
        03-29-2007  2.2:
                              - Removed commented lines and cleaned up white space
                              - Changed tab icons to be located on fs1
                              - Using FileInstall to install icons locally
                              - Removed Icons tab and moved all contents to Misc tab
                              - Added Muse, Centricity and Kelley's Paging to Misc Tab(no functions for them yet)
                              - Added Printkey to Desktop tab(no function yet)
                              - Added 3M to Clinical tab(no function yet)
                              - Increased size og GUI and Tab by 25 pixels height and width
                              - Added back icon tab, but renamed to shorcut
                              - Moved Muse, Centricity and Kelley's Paging to Shortcut tab(still no functions)
                              - Changed Misc tab to Other
                              - Added debug logging features
        04-02-2007        - Changed buttons images. Now using custom images using _HoverButton
        04-10-2007  2.3:
                              - Changed buttons to use the _hoverbutton
                              - Changed button images to not have text on the image, adding text after
                              - Changed While loop so that it would not run the cpu so hard
                              - Added additional debug logging
        04-11-2007        - Changed the way the file log is worded inside of the Install function
                              - Added "levels" of debug using options 0, 1 and 2. 0 = no debug, 1 = normal debug, 2 = strong debug
                              - Changed array size to [4], to accomodate the Call function. Added Dummy parameter to functions
        04-13-2007  2.5
                              - Added Microsoft .Net2.0 installer to Other tab
                              - Added "Disable System Beep" under settings tab
        05-04-2007            - Added more logging, specifically in the Clinical loop
        06-04-2007            - Changed the checkbox label to be a part of the checkbox. Allows you to click the label to check the box.
        06-26-2007            - Added ".NET 1.1" to Other tab
        07-09-2007            - Added include files from functions.au3 due to incompatibility with new autoit version
        07-10-2007            - Added Electronic Signature Pads under clinical tab
#CE     


#include <Log_Functions.au3>
;#include <Functions2.3.au3>   <Did not include in Forum Post. This function runs all applictions and has several registry changes. So I didn't include it.
#include <GuiTab.au3>
#include <date.au3>
#include <Misc.au3>
#include <process.au3>
#include <PathFull.au3>
#include <_ButtonHover.au3>
#include <IE.au3>
#include <XSkinTabs.au3>

Opt("GUIOnEventMode", 1)

;Variables
$LocalIconPath = @WindowsDir & '\icons\'
$Skin_Folder = 'C:\Temp\xSkin'
$Icon_Folder = $Skin_Folder
$TempFolder = 'C:\Temp\RDT\'
$TempFolder_Icons = $TempFolder & 'icons\'
GLOBAL $CareManagerVersion = '7.29'
GLOBAL $StarNavigatorVersion = '11'
GLOBAL $JavaVersion = '1.4.2_13'
$XButton_Location = @ScriptDir & '\xSkin\Xbutton'
$RemoteIconPath = @ScriptDir & '\icons\'
GLOBAl $KMCDebug = 2 ;1 = normal debug 2 = strong 0 = no debug


DirCreate($TempFolder)
DirCreate($TempFolder_Icons)
GLOBAL $LogFileOpen = FileOpen('C:\Temp\RDT\RDTSetup.log', 1)

;Write Log File Header
_WriteLogFile($LogFileOpen,'-------------------------------------------------------')
_WriteLogFile($LogFileOpen, 'Starting script ' & @MDAY & "-" & @MON & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
_WriteLogFile($LogFileOpen, "Started by user: " & @UserName)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Checking for Xskin directory at "C:\Temp\XSkin"')
EndIf
;/Debug

;Check if Xskin directory exists
If Not FileExists("C:\Temp\Xskin") Then
    DirCreate('C:\Temp\Xskin')
EndIf

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Copying Xskin GUI files to temp directory')
EndIf
;/Debug


;Install Files to Temp Directory
FileInstall(@ScriptDir & '\xSkin.bmp', $Skin_Folder & '.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\1.bmp', $Skin_Folder & '\1.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\2.bmp', $Skin_Folder & '\2.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\3.bmp', $Skin_Folder & '\3.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\4.bmp', $Skin_Folder & '\4.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\5.bmp', $Skin_Folder & '\5.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\6.bmp', $Skin_Folder & '\6.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\6.bmp', $Skin_Folder & '\7.bmp', 1)
FileInstall(@ScriptDir & '\xSkin\skin.dat', $Skin_Folder & '\skin.dat', 1)
FileInstall(@ScriptDir & '\xSkin\logo_kmc.jpg', $Skin_Folder & '\logo_kmc.jpg', 1)
;/FileInstall

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating GUI')
EndIf
;/Debug

;Create Xskin GUI
$Main = XSkinGUICreate ('Rapid Deployment Tool', 425, 525, $Skin_Folder)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Setting GUI Options')
EndIf
;/Debug

;Set GUI Options
FileCopy($RemoteIconPath & 'monitor.ico',$TempFolder_Icons & 'monitor.ico', 1)
TraySetIcon($TempFolder_Icons & 'monitor.ico')
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating GUI Picture')
EndIf
;/Debug

;Create Image on GUI
GUICtrlCreatePic($Skin_Folder & "\logo_kmc.jpg", 25, 37, 368, 53)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Tab')
EndIf
;/Debug

;Create TAB
$Tab = XSkinColorTabCreate(20, 90, 389, 402, 0xdbdbdb);$over_color) ;GUI_BKCOLOR_TRANSPARENT)

;|===========|
;Clinical Tab|
;|===========|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab1---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'clinical.ico',$TempFolder_Icons & 'clinical.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Clinical Tab Item')
EndIf
;/Debug

$ClinicalTab = GUICtrlCreateTabItem("Clinical")
GUICtrlSetImage (-1, $TempFolder_Icons & 'clinical.ico', 0)


;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating array for Clinical Tab')
EndIf
;/Debug

Dim $aClinical[15][4] = [ _
                ['3M','_3MInstall','0', '0'], _
                ['Appointments Pro OPR','_InstallApptsProOPR','0','0'], _
                ['Appointments Pro OPSS','_InstallApptsProOPSS','0','0'], _
                ['Care Manager ' & $CareManagerVersion,'_InstallCareManager','0','0'], _
                ['ds.Pathfinder','_InstalldsPathfinder','0','0'], _
                ['Electronic Signature Pads','_ESP','0','0'], _
                ['HES','_InstallHES','0','0'], _
                ['HPF Workstation 10.0','_InstallHPF','0','0'], _
                ['LaserArc','_LaserArcInstall','0','0'], _
                ['ReDoc','_InstallRedoc','0','0'], _
                ['ReportXpress','_InstallReportXpress','0','0'], _
                ['Softmed','_SSIinstall','0','0'], _
                ['Star Navigator ' & $StarNavigatorVersion,'_InstallStar','0','0'], _
                ['Tsystem (Laptop)','_InstallTsystemLaptop','0','0'], _
                ['Tsystem (PC)','_InstallTsystemPC','0','0'] _
            ]

Dim $aClinicalSize = Ubound($aClinical)
Dim $ClinicalXSkinID[ ($aClinicalSize + 1) ]
Dim $ClinicalCtrl[ ($aClinicalSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Creating checkboxes for Clinical tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 150, $nHeight = 20
For $i = 0 to $aClinicalSize - 1
    $ClinicalCtrl[$i] = GUICtrlCreateCheckbox($aClinical[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aClinical[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Clinical tab')
EndIf
;/Debug


;Buttons
        $ClinicalStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalStart, 'Install')
        $ClinicalSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalSelect, '_SelectAll')
        $ClinicalDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalDeselect, '_DeSelectAll')
        $ClinicalExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ClinicalExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ClinicalExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug

;|=============|
;| Desktop Tab |
;|=============|

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab2---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'desktop.ico',$TempFolder_Icons & 'desktop.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Desktop Tab Item')
EndIf
;/Debug

$DesktopTab = GUICtrlCreateTabItem("Desktop")
GUICtrlSetImage (-1, $TempFolder_Icons & 'desktop.ico', 0)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Desktop Tab')
EndIf
;/Debug

Dim $aDesktop[12][4] = [ _
                ['Adobe Acrobat 7.0','_InstallAcrobat','1','0'], _
                ['Adobe Flash Player','_InstallFlashPlayer','1','0'], _
                ['Java ' & $JavaVersion,'_InstallJava','1','0'], _
                ['Microsoft Office XP Pro w/ SP3','_InstallOfficeXPPro','0','0'], _
                ['Microsoft Office XP Standard w/ SP3','_InstallOfficeXPStandard','0','0'], _
                ['Microsoft Office XP SP3','_InstallOfficeXPSP3','0','0'], _
                ['Microsoft Project','_ProjectInstall','0','0'], _
                ['Microsoft Publisher','_PublisherInstall','0','0'], _
                ['Microsoft Visio','_VisioInstall','0','0'], _
                ['QuickTime','_QuickTime','1','0'], _
                ['PrintKey','_PrintKeyInstall','0','0'], _
                ['Sophos Anti-Virus','_InstallSophos','1','0'] _
            ]

Dim $aDesktopSize = Ubound($aDesktop)
Dim $deskXSkinID[ ($aDesktopSize + 1) ]
Dim $DeskCtrl[ ($aDesktopSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Desktop tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 200, $nHeight = 20
For $i = 0 to $aDesktopSize - 1
    $DeskCtrl[$i] = GUICtrlCreateCheckbox($aDesktop[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aDesktop[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Desktop tab')
EndIf
;/Debug


;Buttons
        $DesktopStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopStart, 'Install')
        $DesktopSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopSelect, '_SelectAll')
        $DesktopDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopDeselect, '_DeSelectAll')
        $DesktopExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $DesktopExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($DesktopExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug

;|============|
;|Settings Tab|
;|============|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab3---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'settings.ico',$TempFolder_Icons & 'settings.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Settings Tab Item')
EndIf
;/Debug

$SettingsTab = GUICtrlCreateTabItem("Settings")
GUICtrlSetImage (-1, $TempFolder_Icons & 'settings.ico', 0)

;Function Variables
$szAutoUpPass = 'HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU'
$szClassicThemePass = 'Windows Classic'

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Settings Tab')
EndIf
;/Debug

Dim $aSettings[14][4] = [ _
                ['Add Domain Users','_AddDomainUsers','1', '0'], _
                ['Classic Control Panel','_ClassicControlPanel','1','0'], _
                ['Classic Start Menu','_ClassicStart','1','0'], _
                ['Classic Windows Theme','_ClassicTheme','1',$szClassicThemePass], _
                ['Disable Auto Updates','_DisAutoUp','1',$szAutoUpPass], _
                ['Disable Firewall','_DisFirewall','1','0'], _
                ['Disable System Beep','_DisableSystemBeep','1','0'], _
                ['Disable Print Balloon','_disprintballoon','1','0'], _
                ['Icon Cleanup','_IconCleanup','1','0'], _
                ['Internet Explorer Settings','_IESettings','1','0'], _
                ['Mute Sound','_Mute','1','0'], _
                ['Power Settings(Laptop)','_PowerLaptop','0','0'], _
                ['Power Settings(PC)','_PowerPC','0','0'], _
                ['Remove Windows Messenger','_RemMessenger','1','0'] _
            ]

Dim $aSettingsSize = Ubound($aSettings)
Dim $settXSkinID[ ($aSettingsSize + 1) ]
Dim $SettCtrl[ ($aSettingsSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Settings')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 200, $nHeight = 20
For $i = 0 to $aSettingsSize - 1
    $SettCtrl[$i] = GUICtrlCreateCheckbox($aSettings[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aSettings[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Settings tab')
EndIf
;/Debug

;Buttons
        $SettingsStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsStart, 'Install')
        $SettingsSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsSelect, '_SelectAll')
        $SettingsDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsDeselect, '_DeSelectAll')
        $SettingsExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $SettingsExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($SettingsExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug

;|============|
;|Shortcut Tab|
;|============|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab4---------------')
EndIf
;/Debug


FileCopy($RemoteIconPath & 'shortcut.ico',$TempFolder_Icons & 'shortcut.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Shortcuts Tab Item')
EndIf
;/Debug

$ShortcutTab = GUICtrlCreateTabItem("Shortcuts")
GUICtrlSetImage (-1, $TempFolder_Icons & 'shortcut.ico', 0)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Shortcuts Tab')
EndIf
;/Debug

Dim $aShortcut[6][4] = [ _
                ['Centricity Web','_iCentricityWeb','0','0'], _
                ['Chart Connect','_iChartConnect','0','0'], _
                ["Kelley's Paging",'_iKelleysPaging','0','0'], _
                ['Muse','_iMuse','0','0'], _
                ['Portal','_iPortalIcon','0','0'], _
                ['Schedule Quest','_iScheduleQuest','0','0'] _
            ]
           
Dim $aShortcutSize = Ubound($aShortcut)
Dim $ShortcutXSkinID[ ($aShortcutSize + 1) ]
Dim $ShortcutCtrl[ ($aShortcutSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Shortcuts tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 100, $nHeight = 20
For $i = 0 to $aShortcutSize - 1
    $ShortcutCtrl[$i] = GUICtrlCreateCheckbox($aShortcut[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aShortcut[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Shortcuts tab')
EndIf
;/Debug

;Buttons
        $ShortcutsStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsStart, 'Install')
        $ShortcutsSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsSelect, '_SelectAll')
        $ShortcutsDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsDeselect, '_DeSelectAll')
        $ShortcutsExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $ShortcutsExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($ShortcutsExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, '---------------')
EndIf
;/Debug
;|===========|
;| Other Tab |
;|===========|
;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab5---------------')
EndIf
;/Debug

FileCopy($RemoteIconPath & 'other.ico',$TempFolder_Icons & 'other.ico', 1)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Other Tab Item')
EndIf
;/Debug

$OtherTab = GUICtrlCreateTabItem("Other")
GUICtrlSetImage (-1, $TempFolder_Icons & 'other.ico', 0)

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create Array for Other Tab')
EndIf
;/Debug

Dim $aOther[4][4] = [ _
                ['De-Crapifier','_DeCrapifier','0','0'], _
                ['Microsoft .NET 1.1','_DotNet11Install','0','0'], _
                ['Microsoft .NET 2.0','_InstallDotNet20','0','0'], _
                ['Outlook Script','_OutlookScript','0','0'] _
            ]
           
Dim $aOtherSize = Ubound($aOther)
Dim $OtherXSkinID[ ($aOtherSize + 1) ]
Dim $otherCtrl[ ($aOtherSize + 1) ]

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create checkboxes for Other tab')
EndIf
;/Debug

;Create Checkbox
Local $nLeft = 25, $nTop = 125, $nWidth = 100, $nHeight = 20
For $i = 0 to $aOtherSize - 1
    $OtherCtrl[$i] = GUICtrlCreateCheckbox($aOther[$i][0], $nLeft, $nTop, $nWidth + 15, 20)
    If $aOther[$i][2] == 1 Then GUICtrlSetState ( -1, $GUI_CHECKED)
    $nTop += 22
Next
;/Checkbox

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Create buttons for Other tab')
EndIf
;/Debug

;Buttons
        $OtherStart = _HoverButton("START",280,265,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherStart +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherStart, 'Install')
        $OtherSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherSelect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherSelect, '_SelectAll')
        $OtherDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherDeselect +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherDeselect, '_DeSelectAll')
        $OtherExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF)
        GUICtrlSetFont( $OtherExit +1, 8, 600, '', "Comic Sams")
        GUICtrlSetOnEvent($OtherExit, 'Exitier')
       
        _ControlHover(2, "", $ClinicalStart)
        _ControlHover(2, "", $ClinicalSelect)
        _ControlHover(2, "", $ClinicalDeselect)
        _ControlHover(2, "", $ClinicalExit)
;/Buttons

GUICtrlCreateTabItem("")

;Debug
If $KMCDebug == 3 Then
    _WriteLogFile($LogFileOpen, 'Tab5---------------')
EndIf
;/Debug

GUISetOnEvent($GUI_EVENT_CLOSE, "exitier", $Main)
GUISetState()
GUICtrlSetState($Tab, $GUI_ONTOP)

While 1 ;GUIGetMsg() <> $GUI_EVENT_CLOSE
    _CheckHoverAndPressed ($Main)
    Sleep(10)
WEnd

FileClose($LogFileOpen)

;If $FailedFlag == 1 Then
;   _SMTPMessage()
;EndIf

Func Install()
    ;Debug
    If $KMCDebug == 2 or 3 Then _WriteLogFile($LogFileOpen, 'Entering Install function')
   
    GUISetState(@SW_HIDE,$main)
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering loop for Clinical Tab')
    ;Loop through Clinical Array
    For $i = 0 to $aClinicalSize - 1
        $checkboxstatus = GUICtrlRead($ClinicalCtrl[$i])
        If (($checkboxstatus == 1) And ($aClinical[$i][0] <> 'HES')) Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Clinical: ' & '"' & $aClinical[$i][0] & '"' & " has control ID: " & $ClinicalCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aClinical[$i][1] & ' is the function name assigned to control ID: ' & $ClinicalCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aClinical[$i][1] & ' and passing it: ' & $aClinical[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aClinical[$i][0] & '"')
            ;Debug Profiling
            $aClinicalStartTime = TimerInit()
            ;Calling Function
            Call($aClinical[$i][1],$aClinical[$i][3])
            ;Debug Profiling
            $aClinicalEndTime = int(TimerDiff($aClinicalStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aClinicalEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Clinical Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering loop for Desktop Tab')
    ;Loop through Desktop Array
    For $i = 0 to $aDesktopSize -1
        $checkboxstatus = GUICtrlRead($DeskCtrl[$i])
        If (($checkboxstatus == 1) And ($aDesktop[$i][0] <> 'Sophos Anti-Virus')) Then
                If $KMCDebug == 3 Then
                _WriteLogFile($LogFileOpen,'Desktop Tab: ' & '"' & $aDesktop[$i][0] & '"' & " has control ID: " & $DeskCtrl[$i] & ' and is checked')
                _WriteLogFile($LogFileOpen, $aDesktop[$i][1] & ' is the function name assigned to control ID: ' & $DeskCtrl[$i])
                EndIf
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen, 'Calling: ' & $aDesktop[$i][1] & ' and passing it: ' & $aDesktop[$i][3])
                EndIf
                If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aDesktop[$i][0] & '"')
                ;Debug Profiling
                $aDesktopStartTime = TimerInit()
                ;Calling Function
                Call($aDesktop[$i][1],$aDesktop[$i][3])
                ;Debug Profiling
                $aDesktopEndTime = int(TimerDiff($aDesktopStartTime)) / 1000
                ;Writing to Log
                If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aDesktopEndTime & ' second(s)')
            ;EndIf
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Desktop Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Settings Tab')
    ;Loop through Settings Array
    For $i = 0 to $aSettingsSize -1
        $checkboxstatus = GUICtrlRead($SettCtrl[$i])
        If $checkboxstatus == 1 Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Settings Tab: ' & '"' & $aSettings[$i][0] & '"' & " has control ID: " & $SettCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aSettings[$i][1] & ' is the function name assigned to control ID: ' & $SettCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aSettings[$i][1] & ' and passing it: ' & $aSettings[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aSettings[$i][0] & '"')
            ;Debug Profiling
            $aSettingsStartTime = TimerInit()
            ;Calling Function
            Call($aSettings[$i][1], $aSettings[$i][3])
            ;Debug Profiling
            $aSettingsEndTime = int(TimerDiff($aSettingsStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aSettingsEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Settings Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Shortcuts Tab')
    ;Loop through Shortcut Array
    For $i = 0 to $aShortcutSize -1
        $checkboxstatus = GUICtrlRead($ShortcutCtrl[$i])
        If $checkboxstatus == 1 Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Shortcut Tab: ' & '"' & $aShortcut[$i][0] & '"' & " has control ID: " & $ShortcutCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aShortcut[$i][1] & ' is the function name assigned to control ID: ' & $ShortcutCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aShortcut[$i][1] & ' and passing it: ' & $aShortcut[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aShortcut[$i][0] & '"')
            ;Debug Profiling
            $aShortcutStartTime = TimerInit()
            ;Calling Function
            Call($aShortcut[$i][1],$aShortcut[$i][3])
            ;Debug Profiling
            $aShortcutEndTime = int(TimerDiff($aShortcutStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aShortcutEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Shortcuts Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Other Tab')
    ;Loop through Other Array
    For $i = 0 to $aOtherSize -1
        $checkboxstatus = GUICtrlRead($OtherCtrl[$i])
        If $checkboxstatus == 1 Then
            If $KMCDebug == 3 Then
            _WriteLogFile($LogFileOpen,'Other Tab: ' & '"' & $aOther[$i][0] & '"' & " has control ID: " & $OtherCtrl[$i] & ' and is checked')
            _WriteLogFile($LogFileOpen, $aOther[$i][1] & ' is the function name assigned to control ID: ' & $OtherCtrl[$i])
            EndIf
            If $KMCDebug == 2 or 3 Then
            _WriteLogFile($LogFileOpen, 'Calling: ' & $aOther[$i][1] & ' and passing it: ' & $aOther[$i][3])
            EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aOther[$i][0] & '"')
            ;Debug Profiling
            $aOtherStartTime = TimerInit()
            ;Calling Function
            Call($aOther[$i][1],$aOther[$i][3])
            ;Debug Profiling
            $aOtherEndTime = int(TimerDiff($aOtherStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aOtherEndTime & ' second(s)')
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Other Tab')
   
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Clinical Tab for HES check')
    ;Loop Through Clinical Array for HES
    For $i = 0 to $aClinicalSize - 1
        If StringInStr($aClinical[$i][0], 'HES') Then
            $checkboxstatus = GUICtrlRead($ClinicalCtrl[$i])
            If $checkboxstatus == 1 Then
                If $KMCDebug == 3 Then
                _WriteLogFile($LogFileOpen,'Clinical Tab: ' & '"' & $aClinical[$i][0] & '"' & " has control ID: " & $ClinicalCtrl[$i] & ' and is checked')
                _WriteLogFile($LogFileOpen, $aClinical[$i][1] & ' is the function name assigned to control ID: ' & $ClinicalCtrl[$i])
                EndIf
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen, 'Calling: ' & $aClinical[$i][1] & ' and passing it: ' & $aClinical[$i][3])
                EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aClinical[$i][0] & '"')
            ;Debug Profiling
            $aClinicalStartTime = TimerInit()
            ;Calling Function
            Call($aClinical[$i][1],$aClinical[$i][3])
            ;Debug Profiling
            $aClinicalEndTime = int(TimerDiff($aClinicalStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aClinicalEndTime & ' second(s)')
            EndIf
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Clinical Tab for HES check')

    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering Loop for Desktop Tab for Sophos check')
    ;Loop Through Desktop Array for Sophos
    For $i = 0 to $aDesktopSize - 1
        If StringInStr($aDesktop[$i][0], 'Sophos Anti-Virus') Then
            $checkboxstatus = GUICtrlRead($DeskCtrl[$i])
            If $checkboxstatus == 1 Then
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen,'Desktop Tab: ' & '"' & $aDesktop[$i][0] & '"' & " has control ID: " & $DeskCtrl[$i] & ' and is checked')
                _WriteLogFile($LogFileOpen, $aDesktop[$i][1] & ' is the function name assigned to control ID: ' & $DeskCtrl[$i])
                EndIf
                If $KMCDebug == 2 or 3 Then
                _WriteLogFile($LogFileOpen, 'Calling: ' & $aDesktop[$i][1] & ' and passing it: ' & $aDesktop[$i][3])
                EndIf
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Running: "' & $aDesktop[$i][0] & '"')
            ;Debug Profiling
            $aDesktopStartTime = TimerInit()
            ;Calling Function
            Call($aDesktop[$i][1],$aDesktop[$i][3])
            ;Debug Profiling
            $aDesktopEndTime = int(TimerDiff($aDesktopStartTime)) / 1000
            ;Writing to Log
            If $KMCDebug == 1 or 2 or 3 Then _WriteLogFile($LogFileOpen, 'Function call took: ' & $aDesktopEndTime & ' second(s)')
            EndIf
        EndIf
    Next
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting loop for Desktop Tab for Sophos check')
    If $KMCDebug == 1 OR 2 OR 3 Then _WriteLogFile($LogFileOpen, 'Removing Temp Directory: "C:\Temp\Xskin"')

    DirRemove('C:\Temp\Xskin',1)
    DirRemove($TempFolder_Icons,1)
    _WriteLogFile($LogFileOpen,'Exiting Script')
    FileClose($LogFileOpen)
    ;If $FailedFlag == 1 Then
    ;_SMTPMessage()
    ;EndIf
MsgBox(0,'RDT Complete','Script is finished')
    Exit
EndFunc

Func _SelectAll()
    ;Debug
    If $KMCDebug == 3  Then _WriteLogFile($LogFileOpen, 'Entering _SelectAll function')
   
    $current = _GUICtrlTabGetCurFocus($Tab)
    Switch $current
        Case 0
            For $i = 0 To UBound($ClinicalCtrl) - 1
                GUICtrlSetState($ClinicalCtrl[$i], $GUI_CHECKED)
            Next
        Case 1
            For $i = 0 To UBound($deskCtrl) - 1
                GUICtrlSetState($deskCtrl[$i], $GUI_CHECKED)
            Next
        Case 2
            For $i = 0 To UBound($SettCtrl) - 1
                GUICtrlSetState($SettCtrl[$i], $GUI_CHECKED)
            Next
        Case 3
            For $i = 0 to UBound($ShortcutCtrl) - 1
                GUICtrlSetState($ShortcutCtrl[$i], $GUI_CHECKED)
            Next
        Case 4
            For $i = 0 to UBound($OtherCtrl) - 1
                GUICtrlSetState($OtherCtrl[$i], $GUI_CHECKED)
            Next
    EndSwitch
    ;Debug
    If $KMCDebug == 3  Then _WriteLogFile($LogFileOpen, 'Exiting _SelectAll function')
EndFunc


Func _DeselectAll()
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Entering DeselectAll function')
   
    $current = _GUICtrlTabGetCurFocus($Tab)
    Switch $current
        Case 0
            For $i = 0 To UBound($ClinicalCtrl) - 1
                GUICtrlSetState($ClinicalCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 1
            For $i = 0 To UBound($deskCtrl) - 1
                GUICtrlSetState($deskCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 2
            For $i = 0 To UBound($SettCtrl) - 1
                GUICtrlSetState($SettCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 3
            For $i = 0 to UBound($ShortcutCtrl) - 1
                GUICtrlSetState($ShortcutCtrl[$i], $GUI_UNCHECKED)
            Next
        Case 4
            For $i = 0 to UBound($OtherCtrl) - 1
                GUICtrlSetState($OtherCtrl[$i], $GUI_UNCHECKED)
            Next
    EndSwitch
    ;Debug
    If $KMCDebug == 3 Then _WriteLogFile($LogFileOpen, 'Exiting DeselectAll function')
EndFunc

Func _WriteLogFile($sLogPath, $sLogMsg)
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $sDateNow
    Local $sTimeNow
    Local $sMsg
    Local $hOpenFile
    Local $hWriteFile

    $sDateNow = @YEAR & "-" & @MON & "-" & @MDAY
    $sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC
    $sMsg = $sDateNow & " " & $sTimeNow & " : " & $sLogMsg

    $hWriteFile = FileWriteLine($sLogPath, $sMsg)

    If $hWriteFile = -1 Then
        SetError(2)
        Return 0
    EndIf
EndFunc   ;==>_FileWriteLog

Func Exitier()
    DirRemove('C:\Temp\Xskin',1)
    DirRemove($TempFolder_Icons,1)
    Exit
EndFunc   ;==>Exitier

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            Exit
    EndSelect

EndFunc   ;==>SpecialEvents

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