Jump to content

wildcard and if


TomCat
 Share

Recommended Posts

I'm confused. Do you want to test $test1 against the asterisk character ? Or use * as a wildcard meaning "anything" ?

If it's the latter you don't need to make that comparison.

Maybe he means this?
$test1 <> ""

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I have 5 ComboBoxes with some values i want to use to filter strings passed through a loop.

$combo1 = ("bla")

$combo2 = ("blub")

$combo3 = ("lalala")

$combo4 = ("123")

$combo5 = ("test")

But all of this Combos can also have other values or no value.

What i want to do is to add all trings to a list that match all or only some of the values from all combos depending what i want to filter.

Link to comment
Share on other sites

I have 5 ComboBoxes with some values i want to use to filter strings passed through a loop.

$combo1 = ("bla")

$combo2 = ("blub")

$combo3 = ("lalala")

$combo4 = ("123")

$combo5 = ("test")

But all of this Combos can also have other values or no value.

What i want to do is to add all trings to a list that match all or only some of the values from all combos depending what i want to filter.

You don't need the parentheses around the strings, so $combo1 = "bla" will work fine. For comparing to a list of values, StringInStr() is your friend:
Global $avCombos[5] = ["bla", "blub", "lalala", "123", "test"]

Global $sMatches = "|bla|option2|123|"

For $n = 0 to UBound($avCombos) - 1
    If StringInStr($sMatches, "|" & $avCombos[$n] & "|") Then
        MsgBox(64, "Match", "Item [" & $n & "] is a match: " & $avCombos[$n], 3)
    Else
        MsgBox(16, "No Match", "Item [" & $n & "] is NOT a match: " & $avCombos[$n], 3)
    EndIf
Next

:)

Edit: Included delimiter "|" in search.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Many tnx but thats not what i need :-(

I have 5 combos each combo contains up to 50 values.

Than i have many Strings like that:

sadsad|asd|sadas|asd|asdasd|

sadewqdsad|aeeesd|sadawws|addsd|aqaasdasd|

up to 15000

All this strings pass one after one my loop.

Now set first combos to value sadsad the second to asd and the fifth to asdasd the other 2 combos stay at theit default value i dont want to use them at this try.

As result i will get all strings that contains sadsad at first position asd at second and asdasd at fifth and no others

You know understand my problem ?^^

Edited by TomCat
Link to comment
Share on other sites

Many tnx but thats not what i need :-(

I have 5 combos each combo contains up to 50 values.

Than i have many Strings like that:

sadsad|asd|sadas|asd|asdasd|

sadewqdsad|aeeesd|sadawws|addsd|aqaasdasd|

up to 15000

All this strings pass one after one my loop.

Now set first combos to value sadsad the second to asd and the fifth to asdasd the other 2 combos stay at theit default value i dont want to use them at this try.

As result i will get all strings that contains sadsad at first position asd at second and asdasd at fifth and no others

You know understand my problem ?^^

So you only want to test a certain element in the ComboBox item list? Then you have to specify which ComboBox and which element (or the current selection), and specify what to compare it to. I don't see any indication of what logic constitutes a match for your purpose. What are you looking for?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Look i have up to 15000 Lines in a File.

I read this File line after line.

Every line is shared in 5 parts like this:

Part1|Part2|Part3|Part4|Part5|

Now i have 5 Combos with up to 50 items per combo.

Value from combo1 should be compared with Part1 from string, but only if it is not the first item (default value) if it match, the string should get added to a list. The same with all other combos.

Thats easy for me if i want to filter all every time with all 5 values from all 5 combos. But most times i only want to use combo 1 and 4 or combo 2 and 5 to filter so all stings that match with item from combo 1 and 4 respectively 2 and 5.

And I have no Idea how to do this :-/

You now understand what i want to do ?

Link to comment
Share on other sites

Look i have up to 15000 Lines in a File.

I read this File line after line.

Every line is shared in 5 parts like this:

Part1|Part2|Part3|Part4|Part5|

Use _FileReadToArray() and work with the array. The line count of 15,000 is not scary as AutoIt handles arrays with millions of elements.

Now i have 5 Combos with up to 50 items per combo.

Value from combo1 should be compared with Part1 from string, but only if it is not the first item (default value) if it match, the string should get added to a list. The same with all other combos.

Use _GuiCtrlComboBox_GetCurSel() and if the index > 0 then it's not the default selection, I believe.

Thats easy for me if i want to filter all every time with all 5 values from all 5 combos. But most times i only want to use combo 1 and 4 or combo 2 and 5 to filter so all stings that match with item from combo 1 and 4 respectively 2 and 5.

And I have no Idea how to do this :-/

You now understand what i want to do ?

This is clearer to me. Try using StringSplit on the string to get the parts in their own array for comparison. Then you only need to test the non-default values you are interested in.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...