Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read sequences from .txt file, then move to new line
#1
Hey,

thanks for the great piece of software! I'm trying to create a macro that automates registration. The macro should read credentials from .txt file that are like:

johndoe@gmail.com,johndoe,doepassword
jackjohnson@hotmail.com,jackj87,mypass123
anony.mouse@gmail.com,anonmouse,cheesepw
wowguy61@hotmail.com,wowguy61,wowrulesspassword

Now the problem is: how to make macro to read email, username and password separately? They are separated by comma. Also, is there a way to make the macro go to next line after previous line is succesfully used (=pasted to register form and pressed submit)?

Thanks for your help!

Greetings CC
#2
Macro Macro1811
Code:
Copy      Help
str s=
;johndoe@gmail.com,johndoe,doepassword
;jackjohnson@hotmail.com,jackj87,mypass123
;anony.mouse@gmail.com,anonmouse,cheesepw
;wowguy61@hotmail.com,wowguy61,wowrulesspassword

ARRAY(str) a=s
int i
for i 0 a.len
,str email user password
,if(tok(a[i] &email 3 ",")<3) end "bad format"
,email.trim; user.trim; password.trim
,out F"email=''{email}'',  user=''{user}'',  password=''{password}'"
,;here
,;add
,;code
,;that
,;uses
,;the
,;data

The list looks like in CSV format. If so, better use ICsv interface.
Macro Macro1812
Code:
Copy      Help
str s=
;johndoe@gmail.com,johndoe,doepassword
;jackjohnson@hotmail.com,jackj87,mypass123
;anony.mouse@gmail.com,anonmouse,cheesepw
;wowguy61@hotmail.com,wowguy61,wowrulesspassword

ICsv x=CreateCsv(1)
x.FromString(s) ;;or use FromFile("file path") to load directly from file
int i
for i 0 x.RowCount
,str email(x.Cell(i 0)) user(x.Cell(i 1)) password(x.Cell(i 2))
,out F"email=''{email}'',  user=''{user}'',  password=''{password}''"
,;here
,;add
,;code
,;that
,;uses
,;the
,;data


Forum Jump:


Users browsing this thread: 1 Guest(s)