Sign in to follow this  
Followers 0
FinalVersion

Check for SubString

9 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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!"

Share this post


Link to post
Share on other sites

I want the message box to run if the string is found.

If $check > 0 Then

Share this post


Link to post
Share on other sites

What would be the difference between

Not $check = 0

and

$check <> 0

??

You're still wasting other people's time. Think! Try different forms. You're jumping on forum with the most trivial matters.


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 :)

Share this post


Link to post
Share on other sites

Doesn't work.

Works for me

Share this post


Link to post
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 :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0