Jump to content


Photo

Need Advice (loop while vs. if then)


  • Please log in to reply
7 replies to this topic

#1 Josh

Josh

    Advanced Member

  • UBot Users
  • PipPipPip
  • 341 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 13 March 2012 - 01:44 PM

So I have been building bots to setup accounts on various websites. Some of the websites have a field for username which also happens to be the subdomain of your account url.

I have a spreadsheet for each of our clients with a list of domain urls which I then create a table from.

Thus far I have been using "if then" statements to go through and determine if a username is available for a specific site. (I don't want to use a random username here because I want the keyword located in the domain if at all possible.)

I have some 30 possible keywords for each client to use as subdomain names and this can be quite time consuming adding all these if then statements.

So my question is would it be better to use a "loop while" command to loop through my keywords, and if so how would this look?

I have attached an example of my current bot which uses if-then statements, but on a completed bot I would have many many more if-then commands.

Attached File  gather.ubot   928bytes   6 downloads

#2 JohnB

JohnB

    Advanced Member

  • UBot Users
  • PipPipPip
  • 3350 posts
  • LocationNJ
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 13 March 2012 - 04:50 PM

You could use loop while with the condition being table cell does not contain the keyword:

loop while($not($contains($table cell(&mytable, #row, 0), #keyword))) {
comment("Do Whatever")
increment(#row)
}



John

#3 Josh

Josh

    Advanced Member

  • UBot Users
  • PipPipPip
  • 341 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 13 March 2012 - 05:00 PM

You could use loop while with the condition being table cell does not contain the keyword:

loop while($not($contains($table cell(&mytable, #row, 0), #keyword))) {
comment("Do Whatever")
increment(#row)
}


Thanks so much. The increment command is what I was looking for.

#4 Josh

Josh

    Advanced Member

  • UBot Users
  • PipPipPip
  • 341 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 13 March 2012 - 05:08 PM

You could use loop while with the condition being table cell does not contain the keyword:

loop while($not($contains($table cell(&mytable, #row, 0), #keyword))) {
comment("Do Whatever")
increment(#row)
}


So what if I want it to start on row 11???? Is there a parameter to start the increments at 11 and go up one from there?

#5 a2mateit

a2mateit

    Advanced Member

  • UBot Users
  • PipPipPip
  • 1451 posts
  • OS:Windows Vista
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 13 March 2012 - 06:16 PM

Hey Josh,

Use a ui text box to set where to start from, then set row to that variable.

Example:
ui text box("Start From ", #start)
set(#row, #start, "Global")

Justin

#6 LoWrIdErTJ - BotGuru

LoWrIdErTJ - BotGuru

    Botguru.net

  • Moderators
  • 3245 posts
  • LocationMichigan
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 13 March 2012 - 08:01 PM

can do it that way or set the variable before beginning your loop process.

Web Automation Bots @ BotGuru.net Want a Custom bot? click here or Email me
rjr.jpg

botgurusecured-banner.png

 


#7 Josh

Josh

    Advanced Member

  • UBot Users
  • PipPipPip
  • 341 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 13 March 2012 - 08:24 PM

Much Thanks!

#8 JohnB

JohnB

    Advanced Member

  • UBot Users
  • PipPipPip
  • 3350 posts
  • LocationNJ
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 13 March 2012 - 08:32 PM

Yeah, I accidentally left out the node set(#row,0) just before the loop...set it to whatever number you like...Just remember lists and tables are 0 based so 9 is actually row 10, etc (since row 1 is 0)


John




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users