Jump to content

Check for SubString


Recommended Posts

This script is suppose to check the key "Test", and see if it contains -b.

Config.ini

[Settings]
Test=-a -b

Script

$Test = IniRead(@ScriptDir & "\Config.ini", "Settings", "Test", "")

$check = StringInStr($Test, "-b")

If Not $check = 0 Then
    MsgBox(64, "", "Error")
EndIf

In this case I should get the message box, but I don't. I can't see what I've done wrong.

Link to comment
Share on other sites

If Not $check = 0 is screwing you up

Use

If $check = 0 Then

or

If NOT $check Then

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Ah, I had a typing mistake in the config file.

@enaiman

I tried every possible statement I could think of, maybe suggest I've typed something wrong, instead of making smart remarks.

Edited by FinalVersion
Link to comment
Share on other sites

Keep up this attitude and you'll end up with a lot of "friends" here.

You jumped straight away to "Doesn't work" without even checking your ini file and your code; that shows a lack of respect for the people trying to help you.

And what I said about you wasting people's time it's true - you could have completely avoided this discussion if you used only one messagebox; to show you the value read from ini.

If you didn't know about message boxes, well, that's a very important use for them, to help debugging the script. Well, at least you have learned something today.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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...