Jump to content

Going Crazy


kudrow
 Share

Go to solution Solved by JohnOne,

Recommended Posts

No it's not. 

It is essentially the same as

Stringregexp($data, '\b\Q' & $Password & '\E\b')

as suggested earlier.

The OP's problem was not making the match restrictive enough.

kylomas

I understand! That is the part I was missing (not restrictive enough). Thank you everyone! Both examples worked!

Link to comment
Share on other sites

the text file contains

_password_
siteip-192.168.10.105
unl

I ended up putting underscores on both sides of the password and then used the following code

$chckpass = StringInStr($datafile, "_" & $password & "_")
        If $chckpass > 0 Then

I used a ">" in the "If" statement because the StringInStr will return a number greater than 0 if there is a match. This seems to be working for me. Should I be aware of any problems this route may cause? Oh I didn't try case sensitive.
 

Link to comment
Share on other sites

  • Moderators

StringRegExp($datafile, "(?m)^Q" & $password & "E$")

 

Edit:

An ini file makes much more sense here after seeing the above file format.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Solution

the text file contains

_password_

siteip-192.168.10.105

unl

I ended up putting underscores on both sides of the password and then used the following code

$chckpass = StringInStr($datafile, "_" & $password & "_")
        If $chckpass > 0 Then

I used a ">" in the "If" statement because the StringInStr will return a number greater than 0 if there is a match. This seems to be working for me. Should I be aware of any problems this route may cause? Oh I didn't try case sensitive.

 

For the record, if the return is 0 it resolves to false. Anything else resolves to True.

So 

If $chckpass Then

Is perfectly acceptable.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

So we guess that the line where the password appears contains ONLY the password ?

Edit : If it is the case, SmOke_N's previous code should work

Edited by jguinch
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

×
×
  • Create New...