Imacros let me mark when there is an error

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Imacros let me mark when there is an error

by jvera on Wed Jul 26, 2017 5:47 pm

Hi, i have a question:

iMacros Version: 9030808
Browser: Firefox 54.0.1 (64-bit)
OS: Mac OS X sierra

Im using iMacros for check the users of my website, i have a CSV file with all the IDs of my users on Wordpress, and the iMacros is checking one by one if there are in my wordpress site, now, if the user exist, the iMacros make another action, but if dont find it, the iMacros stopped (getting a error).

What i want, if iMacros find a error (user not found) mark the CSV file with X or something, and jump to the next one, so the macros dont stop and i can check what happen with that user.

Any idea how can i do that? or know how to mark the CSV file?

Thanks.
Last edited by jvera on Thu Jul 27, 2017 9:40 am, edited 1 time in total.
jvera
 
Posts: 3
Joined: Wed Sep 30, 2015 2:58 pm

Re: Imacros let me mark when there is an error

by chivracq on Wed Jul 26, 2017 6:07 pm

jvera wrote:Hi, i have a question:

Code: Select all
iMacros Version: 9030808
Browser: Firefox
OS: Mac OS X sierra


Im using iMacros for check the users of my website, i have a CSV file with all the IDs of my users on Wordpress, and the iMacros is checking one by one if there are in my wordpress site, now, if the user exist, the iMacros make another action, but if dont find it, the iMacros stopped (getting a error).

What i want, if iMacros find a error (user not found) mark the CSV file with X or something, and jump to the next one, so the macros dont stop and i can check what happen with that user.

Any idea how can i do that? or know how to mark the CSV file?

Thanks.

FCIM...! :mrgreen: (FF Version missing...)
=> iMacros for FF v9.0.3, FF54...?, MacOS-X-Sierra.

Euuuuuuhhh..., thinking-thinking...!, yep, easiest is to read and rewrite your '.CSV' completely Row by Row with 'SAVEAS', with '!ERRORIGNORE' of course to prevent your Script from stopping in the middle, and add maybe some '{{!NOW:yyyy-mm-dd}}' Timestamp (+ "hh" maybe) to your "new" '.CSV' Filename that you later can rename manually after the whole Script has run/looped successfully.

And using a "Conditional 'SAVEAS'", you could even do a Double Save, or only save the "faulty" Users in some apart '.CSV'...

Some other Method is to use some editable GoogleSheet, then you can read and edit it directly from your Script and put your "X" or whatever in some extra Col.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Imacros let me mark when there is an error

by jvera on Thu Jul 27, 2017 10:13 am

Thanks for the help, i already add the FF version.

Maybe I did not make myself clear, what i need is iMacros mark in the excel cell with X, so i know where i have a error.

This is the code what i have:

Code: Select all
URL GOTO=https://website.com/users.php
SET !DATASOURCE /Users/website/iMacros/Datasources/users.csv
TAG POS=1 TYPE=INPUT:SEARCH FORM=ID:posts-filter ATTR=ID:post-search-input CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:posts-filter ATTR=ID:search-submit
SET !ERRORIGNORE YES
TAG POS=1 TYPE=A ATTR=TXT:Trash
SET !VAR1 {{!EXTRACT}}
set !extract null
SAVEAS TYPE=EXTRACT FOLDER=/Users/website/iMacros/Datasources/ FILE=users2.csv


iMacros create a new file called: "users2.csv" but, is blank.

I want something like this:

Image

If can be in the same CSV (not create a new one) will be awesome.

Thanks.
jvera
 
Posts: 3
Joined: Wed Sep 30, 2015 2:58 pm

Re: Imacros let me mark when there is an error

by chivracq on Thu Jul 27, 2017 1:35 pm

jvera wrote:Thanks for the help, i already add the FF version.

Maybe I did not make myself clear, what i need is iMacros mark in the excel cell with X, so i know where i have a error.

This is the code what i have:

Code: Select all
URL GOTO=https://website.com/users.php
SET !DATASOURCE /Users/website/iMacros/Datasources/users.csv
TAG POS=1 TYPE=INPUT:SEARCH FORM=ID:posts-filter ATTR=ID:post-search-input CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:posts-filter ATTR=ID:search-submit
SET !ERRORIGNORE YES
TAG POS=1 TYPE=A ATTR=TXT:Trash
SET !VAR1 {{!EXTRACT}}
set !extract null
SAVEAS TYPE=EXTRACT FOLDER=/Users/website/iMacros/Datasources/ FILE=users2.csv


iMacros create a new file called: "users2.csv" but, is blank.

I want something like this:

Image

If can be in the same CSV (not create a new one) will be awesome.

Thanks.

Yep, OK for FCI...:
Code: Select all
iMacros Version: 9030808
Browser: Firefox 54.0.1 (64-bit)
OS: Mac OS X sierra

(v8.9.7 for FF is more stable than v9.0.3 btw, and still works on FF54...)

But yep, normal, 'SAVEAS TYPE=EXTRACT' saves the Content of the '!EXTRACT' Var, so you need to handle the Content of '!EXTRACT' yourself, and certainly not with a 'SET !EXTRACT NULL' just before the 'SAVEAS', ah-ah...!! :shock:

Simply recreating your '.CSV' as it was originally is done with:
Code: Select all
SET !EXTRACT {{!COL1}}
SAVEAS TYPE=EXTRACT FOLDER=/Users/website/iMacros/Datasources/ FILE=users2.csv
+ looping your Script for all Rows.

Now, to add the "error" Flag in the 3rd Col, you will need to extract some Field on the Page that appears (or doesn't appear) when a User doesn't exist or anything goes "wrong" with that User that you want the Flag to be added to that Row.

Say you get some "User not found..." Text displayed on the Page in that case, then your Script will look like stg like this:
Code: Select all
SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=TXT:*User*not*found...* EXTRACT=TXT
SET Flag EVAL("var s='{{!EXTRACT}}'; var z; if(s!='#EANF#'){z='error';} else{z='';}; z;")
SET !EXTRACT {{!COL1}}
ADD !EXTRACT ""
ADD !EXTRACT {{Flag}}
SAVEAS TYPE=EXTRACT FOLDER=/Users/website/iMacros/Datasources/ FILE=users2.csv
That's it...! 8)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Imacros let me mark when there is an error

by jvera on Thu Jul 27, 2017 3:43 pm

i dont know why is marking error to all the user.

what im doint wrong? :|

Image
jvera
 
Posts: 3
Joined: Wed Sep 30, 2015 2:58 pm

Re: Imacros let me mark when there is an error

by chivracq on Thu Jul 27, 2017 8:58 pm

jvera wrote:i dont know why is marking error to all the user.

what im doint wrong? :|

Image

Yeah, but what is your real Script...? Mine was just an Example as I don't know what the exact HTML Structure of your Page/Site is...?

Use 'PROMPT' to follow all Vars and debug your Script...

v9.0.3 is btw buggy for the 'EXTRACT' Mechanism, you can better revert to v8.9.7 (still works with FF54). (And make sure to disable Automatic Updates for iMacros, ah-ah...!)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to General Support & Discussions

Who is online

Users browsing this forum: No registered users and 6 guests

-->