Kaimberex

Problem with FileSaveDialog

2 posts in this topic

I have a compiled script that runs fine until the FileSaveDialog function is ran, Once that has been called my script immediately triggers the AV and my .exe gets deleted from the computer. I submitted the source code for my script to symantec and they whitelisted my file however since the original file was deleted I had to recompile the file and now it has a new hash so the whitelisting is practically irrelevant. Can anyone think of a reason why the FileSaveDialog would trigger an AV?

 

The Large blocks of commented out code is my attempt to isolate what is causing the AV to trigger. 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_Res_Description=Utility to automatically enter information into New Hire Imaging checklist.
#AutoIt3Wrapper_Res_Fileversion=1.1.4.6
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_LegalCopyright=All Rights Reserved.2016
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include "Forms\New Hire Imaging Checklist Input Utility.isf"
#include "Forms\Settings.isf"
#include <Misc.au3>
#include <Excel.au3>
;~ #include <Array.au3>
#include <GuiEdit.au3>
#include "Forms\About.isf"
#include <File.au3>
#include <AD.au3>
#include <Date.au3>

;Check if another instance of this application is lready running. If detected, kill new instance and keep original.
If _Singleton("New Hire Imaging Checklist Input Utility", 1) = 0 Then
    MsgBox(16, "Error", "Another instance of this program is already running.")
    Exit
EndIf

#Region Global Variables
Global $oExcelChecklist, $sFilePathChecklist, $workbookChecklist, $oExcelQuickGuide, $sFilePathQuickGuide, $workbookQuickGuide, $LogFileDirChoose, $SelectedPrinter, $IsLoggingEnabled
Global $defPrtNm, $DefaultPrinter, $DocumentsProcessed, $LogDir
#EndRegion Global Variables
#Region Declare Variables
$DocumentsProcessed = False
#EndRegion Declare Variables
#Region Config.ini Settings
;Create the .ini file
$ConfigFile = @ScriptDir & "\Config.ini"
If FileExists($ConfigFile) = 0 Then _FileCreate($ConfigFile)
$ConfigFileIsLoggingEnabled = IniRead($ConfigFile, "Logging", "Logging", "Disabled")
$ConfigFileCheckPrinterSelection = IniRead($ConfigFile, "Printers", "Selected Printer", "Microsoft XPS Document Writer")
$ConfigFileCheckLogDir = IniRead($ConfigFile, "Logging", "Log Dir", "")
$ConfigFileNamingUtility = IniRead($ConfigFile, "Integration", "Workstation Naming Utility", "False")
#EndRegion Config.ini Settings

#Region Process Config Paramaters.
GUICtrlSetData($cboxPrinters, $ConfigFileCheckPrinterSelection)
#EndRegion Process Config Paramaters.
GetTechnicianName()
GUICtrlSetState($MenuItemPrint,$GUI_DISABLE)
GUICtrlSetState($MenuItemTransferUtility, $GUI_DISABLE)
GUISetState(@SW_SHOW, $MainGUI)


While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btnUpdate
            AddToSpreadsheet()
        Case $btnExit
            Exit
        Case $MenuItemPrint
            PrintDocuments()
        Case $MenuItemSettings
            GUISetState(@SW_DISABLE, $MainGUI)
            SettingsGUI()
            GUISetState(@SW_ENABLE, $MainGUI)
        Case $MenuItemExit
            Exit
        Case $MenuItemAbout
            GUISetState(@SW_DISABLE, $MainGUI)
            AboutBox()
            GUISetState(@SW_ENABLE, $MainGUI)
    EndSwitch
WEnd

Func AddToSpreadsheet()
    Local $UserID = GUICtrlRead($inputUserID)
    Local $ComputerName = GUICtrlRead($inputComputerName)
    Local $UserName = GUICtrlRead($inputName)
    Local $LotusPW = GUICtrlRead($inputLotusPW)
    Local $PhoneNo = GUICtrlRead($inputPhoneNo)
    Local $PW = GUICtrlRead($inputPW)
    Local $StartDate = GUICtrlRead($inputDate)
    Local $DeskLocation = GUICtrlRead($inputLocation)
    Local $SerialNumber = GUICtrlRead($inputSerialNo)
    Local $Technician = GUICtrlRead($inputTechnician)
    If GUICtrlRead($inputUserID) = "" Then
        MsgBox(16, "Missing info", "Please enter a User ID to continue", 0)
    ElseIf GUICtrlRead($inputComputerName) = "" Then
        MsgBox(16, "Missing info", "Please enter a Computer Name to continue", 0)
    ElseIf GUICtrlRead($inputName) = "" Then
        MsgBox(16, "Missing info", "Please enter a Name to continue", 0)
    ElseIf GUICtrlRead($inputLotusPW) = "" Then
        MsgBox(16, "Missing info", "Please enter a Lotus Notes Password to continue", 0)
    ElseIf GUICtrlRead($inputPhoneNo) = "" Then
        MsgBox(16, "Missing info", "Please enter a Phone Number to continue", 0)
    ElseIf GUICtrlRead($inputPW) = "" Then
        MsgBox(16, "Missing info", "Please enter a Windows Password to continue", 0)
    ElseIf GUICtrlRead($inputLocation) = "" Then
        MsgBox(16, "Missing info", "Please enter a Location to continue", 0)
    ElseIf GUICtrlRead($inputSerialNo) = "" Then
        MsgBox(16, "Missing info", "Please enter a Serial Number to continue", 0)
    Else
        GUICtrlSetState($btnUpdate,$GUI_DISABLE)
        GUICtrlSetState($btnExit,$GUI_DISABLE)
        $oExcelChecklist = _Excel_Open(False)
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error starting Excel." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        $sFilePathChecklist = @ScriptDir & "\Documents\New Hire Checklist.xlsx"
        $workbookChecklist = _Excel_BookOpen($oExcelChecklist, $sFilePathChecklist)
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error opening to workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $UserName, "D42")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $ComputerName, "E43")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $UserID, "J42")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $LotusPW, "K44")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $PhoneNo, "M42")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $PW, "C44")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $StartDate, "C45")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $DeskLocation, "J45")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $SerialNumber, "K43")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookChecklist, $workbookChecklist.Activesheet, $Technician, "N43")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        Sleep(500)
        $oExcelQuickGuide = _Excel_Open(False)
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error starting Excel." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        $sFilePathQuickGuide = @ScriptDir & "\Documents\New Hire Quick Guide.xlsx"
        $workbookQuickGuide = _Excel_BookOpen($oExcelQuickGuide, $sFilePathQuickGuide)
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error opening to workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookQuickGuide, $workbookQuickGuide.Activesheet, $UserName, "C8")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookQuickGuide, $workbookQuickGuide.Activesheet, $UserID, "H15")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookQuickGuide, $workbookQuickGuide.Activesheet, $PW, "H17")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookQuickGuide, $workbookQuickGuide.Activesheet, $LotusPW, "H19")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_RangeWrite($workbookQuickGuide, $workbookQuickGuide.Activesheet, $PhoneNo, "H21")
        If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        $DocumentsProcessed = True
    EndIf
    PrintDocuments()
    _Excel_BookClose($workbookChecklist, False)
    _Excel_BookClose($workbookQuickGuide, False)
;~  LoggingToExcel()
    ClearForm()
    GUICtrlSetState($btnUpdate,$GUI_ENABLE)
    GUICtrlSetState($btnExit,$GUI_ENABLE)
EndFunc   ;==>AddToSpreadsheet
Func DefaultPrinterChange()
    
    $sPrinterName = '"\\VUSSLBSRFS1001.agcs.biz\SecureColor"'
    $DefaultPrinter = _GetDefaultPrinter()
    RunWait(@ComSpec & " /c " & 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry ' & '/y /n ' & $sPrinterName, "", @SW_HIDE)
    
EndFunc   ;==>DefaultPrinterChange
Func DisableLoggingEnableButton()
    $IsLoggingEnabled = 1
    GUICtrlSetState($btnSettingsLoggingEnabled, $GUI_DISABLE)
    GUICtrlSetState($btnSettingsLoggingDisabled, $GUI_ENABLE)
    GUICtrlSetState($inputSettingsLogDir, $GUI_ENABLE)
    GUICtrlSetState($btnSettingsChooseLogDir, $GUI_ENABLE)
    GUICtrlSetState($btnSettingsOpenLog, $GUI_ENABLE)
EndFunc   ;==>DisableLoggingEnableButton
Func DisableLoggingDisableButton()
    $IsLoggingEnabled = 0
    GUICtrlSetState($btnSettingsLoggingDisabled, $GUI_DISABLE)
    GUICtrlSetState($btnSettingsLoggingEnabled, $GUI_ENABLE)
    GUICtrlSetState($inputSettingsLogDir, $GUI_DISABLE)
    GUICtrlSetState($btnSettingsChooseLogDir, $GUI_DISABLE)
    GUICtrlSetState($btnSettingsOpenLog, $GUI_DISABLE)
EndFunc   ;==>DisableLoggingDisableButton
Func SettingsGUI()
    GUICtrlSetState($btnSettingsSave, $GUI_ENABLE)
    Switch $ConfigFileIsLoggingEnabled
        Case "Enabled"
            GUICtrlSetState($btnSettingsLoggingEnabled, $GUI_DISABLE)
            GUICtrlSetState($inputSettingsLogDir, $GUI_ENABLE)
            GUICtrlSetState($btnSettingsChooseLogDir, $GUI_ENABLE)
            GUICtrlSetState($btnSettingsOpenLog, $GUI_ENABLE)
        Case "Disabled"
            GUICtrlSetState($btnSettingsLoggingDisabled, $GUI_DISABLE)
            GUICtrlSetState($inputSettingsLogDir, $GUI_DISABLE)
            GUICtrlSetState($btnSettingsChooseLogDir, $GUI_DISABLE)
            GUICtrlSetState($btnSettingsOpenLog, $GUI_DISABLE)
    EndSwitch


    EnumeratePrinterList()
    GUICtrlSetData($cboxPrinters, $ConfigFileCheckPrinterSelection)
    GUICtrlSetData($inputSettingsLogDir, $ConfigFileCheckLogDir)
    _GUICtrlEdit_SetSel($inputSettingsLogDir, 1, 1)
    GUISetState(@SW_SHOW, $Settings)
    
    While 1
        $msg = GUIGetMsg(1)
        Switch $msg[0]
            Case $GUI_EVENT_CLOSE
                GUISetState(@SW_HIDE, $Settings)
                GUISetState(@SW_SHOW, $MainGUI)
                ExitLoop
            Case $btnSettingsOK
                GUISetState(@SW_HIDE, $Settings)
                GUISetState(@SW_SHOW, $MainGUI)
                ExitLoop
            Case $btnSettingsSave
                GUICtrlSetState($btnSettingsOK,$GUI_DISABLE)
                Sleep(250)
                WriteSettingsToFile()
                GUICtrlSetState($btnSettingsSave, $GUI_DISABLE)
                Sleep(250)
                GUICtrlSetState($btnSettingsOK, $GUI_ENABLE)
            Case $btnSettingsLoggingEnabled
                DisableLoggingEnableButton()
            Case $btnSettingsLoggingDisabled
                DisableLoggingDisableButton()
            Case $btnSettingsChooseLogDir
                SelectLogDir()
                
                
        EndSwitch



    WEnd
EndFunc   ;==>SettingsGUI
Func EnumeratePrinterList()
    $wbemFlagReturnImmediately = "&h10"
    $wbemFlagForwardOnly = "&h20"

    $WMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2")
    $aItems = $WMI.ExecQuery("SELECT * FROM Win32_Printer", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

    For $printer In $aItems
        GUICtrlSetData($cboxPrinters, $printer.Name)
    Next
    
EndFunc   ;==>EnumeratePrinterList

Func SelectLogDir()

    $LogFileDirChoose = FileSaveDialog("Choose a location to save the log file", @ScriptDir, "Excel Files(*.xls)", $FD_PATHMUSTEXIST, "New Hire Log.xls", $Settings)
    GUICtrlSetData($inputSettingsLogDir, $LogFileDirChoose)
    _GUICtrlEdit_SetSel($inputSettingsLogDir, 1, 1)
    
;~  MsgBox(0,"", $LogFileDirChoose)
EndFunc   ;==>SelectLogDir

Func WriteSettingsToFile()
    $sFilePathLogFile = $ConfigFileCheckLogDir
    $Logging = ""
    $SelectedPrinter = GUICtrlRead($cboxPrinters)
    $LogDir = GUICtrlRead($inputSettingsLogDir)
    ;If log file does bot exist then create a new blank log file.
;~  If $ConfigFileIsLoggingEnabled = "Enabled" Or $IsLoggingEnabled = 1 Then
;~      If Not FileExists($LogDir) Then
;~          $oExcelLogFile = _Excel_Open(False)
;~          If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error starting Excel." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;~          $sFilePathLogFile = $ConfigFileCheckLogDir
;~          $CreateNewLogDirBook = _Excel_BookNew($oExcelLogFile)
;~          If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error creating workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;~          _Excel_RangeWrite($CreateNewLogDirBook, $CreateNewLogDirBook.Activesheet, "Date", "A1")
;~          _Excel_RangeWrite($CreateNewLogDirBook, $CreateNewLogDirBook.Activesheet, "Build Technician", "B1")
;~          _Excel_RangeWrite($CreateNewLogDirBook, $CreateNewLogDirBook.Activesheet, "User ID", "C1")
;~          _Excel_RangeWrite($CreateNewLogDirBook, $CreateNewLogDirBook.Activesheet, "User Name", "D1")
;~          _Excel_RangeWrite($CreateNewLogDirBook, $CreateNewLogDirBook.Activesheet, "Computer Name", "E1")
;~          _Excel_RangeWrite($CreateNewLogDirBook, $CreateNewLogDirBook.Activesheet, "Serial Number", "F1")
;~          _Excel_RangeWrite($CreateNewLogDirBook, $CreateNewLogDirBook.Activesheet, "Start Date", "G1")
;~          $oExcelLogFile.ActiveSheet.Columns(1).AutoFit
;~          $oExcelLogFile.ActiveSheet.Columns(2).AutoFit
;~          $oExcelLogFile.ActiveSheet.Columns(3).AutoFit
;~          $oExcelLogFile.ActiveSheet.Columns(4).AutoFit
;~          $oExcelLogFile.ActiveSheet.Columns(5).AutoFit
;~          $oExcelLogFile.ActiveSheet.Columns(6).AutoFit
;~          $oExcelLogFile.ActiveSheet.Columns(7).AutoFit
;~          If $ConfigFileCheckLogDir = "" Then $sFilePathLogFile = $LogFileDirChoose
;~          _Excel_BookSaveAs($CreateNewLogDirBook, $sFilePathLogFile, $xlExcel8, True)
;~          If @error Then
;~              MsgBox($MB_SYSTEMMODAL, "Error", "Error saving workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;~              _Excel_Close($oExcelLogFile)
;~              Exit
;~          EndIf
;~          _Excel_Close($oExcelLogFile)
;~      EndIf
;~  EndIf
    If $IsLoggingEnabled = 0 Then $Logging = "Disabled"
    If $IsLoggingEnabled = 1 Then $Logging = "Enabled"
    If GUICtrlRead($cbSettingsIntegrateNamingUtility) = 1 Then $Integration = "True"
    If GUICtrlRead($cbSettingsIntegrateNamingUtility) = 4 Then $Integration = "False"
    IniWrite($ConfigFile, "Integration", "Workstation Naming Utility", $Integration)
    IniWrite($ConfigFile, "Logging", "Logging", $Logging)
    IniWrite($ConfigFile, "Printers", "Selected Printer", $SelectedPrinter)
    IniWrite($ConfigFile, "Logging", "Log Dir", $LogDir)
    
EndFunc   ;==>WriteSettingsToFile
Func _GetDefaultPrinter() ; CyberSlug - 18 Nov 2004
    Local $key, $default
    If @OSType = "WIN32_WINDOWS" Then
        $key = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers"
        $defPrtNm = RegRead("HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\Print\Printers", "Default")
    Else ;WIN_NT type
        $key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers"
        $default = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device")
        $defPrtNm = StringLeft($default, StringInStr($default, ",") - 1)
        Return $defPrtNm
    EndIf
EndFunc   ;==>_GetDefaultPrinter

Func _PrintMgr_SetDefaultPrinter($sPrinterName)
    Local $iRet = 1
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    If Not IsObj($oWMIService) Then Return SetError(1, 0, 0)
    Local $oPrinters = $oWMIService.ExecQuery("Select * from Win32_Printer where DeviceID = '" & $sPrinterName & "'")
    If Not IsObj($oPrinters) Then Return SetError(1, 0, 0)

    For $oPrinter In $oPrinters
        $iRet = $oPrinter.SetDefaultPrinter()
    Next
    Return ($iRet = 0 ? 1 : SetError($iRet, 0, 0))
EndFunc   ;==>_PrintMgr_SetDefaultPrinter
Func PrintDocuments()
    If $DocumentsProcessed = False Then
        MsgBox(16, "Print Error", "No Data has been entered into Excel documents. Please update form and click Process before printing. ", 0, $MainGUI)
    Else
        $ConfigFileCheckPrinterSelection = IniRead($ConfigFile, "Printers", "Selected Printer", "") ;Check printer selected in settings menu.
        $DefaultPrinter = _GetDefaultPrinter() ;Retrieve Default Printer.Returns FQDN
        $SearchForSecureColor = StringMid($ConfigFileCheckPrinterSelection, 27) ;Check if SecureColor exists in selected Printer
        $SearchForSecureBnW = StringMid($ConfigFileCheckPrinterSelection, 27) ;Check if SecureB&W exists in Selected Printer.
        Local $sPrinterName = ""
        Local $sSubKey = ""
        For $i = 1 To 10
            $sSubKey = RegEnumKey("HKCU\Printers\Connections", $i) ;Find Keys for Printer Connections
            If @error Then ExitLoop
            $PrinterServer = StringMid($sSubKey, 3, 14) ;Trim values to only aquire server name.
            If StringInStr($sSubKey, "SecureColor") > 0 Then $sPrinterNameColor = "\\" & $PrinterServer & ".agcs.biz\SecureColor"
            If StringInStr($sSubKey, "SecureB&W") > 0 Then $sPrinterNameBnW = "\\" & $PrinterServer & ".agcs.biz\SecureB&W" ;Convert to string for default printer change command.
        Next
;~      $msgboxPrint = MsgBox(36, "Print", "Would you like to print the Quick Guide and Checklist?", 0)
;~      Switch $msgboxPrint
;~          Case 6 ;YES
        If $SearchForSecureColor = "SecureColor" Then ;If Secure Color is selected then
            $sPrinterNameColor = """\\" & $PrinterServer & ".agcs.biz\SecureColor"""
            RunWait(@ComSpec & " /c " & 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry ' & '/y /n ' & $sPrinterNameColor, "", @SW_HIDE) ;Set SecureColor as Default printer.
            ;Print Stuff from Excel
            _Excel_Print($oExcelChecklist, $workbookChecklist.Activesheet, Default, $ConfigFileCheckPrinterSelection, Default, Default, Default, Default, Default)
            If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Printing Error", "Error printing worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            MsgBox($MB_SYSTEMMODAL, "Print Success", "New Hire Checklist successfully printed.")
            _Excel_Print($oExcelQuickGuide, $workbookQuickGuide.Activesheet, Default, $ConfigFileCheckPrinterSelection, Default, Default, Default, Default, Default)
            If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Printing Error", "Error printing worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            MsgBox($MB_SYSTEMMODAL, "Print Success", "New Hire Quick Guide successfully printed.")
            ;Print Stuff from excel
            If $DefaultPrinter = "\\" & $PrinterServer & ".agcs.biz\SecureB&W" Then ;If the default OS printer was SecureB&W then
                $sPrinterName = '"\\' & $PrinterServer & '.agcs.biz\SecureB&W"'
                RunWait(@ComSpec & " /c " & 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry ' & '/y /n ' & $sPrinterName, "", @SW_HIDE) ;this command must be passed for a network printer because PrintMGRUDF does not support network printers at this time.
            Else ;If a local printer was the default then use built it PrintMGR function _PrintMgr_SetDefaultPrinter($DefaultPrinter)
                _PrintMgr_SetDefaultPrinter($DefaultPrinter)
            EndIf
        Else
            _Excel_Print($oExcelChecklist, $workbookChecklist.Activesheet, Default, $ConfigFileCheckPrinterSelection, Default, Default, Default, Default, Default)
            If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Printing Error", "Error printing worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            MsgBox($MB_SYSTEMMODAL, "Print Success", "New Hire Checklist successfully printed.")
            _Excel_Print($oExcelQuickGuide, $workbookQuickGuide.Activesheet, Default, $ConfigFileCheckPrinterSelection, Default, Default, Default, Default, Default)
            If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Printing Error", "Error printing worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            MsgBox($MB_SYSTEMMODAL, "Print Success", "New Hire Quick Guide successfully printed.")
        EndIf
;~          Case 7 ;NO
;~      EndSwitch
    EndIf
EndFunc   ;==>PrintDocuments
Func AboutBox()
    $FileVersion = FileGetVersion(@ScriptFullPath)
    GUICtrlSetData($lblAboutVersion, $FileVersion)
    GUISetState(@SW_SHOW, $About)
    
    While 1
        $msg = GUIGetMsg(1)
        Switch $msg[0]
            Case $GUI_EVENT_CLOSE
                GUISetState(@SW_HIDE, $About)
                GUISetState(@SW_SHOW, $MainGUI)
                ExitLoop
            Case $btnAboutClose
                GUISetState(@SW_HIDE, $About)
                GUISetState(@SW_SHOW, $MainGUI)
                ExitLoop
                
                
        EndSwitch



    WEnd

EndFunc   ;==>AboutBox

Func GetTechnicianName()
    _AD_Open()
    $TechName = @UserName
    $TechFQDN = _AD_SamAccountNameToFQDN($TechName)
    $TechDisplayName = _AD_FQDNToDisplayname($TechFQDN)
    GUICtrlSetData($inputTechnician, $TechDisplayName)
    _AD_Close()
EndFunc   ;==>GetTechnicianName

;~ Func LoggingToExcel()
;~  Local $UserID = GUICtrlRead($inputUserID)
;~  Local $ComputerName = GUICtrlRead($inputComputerName)
;~  Local $UserName = GUICtrlRead($inputName)
;~  Local $StartDate = GUICtrlRead($inputDate)
;~  Local $SerialNumber = GUICtrlRead($inputSerialNo)
;~  Local $TechName = GUICtrlRead($inputTechnician)
;~  Local $TodaysDate = _Date_Time_GetLocalTime()
;~  If $ConfigFileIsLoggingEnabled = "Enabled" Or $IsLoggingEnabled = 1 Then
;~      $oExcelLogFile = _Excel_Open(False)
;~      If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error starting Excel." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;~      $sFilePathLogFile = $ConfigFileCheckLogDir
;~      If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error creating workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;~      $workbookLogFile = _Excel_BookOpen($oExcelLogFile, $sFilePathLogFile)
;~      If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error opening to workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;~      $oRange = $workbookLogFile.ActiveSheet.UsedRange.SpecialCells($xlCellTypeLastCell)
;~      _Excel_RangeWrite($workbookLogFile, $workbookLogFile.Activesheet, _Date_Time_SystemTimeToDateTimeStr($TodaysDate), "A" & $oRange.row + 1)
;~      _Excel_RangeWrite($workbookLogFile, $workbookLogFile.Activesheet, $TechName, "B" & $oRange.row + 1)
;~      _Excel_RangeWrite($workbookLogFile, $workbookLogFile.Activesheet, $UserID, "C" & $oRange.row + 1)
;~      _Excel_RangeWrite($workbookLogFile, $workbookLogFile.Activesheet, $UserName, "D" & $oRange.row + 1)
;~      _Excel_RangeWrite($workbookLogFile, $workbookLogFile.Activesheet, $ComputerName, "E" & $oRange.row + 1)
;~      _Excel_RangeWrite($workbookLogFile, $workbookLogFile.Activesheet, $SerialNumber, "F" & $oRange.row + 1)
;~      _Excel_RangeWrite($workbookLogFile, $workbookLogFile.Activesheet, $StartDate, "G" & $oRange.row + 1)
;~      
;~      ;Auto Fit column width
;~      $oExcelLogFile.ActiveSheet.Columns(1).AutoFit
;~      $oExcelLogFile.ActiveSheet.Columns(2).AutoFit
;~      $oExcelLogFile.ActiveSheet.Columns(3).AutoFit
;~      $oExcelLogFile.ActiveSheet.Columns(4).AutoFit
;~      $oExcelLogFile.ActiveSheet.Columns(5).AutoFit
;~      $oExcelLogFile.ActiveSheet.Columns(6).AutoFit
;~      $oExcelLogFile.ActiveSheet.Columns(7).AutoFit
;~      _Excel_Close($oExcelLogFile, True)
;~  EndIf
;~  
;~  


;~  
;~ EndFunc   ;==>LoggingToExcel
Func ClearForm()
    GUiCtrlSetData($inputUserID,"")
    GUiCtrlSetData($inputComputerName,"")
    GUiCtrlSetData($inputName,"")
    GUiCtrlSetData($inputLotusPW,"")
    GUiCtrlSetData($inputPhoneNo,"")
    GUiCtrlSetData($inputPW,"")
    GUiCtrlSetData($inputDate,"")
    GUiCtrlSetData($inputLocation,"")
    GUiCtrlSetData($inputSerialNo,"")
    $DocumentsProcessed = False
EndFunc

 

 

I have attached my project to the post. New Hire Imaging Checklist Input Utility.zip

 

Here is a screen shot of the details from the AV. Again everything is fine until I click the button in my GUI that calls the FileSaveDialog function. (This is on the settings page and logging must be enabled in order for the "..." button to be opened)

 

9-7-2016 9-42-38 AM.jpg

 

 

Share this post


Link to post
Share on other sites



2 minutes ago, Kaimberex said:

Can anyone think of a reason why the FileSaveDialog would trigger an AV?

Probably a question that needs to be answered by Symantec. ;)

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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