Questions on getting login info from txt files...

  • Автор темы Автор темы cch233
  • Дата начала Дата начала

cch233

Client
Регистрация
22.12.2011
Сообщения
4
Реакции
0
Баллы
0
Hi,

I've created some templates that can create account and save login info in this format

url1:username1: password1
url2:username2: password2
url3:username3: password3
....

What I do not is to use "Get block of txt from the file" macro

{-File.GetBlock-|-\Resources\social network\account info\xxx\userpass.txt-|-:-|-0-|-false-}

But this macro will continue getting url1,username1 and password1.

Is there any way to set up macro that can get ulr1 than username1 than password1 WTIHOUT deleting them.

And the second run will be get url2 than username2 than password2 WTIHOUT deleting them?

And so on?
 
You can.... {-File.GetString-|-\Resources\social network\account info\xxx\userpass.txt-|-in this parameter insert count-|-false-} and then split result with splitstring macros...
 
There are 2 ways... I will show the easy one.... basically make a duplicate of your credentials file - (user|||pass|||blahblah).txt

The attached project will...
  • check if the file exists
  • if yes - continues the template ---- if file empty... template is done
  • grab the first line in the file
  • split the username from the file
  • split the pass from the file
  • split the blah from the file
  • insert the username into your html step with the execution result of the username split
  • PAUSE
  • delete the line you used from the file


This way doesn't require a loop count or global function... any easy approach to running through credentials...

Take a look at the project below for more details...

Посмотреть вложение GET-CREDS-LOOP-END.xml
 
If you want to set up a loop to do it without deleting each line, you can check how many lines are in the file (there's a macro for that), and then set up a loop to get each specific line from the file.


1)Check number of lines in file
2)Set counter to 0
3)Get value of counter (this is the beginning of the loop, so even though we just set it to 0, the value will change next time through the loop)
4)Use macro to get line from file, for the line number use the value returned by step 3 (first time will get line 0, next time line 1, etc)
5)Steps to split username, pw, whatever else
6)Use the extracted info for whatever
7)Increase counter
8)Use logic step to check if the result of step 7 is less than the result of step 1 (for a file with 15 lines in it, the lines are numbered 0-14, and we started our counter at 0, so after this cycle runs 15 times step 7 will increase the counter from 14 to 15 and this step will return a false result)
9)If step 8 is true, return to step 3 otherwise the template is done.

I haven't messed with global variables, but I'm guessing you could implement those to run this as a multi-threaded template rather than a single threaded loop.

After typing that all out I realized it is basically what Keytri said. :)
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)