config.ini :
- Apple
Banana
"NotApple" should also trigger MsgBox as it contains "Apple" in it, but it doesn't do.. how can I modify this to work?Code: Select all
A := "NotApple" IniRead, List, config.ini, LIST IfInString, List, %A% { MsgBox Ok. }
Code: Select all
A := "NotApple"
IniRead, List, config.ini, LIST
IfInString, List, %A%
{
MsgBox Ok.
}
So what would be the code to do so?boiler wrote:No it shouldn't. It doesn't contain "NotApple". You are thinking of it backwards.
Do you understand that I need it to popup the MsgBox like this? I may not be using the right code..boiler wrote:You break your list into an array, then loop through the array and check each item to see if it's in the string in your variable A. You're checking to see if the string in your variable A is in the list, which it is not.
Exactly, so do you know what should I change it to?boiler wrote:Yes, you can have it do whatever you want when it finds it. It's the part that finds it that you need to change, not the MsgBox.
And I don't know how exactly to do that..boiler wrote:I just described it above. You need to break your list into an array. You can use StrSplit() to do that. Then you loop through them and check to see if each element is contained in your variable.
Code: Select all
A := "NotApple"
IniRead, List, config.ini, LIST
ListItems := StrSplit(LIST, "`n", "`r")
For Key, Item in ListItems
If InStr(A, Item)
MsgBox, % "Item " Item " appears in " A
Users browsing this forum: Google [Bot], ReyAHK and 196 guests