Jump to content

Trying to combine 2 lines


Recommended Posts

On a script i have this scenario which im trying to solve

If IsArray($CleanUpData) Then
Select
Case IsArray($CleanUpData)
$aRarFile = _RecFileListToArray(@ScriptDir, "*.rar|*.part*", 1, 0) ;<<<<<<<<<<< this one
_ArrayDisplay($aRarFile, ".Rar Files")
Case IsArray($CleanUpData)
$aRarFile = _RecFileListToArray(@ScriptDir, "*.part1.rar;*.part01.rar;*.part001.rar;*.7z;*.001", 1, 0) ;<<<<<<<<<<< and this one
_ArrayDisplay($aRarFile, ".Rar Files")
Case Else
$aZipFile = _RecFileListToArray(@ScriptDir, "*.zip", 1, 0) ; Search for .zip files
_ArrayDisplay($aZipFile, ".Zip Files")
EndSelect

 

The problem is i have no case arguments that i can use other then IsArray($CleanUpData)

and the case else must be the zip

How can i combine the 2 marked lines without causing the conflict of single rar ignoring the part and also to find the part.rar when needed?

Or a way to make it do both searches and only keep the right one?

Basically it only looks for the first file only

If this makes no sense i will try and explain again ;)

Edited by Chimaera
Link to comment
Share on other sites

If you can't combine everything into a single call to _RecFileListToArray then fill two arrays and combine them using function _ArrayConcatenate.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

arent these items  "*.part1.rar;*.part01.rar;*.part001.rar" included in the first _recfilelist as "*.rar", leaving only .7z and .### files?

And the first one is seperated with a pipe and the second with semicolons, should they both be semicolons or are there fun undocumented features of _RecFileListToArray?

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

*.rar|*.part* = search for *.rar | but exclude from the search any files with this present *.part*

Its documented a s far as i know in the header

and there is a third type of exclusion but i never use it

edit maybe i should add older rar forms were .rar / .r01/ .r02 etc, modern ones have the part bit in them *.part1.rar *.part2.rar, i have to catch both

Edited by Chimaera
Link to comment
Share on other sites

hmmm, maybe im on an old version, but i see exclude list at the end, and still semicolon seperated.

Func _RecFileListToArray($sInitialPath, $sInclude_List = "*", $iReturn = 0, $iRecur = 0, $iSort = 0, $iReturnPath = 1, $sExclude_List = "", $sExclude_List_Folder = "")

$sExclude_List - Optional: filter for excluded results (default ""). Multiple filters must be separated by ";"

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Melba changed the syntax a while ago to simplify i beleive

Syntax.........: _RecFileListToArray($sPath[, $sMask = "*"[, $iReturn = 0[, $iRecur = 0[, $iSort = 0[, $iReturnPath = 1[, $sExclude_List = ""[, $sExclude_List_Folder]]]]]]])

Edited by Chimaera
Link to comment
Share on other sites

To Combine two line you may use these ;

$Line1 = "Autoit"
$Line2 = ".rar"
$Combine = $Line1 & $Line2
MsgBox(0,"",$Combine)

To select true array you may create a loop While/Wend and add If command . Like If $Array = "Your True Text" Then ExitLoop .

Loken

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...