#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=\\dgdcsrv7\dc_public\Setup\DC_Installer\DC_Installer.ico #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_Res_Fileversion=0.0.0.74 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; *** Start added by AutoIt3Wrapper *** #include ; *** End added by AutoIt3Wrapper *** ; *** Start added by AutoIt3Wrapper *** #include ; *** End added by AutoIt3Wrapper *** ;~ #AutoIt3Wrapper_Run_After=""C:\Program Files (x86)\Windows Kits\10\App Certification Kit\signtool.exe" sign /t http://timestamp.comodoca.com/rfc3161 /f \\dgdcsrv7\DC_TechSupport\Certificates\Cert_TQS.p7b "%out%" #cs change log 200803 tqs created 200827 tqs converted combobox to listbox 210823 tqs added feature to hide $btnDC_InstallerDir button changed driver to open source directory only if tsandstrom or spersinger 211007 TQS added double click feature to list box #ce #cs prduction instructions: -- compile to local DC_Installer.exe -- copy to c:\windows\DC_Installer.exe #ce #Region Include #include #include <\\dgdcsrv7\DC public\Macros\AutoIt\Libraries\DCFunctions.au3> #include #include #include #include #include #include #include #include #include #include #include #include #EndRegion Include Local $sMESSAGE = "The following buttons have been clicked" Local $hFile = FileOpen(@ScriptDir & "\dc_InstallerLog.log", 1) Local $appPath Local $UserSecurity $UserSecurity = GetSecurity() ; Open the logfile in write mode. _FileWriteLog($hFile, @UserName & "," & @ComputerName & ", Open DC_Installer") ; Write to the logfile passing the filehandle returned by FileOpen. FileClose($hFile) ; Close the filehandle to release the file. ;~ #Region ### START Koda GUI section ### #Region ### START Koda GUI section ### $Form1 = GUICreate("DC_Installer-", 517, 516, 192, 124) $filemenu = GUICtrlCreateMenu("&File") $exititem = GUICtrlCreateMenuItem("Exit" & @TAB & "", $filemenu) $Editmenu = GUICtrlCreateMenu("&Edit") $fileitem = GUICtrlCreateMenuItem("Options" & @TAB & "Shift+Alt+4", $Editmenu) $separator1 = GUICtrlCreateMenuItem("", $filemenu) $ToolwMenu = GUICtrlCreateMenu("&Tools") $ToolsListConfigitem = GUICtrlCreateMenuItem("Edit Tools List" & @TAB, $ToolwMenu) $ToolsPublishDC_Installeritem = GUICtrlCreateMenuItem("Publish DC_Installer" & @TAB, $ToolwMenu) $viewmenu = GUICtrlCreateMenu("&View") $viewstatusitem = GUICtrlCreateMenuItem("Statusbar" & @TAB & "Ctrl+Alt+`", $viewmenu) GUICtrlSetState(-1, $GUI_CHECKED) $helpmenu = GUICtrlCreateMenu("&Help") $infoitem = GUICtrlCreateMenuItem("About" & @TAB & "Ctrl+Alt+Caps Lock", $helpmenu) $btnNewHelpTicket = GUICtrlCreateButton("New Help Ticket", 220, 10, 91, 25) $btnFullCourt = GUICtrlCreateButton("FullCourt", 32, 10, 75, 25) $btnDrives = GUICtrlCreateButton("Network Drives", 128, 10, 75, 25) ;~ If @UserName = "tsandstrom" Or @UserName = "spersinger" Or @UserName = "tsadmin" Or @UserName = "spadmin" Or @UserName = "krobinson" or @UserName = "kradmin" Then ;210823 If $UserSecurity = "admin" Then ;210823 $btnDC_InstallerDir = GUICtrlCreateButton("DC_Installer dir", 32, 50, 75, 25) ;210823 Else $btnDC_InstallerDir = "-1" ;GUICtrlCreateButton("", 32, 50,75, 25) EndIf ;210823 $Tools = GUICtrlCreateList(" ", 34, 90, 245, 314) $btnInstall = GUICtrlCreateButton("Install", 285, 90, 75, 24) $btnRepair = GUICtrlCreateButton("Repair", 360, 90, 75, 24) $btnDrivers_btn = GUICtrlCreateButton("Dir", 435, 90, 75, 24) Global $Tools_config_menu Global $Tools_config_ar $result = _FileReadToArray(@ScriptDir & "\DC_Installer.cfg", $Tools_config_ar, Default, ",") If @error > 0 Then Switch @error Case 1 MsgBox(4112, "File Error Line: " & @ScriptLineNumber, "error opening file") Case 2 MsgBox(4112, "File Error Line: " & @ScriptLineNumber, "unable to split file") Case 3 MsgBox(4112, "File Error Line: " & @ScriptLineNumber, "file lines have different numbers of fields") Case 4 MsgBox(4112, "File Error Line: " & @ScriptLineNumber, "no delimiters found") Case Else MsgBox(4112, "File Error Line: " & @ScriptLineNumber, "oops something is totally messed up! I need help!") EndSwitch Exit EndIf $Tools_config_menu = ConfigureToolsMenu_get($Tools_config_ar) ;~ GUICtrlSetData($Tools, $Tools_config_menu,"Tools") ;~ GUICtrlSetLimit($Tools, 200) ; to limit horizontal scrolling GUICtrlSetData($Tools, $Tools_config_menu, "") ;~ Dim $Form1_AccelTable[7][2] = [["!+4", $fileitem],["^!t", $TechSupportDbaseitem],["^!p", $ProductionDbaseitem],["^!n", $NotesDbaseitem],["^!`", $viewstatusitem],["^!b", $BatchReports_Dbaseitem]] Dim $Form1_AccelTable[7][2] = [["!+4", $fileitem], ["^!`", $viewstatusitem], ["^!{CAPS LOCK}", $infoitem]] GUISetAccelerators($Form1_AccelTable) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Status Bar Local $StatusBar1 = _GUICtrlStatusBar_Create($Form1, 250, "Idle") Local $index_found Local $sComboRead = "Apps to Install" GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() If $nMsg = $viewstatusitem Then If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED) _GUICtrlStatusBar_ShowHide($StatusBar1, @SW_HIDE) Else GUICtrlSetState($viewstatusitem, $GUI_CHECKED) _GUICtrlStatusBar_ShowHide($StatusBar1, @SW_SHOW) EndIf EndIf If $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $exititem Then ExitLoop ;$ToolsMenu---------------------------------------------------------------------------- Switch $nMsg Case $ToolsListConfigitem ;~ if @UserName = "tsandstrom" Or @UserName = "tsadmin" Or @UserName = "spadmin" or @UserName = "spersinger" Then If $UserSecurity = "admin" Then If FileExists("\\dgdcsrv7\dc public\Setup\DC_Installer\DC_Installer.cfg") Then ShellExecute("\\dgdcsrv7\dc_public\Setup\DC_Installer\DC_Installer.cfg") Else MsgBox(4112, "Autoit Error", "tools.cfg -- file not found in" & @ScriptDir) EndIf Else MsgBox(4112, "Security", "Access Denied! Permissions issue!") EndIf ;~ Exit Case $ToolsPublishDC_Installeritem ;~ if @UserName = "tsandstrom" Or @UserName = "tsadmin" or @UserName = "spersinger" Or @UserName = "spadmin" Or @UserName = "krobinson" Or @UserName = "kradmin" Then If $UserSecurity = "admin" Then If FileExists("\\dgdcsrv7\dc public\Setup\DC_Installer\DC_Installer_Publish.exe") Then ShellExecute("\\dgdcsrv7\dc public\Setup\DC_Installer\DC_Installer_Publish.") Else MsgBox(4112, "Security", "could not find dc_publish!") EndIf Else MsgBox(4112, "Security", "Access Denied! Permissions issue!") EndIf ;~ Exit EndSwitch ;ComboBoxes ---------------------------------------------------------------------------- Switch $nMsg Case $Tools ; activated only when selected from tool list $sComboRead = GUICtrlRead($Tools) Switch $sComboRead Case " " Case Else $index_found = _ArraySearch($Tools_config_ar, $sComboRead) ;~ _ArrayDisplay($Tools_config_ar,@ScriptLineNumber) ;~ ShellExecute($Tools_config_ar[$index_found][1]) ;uncomment if program should run when selection is clicked, else comment to use install/repair/driver buttons ;~ Exit EndSwitch EndSwitch ;buttons ---------------------------------------------------------------------------- Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $infoitem SplashTextOn("About Information", @LF & "Version 0.46 " & @CRLF & "Built with AutoIt v3", 200, 80, -1, -1, 1) Sleep(2500) SplashOff() Case $fileitem MsgBox($MB_SYSTEMMODAL, "Options ", "Options Feature still under construction." & @CR & _ "this feature will provide ini support file and edit to customize the following: " & @CR & _ "1. databases accessable. " & _ "2. ... ") ;~ Exit Case $btnDC_InstallerDir ;~ if @UserName = "tsandstrom" Or @UserName = "tsadmin" or @UserName = "spersinger" Or @UserName = "spadmin" Or @UserName = "krobinson" Or @UserName = "kradmin" Then ;210823 If $UserSecurity = "admin" Then ShellExecute("\\dgdcsrv7\dc public\Setup\DC_Installer") ;210823 Else MsgBox(4112, "Security", "Access Denied! Permissions issue!") EndIf Case $btnNewHelpTicket SoundPlay("\\dgdcsrv7\dc_public\Databases\SupportFiles\clickerx.wav") RunWait(@ComSpec & " /c " & "start http://intranet/intranet/myaccess/ithelpdesk/helpdesk_summary_tech.asp", "", @SW_MAXIMIZE) ;~ Exit Case $btnFullCourt SoundPlay("\\dgdcsrv7\dc_public\Databases\SupportFiles\clickerx.wav") If FileExists(@DesktopDir & "\FULLCRT.exe") Then ShellExecute(@DesktopDir & "\FULLCRT.exe") ;~ Exit EndIf If FileExists(@DesktopDir & "\FullCourt.lnk") Then ShellExecute(@DesktopDir & "\FullCourt.lnk") ;~ Exit EndIf Case $btnDrives SoundPlay("\\dgdcsrv7\dc_public\Databases\SupportFiles\clickerx.wav") ShellExecute(@DesktopDir & "\Network Drives") ;~ Exit Case $btnInstall, $btnRepair If $sComboRead = "Apps to Install" Then Else SoundPlay("\\dgdcsrv7\dc_public\Databases\SupportFiles\clickerx.wav") $hFile = FileOpen(@ScriptDir & "\dc_InstallerLog.log", 1) _FileWriteLog($hFile, @UserName & ", " & @ComputerName & ", " & $Tools_config_ar[$index_found][0]) ; Write to the logfile passing the filehandle returned by FileOpen. ;~ _FileWriteLog($hFile, @UserName & "," & $Tools_config_ar[$index_found][0]) ; Write to the logfile passing the filehandle returned by FileOpen. FileClose($hFile) ; Close the filehandle to release the file. ShellExecute($Tools_config_ar[$index_found][1]) ;~ Exit EndIf Case $btnDrivers_btn ;~ If @UserName = "tsandstrom" Or @UserName = "tsadmin" Or _ ;210823 ;~ @UserName = "spersinger" Or @UserName = "spadmin" Then ;210823 If $UserSecurity = "admin" Then Else ;210823 MsgBox(48, "Driver button", "Permission denied. Please contact IT for resolution of issue. ") ;210823 Exit ;210823 EndIf ;210823 If $sComboRead = "Apps to Install" Then Else SoundPlay("\\dgdcsrv7\dc_public\Databases\SupportFiles\clickerx.wav") $hFile = FileOpen(@ScriptDir & "\dc_InstallerLog.log", 1) _FileWriteLog($hFile, @UserName & ", " & @ComputerName & ", " & $Tools_config_ar[$index_found][0]) ; Write to the logfile passing the filehandle returned by FileOpen. FileClose($hFile) ; Close the filehandle to release the file. ;~ $appfilename = _getfilename($Tools_config_ar[$index_found][1]) $appPath = _GetDir($Tools_config_ar[$index_found][1]) ;~ ShellExecute($Tools_config_ar[$index_found][1]) ShellExecute($appPath) ;~ Exit EndIf EndSwitch WEnd Func ConfigureToolsMenu_get($inTools_ar) Local $i ;Local $Hold_ar ;read config tools file into array and return string for tools menu Local $Hold_ar Local $Hold_str Local $i For $i = 1 To $inTools_ar[0][0] $Hold_ar = StringSplit($inTools_ar[$i][0], ",") $Hold_str &= $Hold_ar[1] & "|" Next $Hold_str = StringLeft($Hold_str, StringLen($Hold_str) - 1) Return $Hold_str EndFunc ;==>ConfigureToolsMenu_get ; adds commas to float type numbers ; $inNumber - number to be formatted ; $inputNumType - "float" or "int" ; - "float" - will add commas on float numbers ; - "int" - add commas on numbers without decimals. Func formatNumber($inNumber) Dim $fin Dim $startposn Dim $decpnt Dim $inputNumType = "int" Dim $holdVal Dim $strInvalue If (StringInStr($inNumber, ".")) Then $inputNumType = "float" Else $inputNumType = "int" EndIf If ($inputNumType = "float") Then $holdVal = StringSplit($inNumber, ".") $holdVal[1] = ProcessInt($holdVal[1]) $fin = $holdVal[1] & "." & $holdVal[2] Else $fin = ProcessInt($inNumber) Return $fin EndIf Return $fin EndFunc ;==>formatNumber Func ProcessInt($inputNumber) Dim $t, $final $result = StringSplit($inputNumber, "") For $x = $result[0] To 1 Step -1 $t = $t + 1 If $t = 4 Then $final = "," & $final $t = 1 EndIf $final = $result[$x] & $final Next Return $final EndFunc ;==>ProcessInt Func SizeFormat($size) If $size = '' Then Return '' If $size >= 1073741824 Then Return Round($size / 1073741.824, 1) & ' GB' ElseIf $size >= 1048576 Then Return Round($size / 1048576, 1) & ' MB' ElseIf $size >= 1024 Then Return Round($size / 1024, 1) & ' kB' Else Return $size & ' B' EndIf EndFunc ;==>SizeFormat Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox If Not IsHWnd($Tools) Then $hWndListBox = GUICtrlGetHandle($Tools) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word ;~ COPIED FROM: https://www.autoitscript.com/forum/topic/121322-double-click-on-an-item-in-a-list/ BY taietel Switch $hWndFrom Case $Tools, $hWndListBox Switch $iCode Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box ;_WM_NOTIFY_DebugInfo("$LBN_DBLCLK", "hWndFrom,IDFrom", $hWndFrom, $iIDFrom) ; no return value SoundPlay("\\dgdcsrv7\dc_public\Databases\SupportFiles\clickerx.wav") $hFile = FileOpen(@ScriptDir & "\dc_InstallerLog.log", 1) _FileWriteLog($hFile, @UserName & ", " & @ComputerName & ", " & $Tools_config_ar[$index_found][0]) ; Write to the logfile passing the filehandle returned by FileOpen. ;~ _FileWriteLog($hFile, @UserName & "," & $Tools_config_ar[$index_found][0]) ; Write to the logfile passing the filehandle returned by FileOpen. FileClose($hFile) ; Close the filehandle to release the file. ShellExecute($Tools_config_ar[$index_found][1]) ;Exit Case Else ; Sent when a list box receives the keyboard focus) ;WM_NOTIFY_DebugInfo("$Mouse_Click_Left", "hWndFrom,IDFrom", $hWndFrom, $iIDFrom) ; no return value WinActivate($sComboRead) If MouseClick($Mouse_Click_Primary, Default, Default, 1, 10) Then If $sComboRead = "Docket Drivers" Then $Edit1 = GUICtrlCreateEdit("Copies dll files to System32 or SysWow64" & @CRLF & @CRLF & "OWC10" & @CRLF & "dmNSExtWeb.ocx" & @CRLF & "FPDTC" & @CRLF & "GIF89" & @CRLF & "MSCAL.OCX" & @CRLF & "mscomct2.ocx" & @CRLF & "mscomct2.ocs_new" & @CRLF & "MSOWCF", 300, 175, 200, 200, @SW_SHOW + $EM_CANUNDO) ElseIf $sComboRead = "FullCourt Drivers" Then $Edit2 = GUICtrlCreateEdit("Copies dll files to System32 or SysWow64" & @CRLF & @CRLF & "TwainPRO5" & @CRLF & "BarcodeXpress5" & @CRLF & "ImagXpress9" & @CRLF & "NotateXpress9" & @CRLF & "PrintPro4" & @CRLF & "ScanFix5" & @CRLF & "ThumbnailXpress2", 300, 175, 200, 200, @SW_SHOW + $EM_CANUNDO) ElseIf $sComboRead = "Crystal 532 fix*" Then $Edit3 = GUICtrlCreateEdit("Copies dll files to System32 or SysWow64" & @CRLF & "Implode, mfc30, msexcl35, mspdox35, mstext35, msxbse35, p2bdao, p2ctdao, p2irdao and runs odbcad32 for 32 or 64 Bit from DC_Public\Setup\CrystalSupportFiles", 300, 175, 200, 200, @SW_SHOW + $EM_CANUNDO) ElseIf $sComboRead = "Crystal 534 fix*" Then $Edit4 = GUICtrlCreateEdit("See Registry Requirements here: " & @CRLF & @CRLF & "\\dgdcsrv7\dc_public\Setup\Installs\ODBCSupportFiles", 300, 175, 200, 200, @SW_SHOW + $EM_CANUNDO) ElseIf $sComboRead = "IQL Config fix" Then $Edit5 = GUICtrlCreateEdit("Close IQL and does the following:" & @CRLF & @CRLF & "Copies \\dgdcsrv7\dc_public\Images QuickLite\config.txt" & @CRLF & "to user's" & @CRLF & "c:\users\username\AppDate\Roaming\Images Quick\config.txt", 300, 175, 200, 200, @SW_SHOW + $EM_CANUNDO) ElseIf $sComboRead = "OutNAbout group list fix 2*" Then $Edit6 = GUICtrlCreateEdit("Creates Registry Entry here: " & @CRLF & @CRLF & "HKCU\Software\Microsoft\Office\16.0\" & @CRLF & "Outlook\Security\EnableRoamingFolderHomepages = " & @CRLF & "dword 00000001", 300, 175, 200, 200, @SW_SHOW + $EM_CANUNDO) ElseIf $sComboRead = "OutNAbout group list fix 3*" Then $Edit7 = GUICtrlCreateEdit("Creates Registry Entry here: " & @CRLF & @CRLF & "HKCU\Software\Microsoft\Office\16.0\" & @CRLF & "Outlook\Security\EnableRoamingFolderHomepages = " & @CRLF & "dword 00000001" & @CRLF & @CRLF & "HKCU\Software\Microsoft\Office\16.0\" & @CRLF & "Outlook\Security\NonDefaultStoreScript = " & @CRLF & "dword 00000001", 300, 175, 200, 200, @SW_SHOW + $EM_CANUNDO) EndIf EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func GetSecurity() Local $Role_indx Local $Role Local $Security_a Local $sFilePath = "\\dgdcsrv7\dc_public\Setup\DC_Installer\UserSecurity.cfg" _FileReadToArray($sFilePath, $Security_a, 1, ",") $Role_indx = _ArraySearch($Security_a, @UserName) $Role = $Security_a[6][1] Return $Role EndFunc ;==>GetSecurity