Jump to content

Recommended Posts

Posted

Okay, so now I got a new problem because i changed the way i wanna do the program to make it simpler.

so I parsed 3 strings together

username, the seperator and password:

example:

username-password

now my $text = _IEBodyReadText($oIE)

and I want to string split or getline each line seperately because the text it reads is like the following:

Example:

omg-wtf

username-password

help-me

iam-noob

uh-oh

and basically what I want to do is get each line and assign it to an array and have the parsed string be compared to the line taken from the bodytext.

I know in C++ I could easily do this:

int i = 0;
string parse = omg-wtf;
vector<string> line;
bool statement = false;

While(line[i] = text.getline)
{
i++;
}

for(j = 0; j < i; j++)
{
  if(line[j] == parse;
   {
     statement = true;
     j = i;
   }
  else
   {
     statement = false;
   }
}

if(statement)
{
~~~~Run~~~
}
else
{
exit(0);
}

so is there a way i can basically convert that code into autoit? so far I have this much converted:

$i = 0
$parse = omg-wtf
$line
$statement
$oIE = _IECreate("http://blahblah.com/list.txt", 0, 0)
$text = _IEBodyReadText($oIE)

While($line[i] = text.getline)    ;;;;;;;;;;; this is where I am having my trouble how would I do my getline for my $text
{
$i + 1
}

for $j = 0 To $i

  if $line[j] = $parse Then
     statement = true;
     $j = $i
  else
     $statement = false;

Next

if $statement = true
~~~~Run~~~
else
$return 0
Posted

[HINT] search the help file for stringinstr and file handling.[/HINT]

Perilous to all of us are the devices of an art deeper than we ourselves possess.

Posted

[HINT] search the help file for stringinstr and file handling.[/HINT]

yeah I forgot to mention I was using stringsplit already heh but I am not sure how to do loops in autoit like keep a counter as well on the side to see how many lines have been stored.
Posted

yeah I forgot to mention I was using stringsplit already heh but I am not sure how to do loops in autoit like keep a counter as well on the side to see how many lines have been stored.

Sorry but i didnt see a single use of stringinstr in the code sample in your post.

If you post the code in which you are using stringinstr then it will help your quest.

As for counters and the such, well im suprised you ask since you appear to have a grasp of C++, but, anyhow, the only way to learn is to play and experiment, make sure you save your snippets as you go, and you'll be able to refer back to it when needed.

Perilous to all of us are the devices of an art deeper than we ourselves possess.

Posted (edited)

Sorry but i didnt see a single use of stringinstr in the code sample in your post.

If you post the code in which you are using stringinstr then it will help your quest.

As for counters and the such, well im suprised you ask since you appear to have a grasp of C++, but, anyhow, the only way to learn is to play and experiment, make sure you save your snippets as you go, and you'll be able to refer back to it when needed.

#include <GUIConstants.au3>
#include <String.au3>
#include <IE.au3>

$i = 0
$parse = "Username0=0|0"
$line = ""
$statement = false
$oIE = _IECreate("http://www.geocities.com/lito_raver/index.htm", 0, 0)
$text = _IEBodyReadText($oIE)

While $line =  StringSplit($text, " ")  
$i + 1
MsgBox(0,"",$i)
For $j = 0 To $i Step +1

  If $line = $parse Then 
      $statement = true 
      $j = $i
  
  Else
     $statement = false


EndIf

If $statement = true Then
MsgBox(0,"","OMG")

Else
$return 0
EndIf

Next

WEnd

;MsgBox(0,"","DONE!")

i made some test calls like those msg boxes to see if the incrementation works

Edited by Joshy

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...