Fractured Posted October 17, 2018 Share Posted October 17, 2018 (edited) So, im upgrading my search script, added a secound GUI with a List since the paths returned were so long and the number of returns outgrew the old window. Now when I run the script I get an error window that pops up. Ive been looking at forum/google but no clue...so im stumped. Some of the functions are not incorporated yet, could that be a problem? Anyone got ideas?!? Thanks in advance expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Search.ico #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#INDEX# ============================================================================================================================= ; Title .........: Fast Find v5.0 ; AutoIt Version : 3.3.14.5 ; Language ......: English ; Author(s) .....: Charles Wright, Melba23(Fixed Search Functions), caramen & BigDaddyO(UNC Path Fix) ; Modifiers .....: ; Forum link ....: ; Description ...: Searches for documents relevant to Test ; ===================================================================================================================================== #Region #EndRegion ; #Includes# ========================================================================================================================== #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> ; #Global Variables# =================================================================================================================== Global $RState = 0 Global $g_sFilePatha = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\" Global $g_sFilePathb = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\ATP\" Global $g_sFilePathc = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\Manuals\" Global $g_sFilePathd = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\Manuals-iso images\" Global $g_sFilePathe = "\\frd-s-fil01.ad.apitech.com\data\public\NGARNESKI\" Global $g_sFilePathf = "\\frd-s-fil01.ad.apitech.com\data\public\SHAHARIAR\" Global $g_sFilePathg = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DOC REL\" Global $SlideFLag = 1 Global $List1, $g_Core, $r_Drawing, $r_ATP, $r_ISO, $r_Manual, $r_Extended, $b_Search, $Input1, $b_Select, $g_Result, $aMsg _gCore() Func _gCore() $g_Core = GUICreate("Fast Find v5.0", 240, 220, 1738, 2) GUISetIcon("I:\Work\Macro\AutoIT Scripts\Mine\01.ico", -1) GUISetBkColor(0xFFFBF0) $r_Drawing = GUICtrlCreateRadio("Drawing", 16, 48, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_ATP = GUICtrlCreateRadio("ATP", 16, 72, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_Manual = GUICtrlCreateRadio("Manual", 16, 96, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_ISO = GUICtrlCreateRadio("Manual-ISO", 16, 120, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_Extended = GUICtrlCreateRadio("Extended (Slow Search)", 16, 144, 201, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("", 16, 16, 185, 21) $b_Search = GUICtrlCreateButton("Search", 64, 176, 75, 25) GUISetState(@SW_SHOW) HotKeySet("{PAUSE}", "_Slider") EndFunc ;==>_gCore While 1 $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array Switch $aMsg[1] ; check which GUI sent the message Case $g_Core Switch $aMsg[1] ; Now check for the messages for $hGUI1 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<< ExitLoop Case $r_Drawing $RState = 1 Case $r_ATP $RState = 2 Case $r_Manual $RState = 3 Case $r_ISO $RState = 4 Case $r_Extended $RState = 5 Case $b_Search If $RState = 1 Then gResult() GUICtrlSetData($List1, GUICtrlRead($Input1) = "" ? "" : _FSearch1(GUICtrlRead($Input1))) EndIf If $RState = 2 Then gResult() GUICtrlSetData($List1, GUICtrlRead($Input1) = "" ? "" : _FSearch2(GUICtrlRead($Input1))) EndIf If $RState = 3 Then gResult() GUICtrlSetData($List1, GUICtrlRead($Input1) = "" ? "" : _FSearch3(GUICtrlRead($Input1))) EndIf If $RState = 4 Then gResult() GUICtrlSetData($List1, GUICtrlRead($Input1) = "" ? "" : _FSearch4(GUICtrlRead($Input1))) EndIf If $RState = 5 Then gResult() GUICtrlSetData($List1, GUICtrlRead($Input1) = "" ? "" : _Extended(GUICtrlRead($Input1))) EndIf EndSwitch Case $g_Result Switch $aMsg[0] ; Now check for the messages for $g_hGUI2 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<< GUIDelete($g_Result) Case $b_Select Local $sResult = GUICtrlRead($List1) ShellExecute($sResult) EndSwitch EndSwitch WEnd Func gResult() $g_Result = GUICreate("Fast Find Results", 1309, 674, 201, 116) GUISetBkColor(0xFFFBF0) $List1 = GUICtrlCreateList("", 16, 8, 1273, 604, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) GUICtrlSetData(-1, "Edit1") GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $b_Select = GUICtrlCreateButton("Select", 592, 624, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) EndFunc ;==>gResult ; #Error Codes Function# ================================================================================================================================= Func _ErrorCodes($iErrorCode = 0) Switch $iErrorCode Case 1 MsgBox(4096, "File List To Array Error", "Path not found or invalid") Return 1 Case 2 MsgBox(4096, "File List To Array Error", "Invalid Include parameter") Return 1 Case 3 MsgBox(4096, "File List To Array Error", "Invalid Exclude parameter") Return 1 Case 4 MsgBox(4096, "File List To Array Error", "Invalid Exclude_Folders parameter") Return 1 Case 5 MsgBox(4096, "File List To Array Error", "Invalid $iReturn parameter") Return 1 Case 6 MsgBox(4096, "File List To Array Error", "Invalid $iRecur parameter") Return 1 Case 7 MsgBox(4096, "File List To Array Error", "Invalid $iSort parameter") Return 1 Case 8 MsgBox(4096, "File List To Array Error", "Invalid $iReturnPath parameter") Return 1 Case 9 MsgBox(4096, "File List To Array Error", "No files/folders found") Return 1 Case Else Return 0 EndSwitch EndFunc ;==>_ErrorCodes ; #End Error Codes# ==================================================================================================================================== ;#File Search Function 1 DWG# ==================================================================================================================== Func _FSearch1($sSearch = "DWG") GUICtrlSetData($List1, "") Local $idSearchSL = StringLeft($sSearch, 3) ;~ Store just first 3 characters of $idSearch Local $sSourceFolder = $g_sFilePatha & "DWG" & $idSearchSL If FileExists($sSourceFolder) = 0 Then MsgBox(4096, "File Path Error", $sSourceFolder & " does not exist.") Return "" EndIf Local $sSearchMask = $sSearch & "?.*" Local $aFileList = _FileListToArrayRec($sSourceFolder, $sSearchMask & "*|*.cdr", 1, 0, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileList = "" Return _ArrayToString($aFileList, "" & @CRLF, 1) EndFunc ;==>_FSearch1 ; #End File Search Function 1 DWG# =================================================================================================================== ; #File Search Function 2 ATP# ======================================================================================================================= Func _FSearch2($sSearch = $Input1) GUICtrlSetData($List1, "") If FileExists($g_sFilePathb) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathb & " does not exist.") Return "" EndIf Local $sSearchMask = "ATP" & $sSearch & "*.*" Local $aFileListb = _FileListToArrayRec($g_sFilePathb, $sSearchMask & "*|*.vp", 1, 0, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListb = "" Return _ArrayToString($aFileListb, "" & @CRLF, 1) EndFunc ;==>_FSearch2 ; #End File Search Function 2 ATP# ======================================================================================================================= ; #File Search Function 3 Manuals# ======================================================================================================================= Func _FSearch3($sSearch = $Input1) GUICtrlSetData($List1, "") If FileExists($g_sFilePathc) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathc & " does not exist.") Return "" EndIf Local $sSearchMask = "IM-" & $sSearch & "*.pdf" Local $aFileListc = _FileListToArrayRec($g_sFilePathc, $sSearchMask & "*|*.vp", 1, 1, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListc = "" Return _ArrayToString($aFileListc, "" & @CRLF, 1) EndFunc ;==>_FSearch3 ; #End File Search Function 3 Manuals# ================================================================================================================= ; #File Search Function 4 Manuals-ISO# ================================================================================================================= Func _FSearch4($sSearch = $Input1) GUICtrlSetData($List1, "") If FileExists($g_sFilePathd) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathd & " does not exist.") Return "" EndIf Local $sSearchMask = "IM" & $sSearch & "*.iso" Local $aFileListd = _FileListToArrayRec($g_sFilePathd, $sSearchMask & "*|*.vp", 1, 0, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListd = "" Return _ArrayToString($aFileListd, "" & @CRLF, 1) EndFunc ;==>_FSearch4 ; #End File Search Function 4 Manuals-ISO# =============================================================================================================== ; #File Search Function 5 Extended ======================================================================================================================= Func _Extended($sSearch = $Input1) GUICtrlSetData($List1, "") Local $sSearchMask = $sSearch & "*.*" Local $aFileListe = _FileListToArrayRec($g_sFilePathe, $sSearchMask & "*", 1, 1, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListe = "" Local $aFileListf = _FileListToArrayRec($g_sFilePathf, $sSearchMask & "*", 1, 1, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListf = "" Local $aFileListFull = $aFileListe _ArrayAdd($aFileListFull, $aFileListf) Return _ArrayToString($aFileListFull, "" & @CRLF, 1) EndFunc ;==>_Extended ; #End File Search Function 5 Extended =============================================================================================================== Func _Slider() Select Case $SlideFLag = 0 DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $g_Core, "int", 1000, "long", 0x00040004) ;slide-in from top $SlideFLag = 1 Case $SlideFLag = 1 DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $g_Core, "int", 1000, "long", 0x00050008) ;slide-out to top $SlideFLag = 0 EndSelect EndFunc ;==>_Slider ; #FUNCTION# ============================================================================================== ; Name ..........: _OutFile ; ========================================================================================================= Func _OutFile() $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" ;Declares The variable $MyDocsFolder $savewhere = FileSaveDialog("Save to...", $MyDocsFolder, "Rich Text Files (*rtf)", 2) ;opens a dialog where you want to save your file If StringInStr($savewhere, ".rtf") Then ;checks if the file extention is already there _FileCreate($savewhere) ;creates the file in directory selected (I'm not sure if it's necessary or not) $savetofile = _GUICtrlRichEdit_StreamToFile($List1, $savewhere) Else ;else adds file extention $savewhere = $savewhere & ".rtf" _FileCreate($savewhere) ;creates the file in directory selected (I'm not sure if it's necessary or not) $savetofile = _GUICtrlRichEdit_StreamToFile($List1, $savewhere) EndIf ;Ends the if EndFunc ;==>_OutFile Edited October 18, 2018 by Fractured Link to comment Share on other sites More sharing options...
Fractured Posted October 17, 2018 Author Share Posted October 17, 2018 ok..using the wrapper debug..(um yeah, im not always quick)..I found if I comment out the "Case $b_Select" from the "Case $g_Result" it dosent get the error..but im not sure why the error happens in the first place...the Select button should not be registering as far as I know until the 2nd gui opens and its clicked.... The plot thickens for this here noob! Link to comment Share on other sites More sharing options...
Fractured Posted October 17, 2018 Author Share Posted October 17, 2018 Fixed the errors, but now ive got a new problem...When you do an extended search, it opens 3 instances of gResult. I can only close one of them and then I get the same error as above if I try to close or select from either of the 2 open instances......how can I tell the script which instance I want to close? select from? expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Search.ico #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Run_Debug_Mode=Y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#INDEX# ============================================================================================================================= ; Title .........: Fast Find v5.0 ; AutoIt Version : 3.3.14.5 ; Language ......: English ; Author(s) .....: Charles Wright, Melba23(Fixed Search Functions), caramen & BigDaddyO(UNC Path Fix) ; Modifiers .....: ; Forum link ....: ; Description ...: Searches for documents relevant to Test ; ===================================================================================================================================== #Region #EndRegion ; #Includes# ========================================================================================================================== #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> ; #Global Variables# =================================================================================================================== Global $g_sFilePatha = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\" Global $g_sFilePathb = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\ATP\" Global $g_sFilePathc = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\Manuals\" Global $g_sFilePathd = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\Manuals-iso images\" Global $g_sFilePathe = "\\frd-s-fil01.ad.apitech.com\data\public\NGARNESKI\" Global $g_sFilePathf = "\\frd-s-fil01.ad.apitech.com\data\public\SHAHARIAR\" Global $g_sFilePathg = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DOC REL\" Global $RState = 0 Global $SlideFLag = 1 Global $List1, $g_Core, $r_Drawing, $r_ATP, $r_ISO, $r_Manual, $r_Extended, $b_Search, $Input1, $b_Select, $g_Result, $sResult Opt("GUIOnEventMode", 1) _gCore() Func _gCore() $g_Core = GUICreate("Fast Find v5.0", 240, 220, 1738, 2) GUISetBkColor(0xFFFBF0) GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close") $r_Drawing = GUICtrlCreateRadio("Drawing", 16, 48, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_ATP = GUICtrlCreateRadio("ATP", 16, 72, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_Manual = GUICtrlCreateRadio("Manual", 16, 96, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_ISO = GUICtrlCreateRadio("Manual-ISO", 16, 120, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_Extended = GUICtrlCreateRadio("Extended (Slow Search)", 16, 144, 201, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") Global $Input1 = GUICtrlCreateInput("", 16, 16, 185, 21) $b_Search = GUICtrlCreateButton("Search", 64, 176, 75, 25) GUICtrlSetOnEvent(-1, "_Search") GUISetState(@SW_SHOW) HotKeySet("{PAUSE}", "_Slider") While 1 Sleep(10) WEnd EndFunc ;==>_gCore Func gResult($sFileListDone) $g_Result = GUICreate("Fast Find Results", 1309, 674, 201, 116) GUISetBkColor(0xFFFBF0) GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close") $List1 = GUICtrlCreateList("", 16, 8, 1273, 604, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) GUICtrlSetData(-1, $sFileListDone) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") Local $b_Select = GUICtrlCreateButton("Select", 592, 624, 75, 25) GUICtrlSetOnEvent(-1, "_Select") GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUISetState() EndFunc ;==>gResult Func _Search() Select Case GUICtrlRead($r_Drawing) = "1" $GCR_Input1 = GUICtrlRead($Input1) Local $idSearchSL = StringLeft($GCR_Input1, 3) ;~ Store just first 3 characters of $idSearch Local $sSourceFolder = $g_sFilePatha & "DWG" & $idSearchSL If FileExists($sSourceFolder) = 0 Then MsgBox(4096, "File Path Error", $sSourceFolder & " does not exist.") Return "" EndIf Local $sSearchMask = $GCR_Input1 & "?.*" Local $aFileList = _FileListToArrayRec($sSourceFolder, $sSearchMask & "*|*.cdr", 1, 0, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileList = "" Global $sFileListDone = _ArrayToString($aFileList, "|", 1) Call(gResult, $sFileListDone) Case GUICtrlRead($r_ATP) = "1" $GCR_Input1 = GUICtrlRead($Input1) If FileExists($g_sFilePathb) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathb & " does not exist.") Return "" EndIf Local $sSearchMask = "ATP" & $GCR_Input1 & "*.*" Local $aFileListb = _FileListToArrayRec($g_sFilePathb, $sSearchMask & "*|*.vp", 1, 0, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListb = "" Global $sFileListDone = _ArrayToString($aFileListb, "|", 1) Call(gResult, $sFileListDone) Case GUICtrlRead($r_Manual) = "1" $GCR_Input1 = GUICtrlRead($Input1) If FileExists($g_sFilePathc) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathc & " does not exist.") Return "" EndIf Local $sSearchMask = "IM-" & $GCR_Input1 & "*.pdf" Local $aFileListc = _FileListToArrayRec($g_sFilePathc, $sSearchMask & "*|*.vp", 1, 1, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListc = "" Global $sFileListDone = _ArrayToString($aFileListc, "|", 1) Call(gResult, $sFileListDone) Case GUICtrlRead($r_ISO) = "1" $GCR_Input1 = GUICtrlRead($Input1) If FileExists($g_sFilePathd) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathd & " does not exist.") Return "" EndIf Local $sSearchMask = "IM" & $GCR_Input1 & "*.iso" Local $aFileListd = _FileListToArrayRec($g_sFilePathd, $sSearchMask & "*|*.vp", 1, 0, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListd = "" Global $sFileListDone = _ArrayToString($aFileListd, "|", 1) Call(gResult, $sFileListDone) Case GUICtrlRead($r_Extended) = "1" $GCR_Input1 = GUICtrlRead($Input1) Local $sSearchMask = "*" & $GCR_Input1 & "*.*" Local $aFileListe = _FileListToArrayRec($g_sFilePathe, $sSearchMask & "*", 1, 1, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListe = "" Global $sFileListDone = _ArrayToString($aFileListe, "|", 1) Call(gResult, $sFileListDone) Local $aFileListf = _FileListToArrayRec($g_sFilePathf, $sSearchMask & "*", 1, 1, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListf = "" Global $sFileListDone = _ArrayToString($aFileListf, "|", 1) Call(gResult, $sFileListDone) Local $aFileListg = _FileListToArrayRec($g_sFilePathg, $sSearchMask & "*", 1, 1, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListg = "" Global $sFileListDone = _ArrayToString($aFileListg, "|", 1) Call(gResult, $sFileListDone) EndSelect EndFunc ;==>_Search Func _Select() $sResult = GUICtrlRead($List1) ShellExecute($sResult) EndFunc ;==>_Select Func On_Close() Switch @GUI_WinHandle ; See which GUI sent the CLOSE message Case $g_Core Exit ; If it was this GUI - we exit <<<<<<<<<<<<<<< Case $g_Result GUIDelete($g_Result) ; If it was this GUI - we just delete the GUI <<<<<<<<<<<<<<< GUICtrlSetState($g_Core, $GUI_ENABLE) EndSwitch EndFunc ;==>On_Close ; #Error Codes Function# ================================================================================================================================= Func _ErrorCodes($iErrorCode = 0) Switch $iErrorCode Case 1 MsgBox(4096, "File List To Array Error", "Path not found or invalid") Return 1 Case 2 MsgBox(4096, "File List To Array Error", "Invalid Include parameter") Return 1 Case 3 MsgBox(4096, "File List To Array Error", "Invalid Exclude parameter") Return 1 Case 4 MsgBox(4096, "File List To Array Error", "Invalid Exclude_Folders parameter") Return 1 Case 5 MsgBox(4096, "File List To Array Error", "Invalid $iReturn parameter") Return 1 Case 6 MsgBox(4096, "File List To Array Error", "Invalid $iRecur parameter") Return 1 Case 7 MsgBox(4096, "File List To Array Error", "Invalid $iSort parameter") Return 1 Case 8 MsgBox(4096, "File List To Array Error", "Invalid $iReturnPath parameter") Return 1 Case 9 MsgBox(4096, "File List To Array Error", "No files/folders found") Return 1 Case Else Return 0 EndSwitch EndFunc ;==>_ErrorCodes ; #End Error Codes# ==================================================================================================================================== Func _Slider() Select Case $SlideFLag = 0 DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $g_Core, "int", 1000, "long", 0x00040004) ;slide-in from top $SlideFLag = 1 Case $SlideFLag = 1 DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $g_Core, "int", 1000, "long", 0x00050008) ;slide-out to top $SlideFLag = 0 EndSelect EndFunc ;==>_Slider Link to comment Share on other sites More sharing options...
Fractured Posted October 18, 2018 Author Share Posted October 18, 2018 After reading, typing, errors, and repeat I figured it out! I stopped opening multiple GUI's of $g_Result...made each extended search its own array, added them together and displayed them on 1 $g_Result window. Had to change the On-Close Function since even when all guis were closed/exited the main loop kept running. I attached the code incase anyone was interested and also if anyone can make it pretty! expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Search.ico #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#INDEX# ============================================================================================================================= ; Title .........: Fast Find v5.0 ; AutoIt Version : 3.3.14.5 ; Language ......: English ; Author(s) .....: Charles Wright, Melba23(Fixed Search Functions), caramen & BigDaddyO(UNC Path Fix) ; Modifiers .....: ; Forum link ....: ; Description ...: Searches for documents relevant to Test ; ===================================================================================================================================== #Region #EndRegion ; #Includes# ========================================================================================================================== #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> ; #Global Variables# =================================================================================================================== Global $g_sFilePatha = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\" Global $g_sFilePathb = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\ATP\" Global $g_sFilePathc = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\Manuals\" Global $g_sFilePathd = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DWG VAULT\Manuals-iso images\" Global $g_sFilePathe = "\\frd-s-fil01.ad.apitech.com\data\public\NGARNESKI\" Global $g_sFilePathf = "\\frd-s-fil01.ad.apitech.com\data\public\SHAHARIAR\" Global $g_sFilePathg = "\\frd-s-fil01.ad.apitech.com\data\Drawing Vault\DOC REL\" Global $RState = 0 Global $SlideFLag = 1 Global $List1, $g_Core, $r_Drawing, $r_ATP, $r_ISO, $r_Manual, $r_Extended, $b_Search, $Input1, $b_Select, $g_Result, $sResult, $sSearchMask, $sTitle, $sSourceFolder Global $aFileListg Opt("GUIOnEventMode", 1) _gCore() Func _gCore() $g_Core = GUICreate("Fast Find v5.0", 240, 220, 1738, 2) GUISetBkColor(0xFFFBF0) GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Main") $r_Drawing = GUICtrlCreateRadio("Drawing", 16, 48, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_ATP = GUICtrlCreateRadio("ATP", 16, 72, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_Manual = GUICtrlCreateRadio("Manual", 16, 96, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_ISO = GUICtrlCreateRadio("Manual-ISO", 16, 120, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $r_Extended = GUICtrlCreateRadio("Extended (Slow Search)", 16, 144, 201, 17) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") Global $Input1 = GUICtrlCreateInput("", 16, 16, 185, 21) $b_Search = GUICtrlCreateButton("Search", 64, 176, 75, 25) GUICtrlSetOnEvent(-1, "_Search") GUISetState(@SW_SHOW) HotKeySet("{PAUSE}", "_Slider") While 1 Sleep(10) WEnd EndFunc ;==>_gCore Func gResult($sFileListDone) $g_Result = GUICreate($sTitle, 1309, 674, 201, 116) GUISetBkColor(0xFFFBF0) GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Result") $List1 = GUICtrlCreateList("", 16, 8, 1273, 604, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) GUICtrlSetData(-1, $sFileListDone) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") Local $b_Select = GUICtrlCreateButton("Select", 592, 624, 75, 25) GUICtrlSetOnEvent(-1, "_Select") GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUISetState() EndFunc ;==>gResult Func _Search() Select Case GUICtrlRead($r_Drawing) = "1" $GCR_Input1 = GUICtrlRead($Input1) Local $idSearchSL = StringLeft($GCR_Input1, 3) ;~ Store just first 3 characters of $idSearch Local $sSourceFolder = $g_sFilePatha & "DWG" & $idSearchSL If FileExists($sSourceFolder) = 0 Then MsgBox(4096, "File Path Error", $sSourceFolder & " does not exist.") Return "" EndIf Local $sSearchMask = $GCR_Input1 & "?.*" Local $aFileList = _FileListToArrayRec($sSourceFolder, $sSearchMask & "*|*.cdr", 1, 0, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileList = "" Global $sFileListDone = _ArrayToString($aFileList, "|", 1) Global $sTitle = $sSourceFolder & $sSearchMask Call(gResult, $sFileListDone) Case GUICtrlRead($r_ATP) = "1" $GCR_Input1 = GUICtrlRead($Input1) If FileExists($g_sFilePathb) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathb & " does not exist.") Return "" EndIf Local $sSearchMask = "ATP" & $GCR_Input1 & "*.*" Local $aFileListb = _FileListToArrayRec($g_sFilePathb, $sSearchMask & "*|*.vp", 1, 0, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListb = "" Global $sFileListDone = _ArrayToString($aFileListb, "|", 1) Global $sTitle = $g_sFilePathb & $sSearchMask Call(gResult, $sFileListDone) Case GUICtrlRead($r_Manual) = "1" $GCR_Input1 = GUICtrlRead($Input1) If FileExists($g_sFilePathc) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathc & " does not exist.") Return "" EndIf Local $sSearchMask = "IM-" & $GCR_Input1 & "*.pdf" Local $aFileListc = _FileListToArrayRec($g_sFilePathc, $sSearchMask & "*|*.vp", 1, 1, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListc = "" Global $sFileListDone = _ArrayToString($aFileListc, "|", 1) Global $sTitle = $g_sFilePathc & $sSearchMask Call(gResult, $sFileListDone) Case GUICtrlRead($r_ISO) = "1" $GCR_Input1 = GUICtrlRead($Input1) If FileExists($g_sFilePathd) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathd & " does not exist.") Return "" EndIf Local $sSearchMask = "IM" & $GCR_Input1 & "*.iso" Local $aFileListd = _FileListToArrayRec($g_sFilePathd, $sSearchMask & "*|*.vp", 1, 0, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListd = "" Global $sFileListDone = _ArrayToString($aFileListd, "|", 1) Global $sTitle = $g_sFilePathd & $sSearchMask Call(gResult, $sFileListDone) Case GUICtrlRead($r_Extended) = "1" $GCR_Input1 = GUICtrlRead($Input1) Global $sTitle = "Extended" Global $sSearchMask = "*" & $GCR_Input1 & "*.*" Local $aFileListe = _FileListToArrayRec($g_sFilePathe, $sSearchMask & "*", 1, 1, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListe = "" Local $aFileListf = _FileListToArrayRec($g_sFilePathf, $sSearchMask & "*", 1, 1, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListf = "" Local $aFileListf = _FileListToArrayRec($g_sFilePathg, $sSearchMask & "*", 1, 1, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListf = "" Local $aFileListFull = $aFileListe _ArrayAdd($aFileListFull, $aFileListf) _ArrayAdd($aFileListFull, $aFileListg) Global $sFileListDone = _ArrayToString($aFileListFull, "|", 1) Call(gResult, $sFileListDone) EndSelect EndFunc ;==>_Search Func _Select() $sResult = GUICtrlRead($List1) ShellExecute($sResult) EndFunc ;==>_Select Func On_Close_Main() Exit EndFunc ;==>On_Close_Main Func On_Close_Result() GUIDelete($g_Result) GUISetState(@SW_ENABLE, $g_Core) EndFunc ;==>On_Close_Result ; #Error Codes Function# ================================================================================================================================= Func _ErrorCodes($iErrorCode = 0) Switch $iErrorCode Case 1 MsgBox(4096, "File List To Array Error", "Path not found or invalid") Return 1 Case 2 MsgBox(4096, "File List To Array Error", "Invalid Include parameter") Return 1 Case 3 MsgBox(4096, "File List To Array Error", "Invalid Exclude parameter") Return 1 Case 4 MsgBox(4096, "File List To Array Error", "Invalid Exclude_Folders parameter") Return 1 Case 5 MsgBox(4096, "File List To Array Error", "Invalid $iReturn parameter") Return 1 Case 6 MsgBox(4096, "File List To Array Error", "Invalid $iRecur parameter") Return 1 Case 7 MsgBox(4096, "File List To Array Error", "Invalid $iSort parameter") Return 1 Case 8 MsgBox(4096, "File List To Array Error", "Invalid $iReturnPath parameter") Return 1 Case 9 MsgBox(4096, "File List To Array Error", "No files/folders found") Return 1 Case Else Return 0 EndSwitch EndFunc ;==>_ErrorCodes ; #End Error Codes# ==================================================================================================================================== Func _Slider() Select Case $SlideFLag = 0 DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $g_Core, "int", 1000, "long", 0x00040004) ;slide-in from top $SlideFLag = 1 Case $SlideFLag = 1 DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $g_Core, "int", 1000, "long", 0x00050008) ;slide-out to top $SlideFLag = 0 EndSelect EndFunc ;==>_Slider Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now