-
Posts
563 -
Joined
-
Last visited
Everything posted by KickStarter15
-
Search Folder with Underscore in Directory
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@Subz form this "StringLeft($dir,StringInStr($dir,"_",0,-1)-1)" all the characters from left for this folder name "BGQ100360_*" were ignored until it found the first underscore "_" and return the final string which is the "BGQ100360". Now locating this folder using fileexist from the desired path it is now found and that way I can identify the duplicate folder and generate them in my log.txt. It is something like this: I don't know if I coded it right😅 but it works. $File = FileOpen(@ScriptDir & "\FolderList.txt", 0) ; This is where all folder name were listed $xFile = FileOpen(@ScriptDir & "\Log.txt", 2) ; this is my log report FileWriteLine($xFile, @UserName & " processed " & @MON & "/" & @MDAY & "/" & @YEAR & ": " & @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC) For $i = 1 to _FileCountLines($File) $line = FileReadLine($File, $i) $MainFolder = $Server & $line ; $server is the full path where to find these folderlist Local $aFileList = _FileListToArray($MainFolder, "*", 1) If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "Error", "No file(s) were found.") Exit EndIf FileWrite($xFile, @CRLF & $line & @CRLF) _GUICtrlRichEdit_InsertText($Edit1, @CRLF & $line) If Not @Error Then _FileWriteFromArray($xFile, $aFileList, 1, Default, @CRLF) $dir = $Server & $line & "_*" $dir_parent = StringLeft($dir,StringInStr($dir,"_",0,-1)-1) If $aFileList = 0 Then _GUICtrlRichEdit_InsertText($Edit1, "............. Folder Not Found in: " & $Server & $line) FileWrite($xFile, "Folder Not Found in: " & $Server & $line & @CRLF) EndIf If FileExists($dir) Then _GUICtrlRichEdit_InsertText($Edit1, @CRLF & $line & " ............. Process this locally: " & $line) FileWrite($xFile, ">>>>> Duplicate folders found in BG server" & $line & "_*" & @CRLF) ; this is the log report EndIf EndIf Next -
Search Folder with Underscore in Directory
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@Subz thanks but I think I've found another way by using below code found in help file and it shows what I expected😂. $dir = @ScriptDir & "\BGQ100360_*" $dir_parent = StringLeft($dir,StringInStr($dir,"_",0,-1)-1) MsgBox(0,"",$dir_parent) if FileExists($dir) Then MsgBox("","","Match") Else MsgBox("","","Not Match") EndIf -
Search Folder with Underscore in Directory
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@FrancescoDiMuro, Yes thanks for the info about the path. But I need to compare the original foldername if there is duplicate folder from the parent folder. As for the code in image, it is not for the image code but for the prompt message saying "No folders found" its just a snippet of the messagebox, apologies if it was misunderstood😅. Anyways, is this possible to check inside the parent folder if both exist? BGQ100360 and BGQ100360_31150ed7fb5840e1852fda7b65b0b411? these folders are duplicate and I need to get them for removal (if incase) and checking. This is the parent folder "...\Get Files in folder\" and both folders with the same foldername are inside this parent folder. These codes below are from @Subz and both has the same output. They display only this BGQ100360_31150ed7fb5840e1852fda7b65b0b411 but not comparing if folder already exist. _FileListToArrayRec($Server, "_*", 2, 1, 0, 0) And the new one. #include <Array.au3> #include <File.au3> $g_aFolderList = _FolderList(@ScriptDir & "\", "BGQ100360_*") _ArrayDisplay($g_aFolderList) Func _FolderList($_sFolderPath, $_sFilter = "*_*") Local $aFolderList = _FileListToArrayRec($_sFolderPath, $_sFilter, 2, 1, 0, 2) If @error Then Return MsgBox(4096, "Error", "No folders found") Return $aFolderList EndFunc -
Search Folder with Underscore in Directory
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@Subz I tried changing something but still the same prompt. I even expanded my path just to make sure it is correct. I'm a bit confused on this code how to work, apologies Subz😞 if I did not get it right. These files already exist in that path. -
Search Folder with Underscore in Directory
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@Subz Thanks, but it will just return as "No folders found" even if the folder already exist in the path. -
Search Folder with Underscore in Directory
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@Subz Thank you so much, It returns the folders with underscores. One more thing, is there a way to compare them in the original folder name? like the original foldername is BQ100360 but it was duplicated with the one with underscores. Is that possible to do? -
Hi Experts, I've been checking around the forum and search engine about how to get folders with underscore as their extension (like "ABC1891123_avxnam1231") of their folder name but sadly could not find any that has this scenario. I tried using some stringInString() but no success. Is there anyone here knows something like this? Please guide me how. Still no code yet could not compose one😅, sorry... Thanks in Advance, Expert. KS15
-
@FrancescoDiMuro, I got it now working. Thanks. I still have another problem below. I need to show these process in my EditBox GUICtrlCreateEdit() or in _GUICtrlRichEdit_Create() using GUICtrlSetData() or _GUICtrlRichEdit_InsertText() but both are not working. BTL105131 - Filename here... - Filename here... - Filename here... - Filename here... SYM100758 - Filename here... - Filename here... - Filename here... - Filename here... Here's the code I tried: $File = FileOpen(@ScriptDir & "\FolderList.txt") Global $xFile = FileOpen(@ScriptDir & "\Log.txt", 1) FileOpen($File, 0) For $i = 1 to _FileCountLines($File) $line = FileReadLine($File, $i) Global $MainFolder = $sFileSelectFolder & $line Local $aFileList = _FileListToArray($MainFolder, "*", 1) If Not @Error Then _FileWriteFromArray($xFile, $aFileList, 1, Default, @CRLF) ; I need to insert the progress of $aFileList in editbox _GUICtrlRichEdit_InsertText($Edit1, $aFileList) ; Here's the attempt but not working If $aFileList = 0 Then _GUICtrlRichEdit_InsertText($Edit1, "..................... Not Found here: " & $sFileSelectFolder & $line) EndIf EndIf I need it to be in my editbox same as below.
-
@Nine I tried replacing the code with the suggested of your but it will just add the total number of files being read and not like below as expected. BTL105131 - Filename here... - Filename here... - Filename here... - Filename here... SYM100758 - Filename here... - Filename here... - Filename here... - Filename here...
-
@spudw2k I change the code. It is generating now all the filenames from a folder but still I need something that generate based on the scenario I've given. $FilePath = "D:\WorkDIR\Office\Server\in\" $File = FileOpen(@ScriptDir & "\FolderList.txt") $xFile = FileOpen(@ScriptDir & "\Log.txt", 1) FileOpen($File, 0) For $i = 1 to _FileCountLines($File) $line = FileReadLine($File, $i) ;~ msgbox(0,'','the line ' & $i & ' is ' & $line) Global $MainFolder = $FilePath & $line Local $aFileList = _FileListToArray($MainFolder, "*", 1) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Exit EndIf ; Display the results returned by _FileListToArray. ;~ _ArrayDisplay($aFileList, $line) FileWrite($xFile, $line & @CRLF) ; I added thhis to generate the parent folder before its files If Not @Error Then _FileWriteFromArray($xFile, $aFileList, 1, Default, @CRLF) ; this is the filenames EndIf Next FileClose($xFile) ShellExecute(@ScriptDir & "\Log.txt") I still need to make my output log as below. BTL105131 - Filename here... - Filename here... - Filename here... - Filename here... SYM100758 - Filename here... - Filename here... - Filename here... - Filename here...
-
@spudw2k, Yup, thanks. I'm still figuring out the arrangement since that code is just my first attempt on my problem. This will be adjusted accordingly, but for now I just need to get the output and that would be great if you could share something or guide me on how to handle this scenario. Thanks a lot.
-
Hi Experts, Hello, how's everybody🙂. Sorry for this but I just need your help on my problem. I have this "FolderList.txt" that has the list of all folders (a hundred or more were listed) that I need to check individually and I need to get inside each folder and get the files filenames and FileWrite() them in my "Log.txt" output. See below. 1. Read my FolderList.txt (where all folder names are their) 2. List all files filename found from each folder (from my FolderList.text) in my Log.txt output. Here's what I have so far (No success😞 #Include <File.au3> #Include <Array.au3> $FilePath = "D:\WorkDIR\Office\Server\in\" ; This is the main path where all these folders were found $File = FileOpen(@ScriptDir & "\FolderList.txt") ; This is where all the folders that I need to check individually $xFile = @ScriptDir & "\Log.txt" ; This is the log output FileOpen($File, 0) For $i = 1 to _FileCountLines($File) $line = FileReadLine($File, $i) ; msgbox(0,'','the line ' & $i & ' is ' & $line) Local $MainFolder = $FilePath & $line Next GetFile() Func GetFile() ; List all the files and folders in the directory using the default parameters. Local $aFileList = _FileListToArray($MainFolder, "*", 1) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Exit EndIf ; Display the results returned by _FileListToArray. _ArrayDisplay($aFileList, $FilePath & $line) If Not @Error Then _FileWriteFromArray($xFile, $aFileList, Default, Default, @CRLF) EndIf FileClose($xFile) ShellExecute(@ScriptDir & "\Log.txt") EndFunc ;==>Example Here's my sample FolderList.txt, I just added few folder name. FolderList.txt This is the expected output on my Log.txt file. BTL105131 - Filename here... - Filename here... - Filename here... - Filename here... SYM100758 - Filename here... - Filename here... - Filename here... - Filename here...
-
Getting the user's Fulll Name not the AD
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@Marc yup got it, thanks for the information now I understand it. 👍 @water As always, I'm always sneaking at your UDFs which gives me more ideas and knowledge. I've learned a lot from your UDFs from the very beginning👍😏 but still there are things that I still need help😅 especially the Excel part which is very complex for me... Hehehe -
Excel to TabControl (is this possible?)
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@seadoggie01, Im not trying to embed my Excel sheet into a GUI but what I want to do is to embed my Excel sheet into a TabItem (see below snippet). Each tab represents each sheet in my Excel. @water thanks for the link☺️ but i've got this below COM Error and nothing shows or happened. -
Getting the user's Fulll Name not the AD
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@Marc, Thank you so much, the code is working fine and generates the fullname. However, how would we know about this smbv1 if it old or not. Anyways, thank you for your time and effort in checking my concern.😊🙏 -
Hi Experts, I tried searching everywhere about my concern that would it be possible to view the excel sheet into the tabControl? I mean we have code for excel to GUI but could not find something for Reading the Excel sheet and view it in TabControl. I mean a specific sheet like "sheet 3" should be viewed in TabContol. I don't know how to start since I'm not really familiar with excel_UDF, so please🙏 let me know if you have any idea or link or any suggestions that can possibly be done. Note: I wasn't able to start anything yet coz I really don't know how to start.😅 Thanks, Experts. KS15
-
Getting the user's Fulll Name not the AD
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@water, this is still in my scite. This was reported to me by our managers that the program is not generating anymore full name during the runtime. -
Getting the user's Fulll Name not the AD
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
-
Getting the user's Fulll Name not the AD
KickStarter15 replied to KickStarter15's topic in AutoIt General Help and Support
@Marc, yup it's working before but not sure if the @LogonDomain has been changed or something in our system I just got this "MsgBox(0, 'username', 'Error connecting to domain')" when attempting to fix the code. -
Hi Experts, I'm trying to get the full name of the user by using below code (by Jos). I've been using this for 2years now but suddenly as of this day, the fullname will no longer generate in my msgBox. I tried fixing and recoding the below but still no success. $oMyError = ObjEvent("AutoIt.Error", "ComError") $UserObj = ObjGet("WinNT://" & @LogonDomain & "/" & @UserName) If @error Then MsgBox(0, 'username', 'Error connecting to domain') Else MsgBox(0, 'username', $UserObj.FullName) EndIf $UserObj = "" $oMyError = ObjEvent("AutoIt.Error", "") ;FullName function Func ComError() If IsObj($oMyError) Then $HexNumber = Hex($oMyError.number, 8) SetError($HexNumber) Else SetError(1) EndIf Return 0 EndFunc Any advise would be appreciated, Experts. I just need to get the full name of our user. Thanks, KS15