Create csv + read from csv.

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
giovannibagigio
Posts: 3
Joined: Fri Nov 27, 2020 12:17 am

Create csv + read from csv.

Post by giovannibagigio » Fri Nov 27, 2020 1:07 am

Hi. This is my first post here in forum. I need help on 2 different ideas.
I am using imacros v12.6.505.4525 Win10.

first one is:
I am trying to create random (multiple) accounts on simple page then save accounts on csv.
I need to Generate random emails and passwords then save them to csv/txt.
My code looks like this but something is missing..

Code: Select all

URL GOTO=https://www.register.com/register.php?=
TAG POS=1 TYPE=INPUT:EMAİL ATTR=NAME:"register email" CONTENT=((HERE RANDOM GENERATED EMAILS?))
TAG POS=1 TYPE=DIV ATTR=ID:container
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD ATTR=NAME:register-password CONTENT=((SIMPLE PASSWORD.))
TAG POS=1 TYPE=DIV ATTR=ID:container
TAG POS=2 TYPE=BUTTON:SUBMİT ATTR=TXT:"REGISTER"
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\PC\Documents\iMacros\DataSources FILE=usernamepassword.csv

second one:
Login with created accounts before (csv) (loop). and like the user page then log out.

[/code]
TAB T=1
TAB CLOSEALLOTHERS
' Specify input file (if !COL variables are used, iMacros automatically assumes a CSV format of the input file
SET !DATASOURCE "usernamepassword_.csv"
'Use the Play(Loop) button to run the macro in a loop
SET !LOOP 2
'Start at line 2 to skip the header in the file
'Increase the current position in the file with each loop
SET !DATASOURCE_LINE {{!LOOP}}
' Fill web form
URL GOTO=https://www.register.com/login.php?
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:"login email" CONTENT={{!COL1}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD ATTR=NAME:login-password CONTENT={{!COL2}}
TAG POS=1 TYPE=DIV ATTR=ID:container
TAG POS=2 TYPE=BUTTON:SUBMİT ATTR=TXT:"Log in"
'

URL GOTO=https://www.register.com/useraccount1234
TAG POS=1 TYPE=DIV ATTR=ID:user-detail-app
TAG POS=1 TYPE=DIV ATTR=CLASS:fv-hv-img

TAG POS=1 TYPE=A ATTR=TXT:"Log out"
[/code]


Can somebody help me to fix my codes? Thanks!
Last edited by giovannibagigio on Fri Nov 27, 2020 1:16 pm, edited 1 time in total.
chivracq
Posts: 9588
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Create csv + read from csv.

Post by chivracq » Fri Nov 27, 2020 2:42 am

giovannibagigio wrote:
Fri Nov 27, 2020 1:07 am
Hi. This is my first post here in forum. I need help on 2 different ideas.

first one is:
I am trying to create random (multiple) accounts on simple page then save accounts on csv.
I need to Generate random emails and passwords then save them to csv/txt.

My code looks like this but something is missing..

Code: Select all

URL GOTO=https://www.register.com/register.php?=
TAG POS=1 TYPE=INPUT:EMAİL ATTR=NAME:"register email" CONTENT=((HERE RANDOM GENERATED EMAILS?))
TAG POS=1 TYPE=DIV ATTR=ID:container
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD ATTR=NAME:register-password CONTENT=((SIMPLE PASSWORD.))
TAG POS=1 TYPE=DIV ATTR=ID:container
TAG POS=2 TYPE=BUTTON:SUBMİT ATTR=TXT:"REGISTER"
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\PC\Documents\iMacros\DataSources FILE=usernamepassword.csv
second one:
Login with created accounts before (csv) (loop). and like the user page then log out.

Code: Select all

TAB T=1
TAB CLOSEALLOTHERS 
' Specify input file (if !COL variables are used, iMacros automatically assumes a CSV format of the input file
SET !DATASOURCE "usernamepassword_.csv"
'Use the Play(Loop) button to run the macro in a loop
SET !LOOP 2
'Start at line 2 to skip the header in the file
'Increase the current position in the file with each loop 
SET !DATASOURCE_LINE {{!LOOP}}
' Fill web form   
URL GOTO=https://www.register.com/login.php?
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:"login email" CONTENT={{!COL1}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD ATTR=NAME:login-password CONTENT={{!COL2}}
TAG POS=1 TYPE=DIV ATTR=ID:container
TAG POS=2 TYPE=BUTTON:SUBMİT ATTR=TXT:"Log in"
'
URL GOTO=https://www.register.com/useraccount1234
TAG POS=1 TYPE=DIV ATTR=ID:user-detail-app
TAG POS=1 TYPE=DIV ATTR=CLASS:fv-hv-img

TAG POS=1 TYPE=A ATTR=TXT:"Log out"
Can somebody help me to fix my codes? Thanks!

CIM...! :mrgreen: (Read my Sig... and the Forum Rules...!) => ... for me to read your Post and do any "Thinking"... :idea:

=> Edit your OP and mention your FCI at the very top of your OP... (preferably)... (=> Is the first and only Info I (need to) check to decide if I'll read a Post... and certainly answer it, ah-ah...! This is a Tech Forum...!) :wink:

I've only read your Thread Title until now, => "Create csv + read from csv.", (well, apart from checking your Post for Spam before approving it...) => I "think" I already understand what you want for Functionality, but I'll read your OP and post some Reply/Answer only once you'll have mentioned your FCI... :|

>>>

+ You may want to check my Quote and correct the Formatting (']code[' Tags) to improve the Readability of your OP (and the whole Thread)... :idea:
(Not Blocking for Helping you, "CIM" is...)

>>>

EDIT:
Hum..., I "couldn't resist", oops, and I read your OP after all, re-oops...! :oops:

But, re-hum-hum..., to manage your "Expectations", I don't help for the Functionality that you want, => Create fake/random Logins for some Website, this Functionality is usually only used by Spammers and I definitely never help Spammers, ah-ah...! :shock:

(The same Func could be "Legit" for Testing/Testers, but "Professional" Testers will be "clever" enough to find a Solution by themselves... I "happen" to be a "Professional Tester" myself, oops...! => Can I conclude you are a Spammer...!? :wink: )

But OK, even if I (probably) won't help you for this Thread, you still may want to comply with "CIM", or I probably won't (try to) help you either "a next time"... :idea:
Good Luck with other (Advanced) Users for this one anyway.... :wink:
Last edited by chivracq on Fri Nov 27, 2020 3:33 am, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
giovannibagigio
Posts: 3
Joined: Fri Nov 27, 2020 12:17 am

Re: Create csv + read from csv.

Post by giovannibagigio » Fri Nov 27, 2020 3:21 am

Sorry. This was my first post. I am using free version of imacro for chrome.
chivracq
Posts: 9588
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Create csv + read from csv.

Post by chivracq » Fri Nov 27, 2020 3:42 am

giovannibagigio wrote:
Fri Nov 27, 2020 3:21 am
Sorry. This was my first post. I am using free version of imacro for chrome.

Boah, no need to be sorry, the Quality of your OP was quite OK for a "This was my first post."... :D
(Or I wouldn't have approved it, ah-ah...! :P (I'm the Mod on this Forum...))

But "I am using free version of imacro for chrome." is not "good enough"..., => can you read my Sig and the Forum Rules maybe...? :roll:

... Hum, or complete/confirm the following Line:
FCI:

Code: Select all

iMacros for CR v10.1.0...? 'Free', CR86...?, OS=...?
=> Every Qt Mark simply needs an Answer/Confirmation... :idea:
(But again, you would "speed up the Process" if you bothered to spend 1-2 min to read my Sig and/or the Forum Rules...! :roll: )

... And once you've completed your FCI, you'll need to edit your OP (= Original/Opening Post) in this Thread to add that Info (preferably at the very top of your OP) if you want any (Advanced) User(s) to be able to help you..., I/they won't go searching through half a page of Posts to find out what your FCI is... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
giovannibagigio
Posts: 3
Joined: Fri Nov 27, 2020 12:17 am

Re: Create csv + read from csv.

Post by giovannibagigio » Fri Nov 27, 2020 1:15 pm

chivracq wrote:
Fri Nov 27, 2020 3:42 am
giovannibagigio wrote:
Fri Nov 27, 2020 3:21 am
Sorry. This was my first post. I am using free version of imacro for chrome.

Boah, no need to be sorry, the Quality of your OP was quite OK for a "This was my first post."... :D
(Or I wouldn't have approved it, ah-ah...! :P (I'm the Mod on this Forum...))

But "I am using free version of imacro for chrome." is not "good enough"..., => can you read my Sig and the Forum Rules maybe...? :roll:

... Hum, or complete/confirm the following Line:
FCI:

Code: Select all

iMacros for CR v10.1.0...? 'Free', CR86...?, OS=...?
=> Every Qt Mark simply needs an Answer/Confirmation... :idea:
(But again, you would "speed up the Process" if you bothered to spend 1-2 min to read my Sig and/or the Forum Rules...! :roll: )

... And once you've completed your FCI, you'll need to edit your OP (= Original/Opening Post) in this Thread to add that Info (preferably at the very top of your OP) if you want any (Advanced) User(s) to be able to help you..., I/they won't go searching through half a page of Posts to find out what your FCI is... :idea:


imacros v12.6.505.4525 Win10.
chivracq
Posts: 9588
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Create csv + read from csv.

Post by chivracq » Fri Nov 27, 2020 3:05 pm

giovannibagigio wrote:
Fri Nov 27, 2020 1:15 pm

Code: Select all

imacros v12.6.505.4525  Win10.

Hum..., OK, but iMB v12.6 (and 'Trial' is missing) is a different Version and different Browser than "I am using free version of imacro for chrome."... :?

But OK, I see you are using the '!DATASOURCE' Command/Functionality and this Func is indeed not supported in the 'Free' Version for FF and CR, you would need the 'PE' Version with the FIO-Module for Local File Access for this Func to work..., or the iMB v12.6 'Trial' Version indeed...

Then OK, you mention "Can somebody help me to fix my codes? Thanks!" but you don't mention/explain what the Pb is... :? , but I notice an "obvious" Mistake...: You are using a different Name for the 'SAVEAS' and the '!DATASOURCE' Command... :idea:

Hum, and I noticed stg else..., but unless you (re)use the same already existing '.CSV' File which already contains a Header as the 1st Row in the File, your 2 Scripts will be "desynchronized" because of the "SET !LOOP 2" which expects a Header in the File as while your first Script saves Data in Row_1, your second Script will already try to fetch that Data in Row_2, etc...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply