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:

[email protected],johndoe,doepassword
[email protected],jackj87,mypass123
[email protected],anonmouse,cheesepw
[email protected],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=
;[email protected],johndoe,doepassword
;[email protected],jackj87,mypass123
;[email protected],anonmouse,cheesepw
;[email protected],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=
;[email protected],johndoe,doepassword
;[email protected],jackj87,mypass123
;[email protected],anonmouse,cheesepw
;[email protected],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)