exclude content of a txt/csv file when running script

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.

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.

Re: exclude content of a txt/csv file when running script

by disguised sensei on Mon Oct 03, 2016 1:32 pm

well...! I'LL BE DAMNED!!!

That was it! It works! I downgraded to 8.9.7 and it opens only the ones not in my txt file!

I'll test a bit further now - but chivracq YOU DA MAN :)
disguised sensei
 
Posts: 32
Joined: Thu Sep 29, 2016 2:44 am

Re: exclude content of a txt/csv file when running script

by chivracq on Mon Oct 03, 2016 1:37 pm

disguised sensei wrote:well...! I'LL BE DAMNED!!!

That was it! It works! I downgraded to 8.9.7 and it opens only the ones not in my txt file!

I'll test a bit further now - but chivracq YOU DA MAN :)

Grrrr...., pffff....!!!, OK mixed Feelings, glad it works of course, but pfff, another Slap in the Face of Shitty v9.0.3....!

But OK, do you want me to clean v1.1 of my Script to get you again a "proper" Script...?, or re-use v1.0 which should have workked directly, even if I improved a bit a few PROMPTs in v1.1...
- (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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: exclude content of a txt/csv file when running script

by disguised sensei on Mon Oct 03, 2016 1:47 pm

thank you!
You did enough already. I used your first script and it's faster than the second one. I know it's on purpose, but the first one is great as it is!
disguised sensei
 
Posts: 32
Joined: Thu Sep 29, 2016 2:44 am

Re: exclude content of a txt/csv file when running script

by chivracq on Mon Oct 03, 2016 2:29 pm

disguised sensei wrote:thank you!
You did enough already. I used your first script and it's faster than the second one. I know it's on purpose, but the first one is great as it is!

disguised sensei wrote:thank you!
You did enough already. I used your first script and it's faster than the second one. I know it's on purpose, but the first one is great as it is!

Yep, the first one was already optimized for Speed and Performance, well, all my Scripts are already actually, it's automatic with me, oops...
For the the first Script (v1.0), you can lower the "WAIT SECONDS=2" to "=1" or even comment it out...
I have some Code somewhere that 'Cancel' will really stop the Macro...
I can still include a mini-Check on the Start-Tab and the Tab on the left that you didn't forget to load the 'Excluded_URLs', and pfff, I can even add some mini-Logging, logging all URLs processed with the Result and/or how many times Excluded URLs get checked (and which ones)...

And otherwise if you were serious about your 30E PayPal thing and once you get convinced the Script works correctly, my PayPal Account is connected to my '[My_Pseudo_on_the_Forum]@gmail.com' E-mail Address, ah-ah...! :twisted: (Party...!!!)

But, I hope you'll have a deep/deeper/deepest Look and try to understand the whole Content of the Macro, I actually don't really care about money even if I hardly have any, oops!, can't even afford an Internet Connection while I'm supposed to be some kind of Internet Specialist..., ah-ah...!, that's why I always help Users for Free on the Forum, but I'll be happy to help/make you understand anything you didn't understand in my Script... :idea:
Or any other Users digging into it...!
I tried to put Comments in it, but I guess depending on Level, they might still required some extra-Explanation, I've been using iMacros for 10 years now so I guess I lose a bit the Notion of what is easy/normal and a bit Advanced...

Hum..., and one more "stupid" Qt, I hope that putting an Open Tab to the 'Excluded_URLs' List happens with 1 Click and not that you are typing each time the '00234" / "00047" Data..., and if you use the Clipboard, you loose the Clipboard Mechanism I included between sequential Runs, better would be to use a Temp-File like I already mentioned but I need your Paths...
- (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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: exclude content of a txt/csv file when running script

by disguised sensei on Mon Oct 03, 2016 2:57 pm

I guess you know this by now, but I just have to say: NEVER in a million years would I've been able to do this on my own, so thank you very much!

Do you think 30E is justified or what feels right for your work? I would like you to be happy as this makes me happy. Please let me know before I make the transaction.

And one more question: if I use this script on another page, where I have unique numbers without a "msg" how do I need to change the script? e.g.: 242532574

Regarding the paths. I use standard paths under documents. My user name is Sensei. But when I look at iMacros, there at paths these are shown: C:\Users\Sensei\AppData\Roaming\Mozilla\Firefox\Profiles\lyh7ni5z.default
disguised sensei
 
Posts: 32
Joined: Thu Sep 29, 2016 2:44 am

Re: exclude content of a txt/csv file when running script

by chivracq on Mon Oct 03, 2016 3:38 pm

disguised sensei wrote:I guess you know this by now, but I just have to say: NEVER in a million years would I've been able to do this on my own, so thank you very much!

Pfff, not that difficult to understand, I only registered about 3 years ago on the Forum and I'm now more or less able to answer 90% of the Threads on the Forum while I still hardly know anything about JavaScript, oops! ... Meaning you won't need "a million years" to reach my "Level"..., ah-ah...!

disguised sensei wrote:Do you think 30E is justified or what feels right for your work? I would like you to be happy as this makes me happy. Please let me know before I make the transaction.

No-no, don't worry, 30E is already a lot of money for me, more than perfect...! I usually help Users using the Forum a bit correctly for Free and my complete Pleasure, I never ask for money, pfff...!

disguised sensei wrote:And one more question: if I use this script on another page, where I have unique numbers without a "msg" how do I need to change the script? e.g.: 242532574

Oh..., I thought you would probably use the Script on some other Pages, that's why I tried to implement such a "large" Range of "recognized" Formats for the Input, but hum..., "242532574" should still work actually I think, that's why I nearly apologized that "msg0000000000000000040" or "000000000000040" would still be accepted (and correctly handled (as "00040")), I only have a Check on/to replace the 'msg' part if it is present, the rest is treated as a String converted to an Integer and I didn't include any Check on the Length (or only for the Data the Script tries to put on the Clipboard for the Next Run) (was supposed to be 5 for "01234"), so I guess if you input "242532574" in the PROMPT, I would expect it to work..., provide the URL otherwise and I can adapt the Script to accept this "new" Format... (And I can always add some extra-Check from which Page/URL is came from...)

disguised sensei wrote:Regarding the paths. I use standard paths under documents. My user name is Sensei. But when I look at iMacros, there at paths these are shown: C:\Users\Sensei\AppData\Roaming\Mozilla\Firefox\Profiles\lyh7ni5z.default

Euh yep, but I mean your iMacros Folder Paths (Downloads + DataSources) like I've already mentioned, not your FF Profile Location, hum even if I now probably can guess it:
C:\Users\Sensei\Documents\iMacros
=> If you used the Default Install for iMacros, but I think I can manage to create some "C:\TEMP\iMacros\" (well C:\ or D:\) Folder on your PC from a Script... (to use as a combined Download + DataSource same File for a Script). Good you went back to v8.9.7 btw for that point, there seems to be some new Limitation about accessing the Dwl/DtS Folders from v9.0.3 now, re-grrrr...!!!)
- (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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: exclude content of a txt/csv file when running script

by disguised sensei on Mon Oct 03, 2016 3:50 pm

3 years is still a lot of time :) But it's really incredible what you can do with iMacros.

Yes, I think the msg part needs to change or be removed? It would be great if you can adjust the script.

And yes, you guessed right. The path is C:\Users\Sensei\Documents\iMacros

Oh and you should check your mails ;)
disguised sensei
 
Posts: 32
Joined: Thu Sep 29, 2016 2:44 am

Re: exclude content of a txt/csv file when running script

by disguised sensei on Tue Oct 04, 2016 3:56 am

oh and I have another suggestions for the script. Or should I say feature request. I'm sure you can guess what it is :)

but if the 9-digit numbers would work, that would be amazing!
disguised sensei
 
Posts: 32
Joined: Thu Sep 29, 2016 2:44 am

Re: exclude content of a txt/csv file when running script

by chivracq on Tue Oct 04, 2016 4:24 am

disguised sensei wrote:3 years is still a lot of time :) But it's really incredible what you can do with iMacros.

Yes, I think the msg part needs to change or be removed? It would be great if you can adjust the script.

And yes, you guessed right. The path is C:\Users\Sensei\Documents\iMacros

Oh and you should check your mails ;)

Yep, iMacros is amazing, that's why I loved it straightaway when I discovered it about 10 years ago now I reckon. You just need to be a little bit "Creative" and you can do amazing Things with it, ah-ah...! And I'm an Artist and DJ, so I guess that's why we "clicked" that well, oops...! And I didn't know anything about JavaScript, that's why I always stuck to pure '.iim'. Here is an Interesting Thread where I've exposed several "Techniques" I use to be able to achieve all kinds of (Complex) Conditional Logic:
- Workarounds for Conditional Logic in Macro Code

>

OK, the next Version (v1.3) below handles the "msg" part, it was a "major" Rewrite because I had taken for granted that all Redhat Pages would have this "msg" part and I was using it several times for different Checks and Msg's for the PROMPT and Report.
It is now configurable at the Beginning of the Macro in the 'Easy Access' Section:
Code: Select all
SET Default_Prefix "msg"

So you can define:
Code: Select all
SET Default_Prefix "abc"

Or if you want to completely remove it:
Code: Select all
SET Default_Prefix ""


>

OK for the Path, I'll add this Functionality to use some TEMP File rather than the Clipboard (or both) later.

>

Yep, I saw the PayPal thing, lovely...!, Thanks a lot, ah-ah...!!

disguised sensei wrote:oh and I have another suggestions for the script. Or should I say feature request. I'm sure you can guess what it is :)

but if the 9-digit numbers would work, that would be amazing!

Yep, I thought it would already be accepted but I had included a Check on 0<= Msg_Nb <=99999 as I had taken for granted that Msg_Nbs would contain Max 5 Digits. I've now removed the Upper Limit Check.

So this is the latest Version v1.3:
Code: Select all
VERSION BUILD=8820413 RECORDER=FX
SET ERROR_IGNORE NO
SET !ERRORIGNORE {{ERROR_IGNORE}}
'SET !SINGLESTEP YES
SET !EXTRACT_TEST_POPUP NO
SET !TIMEOUT_STEP 1

' Script written by JF CHIVRACQ for iMacros Forum User @Disguised Sensei.
' Feel Free to reuse and to modify.
' Original Thread on the Forum: http://forum.imacros.net/viewtopic.php?f=11&t=26751
'
' Version History:
' v1.0 // 2016-10-03_08h47. (Original (fully working) Version.)
' v1.1 // 2016-10-03_17h03. (With some Debug PROMPTs + '!EXTRACT_TEST_POPUP' re-enabled, to follow Vars to find out why all URLs get excluded.)
' v1.2 // 2016-10-04_01h19. (Debug PROMPTs and PAUSE's removed.)
' v1.3 // 2016-10-04_12h47. (Added 'Default_Prefix' Var (defined a bit below in the 'Easy Access' Section.) + Support for Msg_Nb>999999.)

' Use:
' Run the Macro from the Redhat Main Page with the List of URLs to exclude opened in a Tab directly on the Left of the main Redhat Page.
TAB T=1
'URL GOTO=https://www.redhat.com/archives/libvir-list/2016-April/date.html

'Easy Access to a few Vars:
'***************************
'Default Prefix for PROMPT Input, "msg" for "msg01234", or "" for nothing...!:
SET Default_Prefix "msg"

'Specify Prompt Msg to use in the PROMPT:
SET PROMPT_Msg "From which URL/Msg_Nb to you want to start?"
SET PROMPT_Format "Formats available: msg00000 / abc01234 / 00000 / 0 / 01234 / 1234"
ADD PROMPT_Format <BR>Current<SP>Default_Prefix<SP>is:<SP>[{{Default_Prefix}}]
SET PROMPT_Last_Run "Last Run (Timestamp) // Last URL/Msg_Nb processed:"
SET Data_NA "Data Not Available!"

'Check Clipboard if Macro ran previously to check Last URL/Msg_Nb processed:
'Expected Format is "Timestamp // msg01234 // Row_Nb". Example: "2016-09-22_19h43 // msg00239 // 240"
'>
'For Debug Purpose:
'SET !CLIPBOARD "2016-09-22_19h43 // msg00239 // 240"
'>
SET Prev_Clipboard {{!CLIPBOARD}}
'Need to use '!ERRORIGNORE', otherwise 'x[1]' yields an Error if Clipboard doesn't contain Expected Data from Last Run:
SET !ERRORIGNORE YES
SET Clipboard_OK EVAL("var pc='{{Prev_Clipboard}}'; var x,y,z; x=pc.split(' // '); y=x[1].length; if(y>4){z='OK';}; z;")
SET Last_Run EVAL("var pc='{{Prev_Clipboard}}'; var s='{{Clipboard_OK}}'; var x,y,z; ; x=pc.split(' // '); if(s=='OK'){z=x[0];} else{z='{{Data_NA}}';}; z;")
SET Last_URL EVAL("var pc='{{Prev_Clipboard}}'; var s='{{Clipboard_OK}}'; var x,y,z; ; x=pc.split(' // '); if(s=='OK'){z=x[1];} else{z='{{Data_NA}}';}; z;")
SET Last_Row_Nb EVAL("var pc='{{Prev_Clipboard}}'; var s='{{Clipboard_OK}}'; var x,y,z; ; x=pc.split(' // '); if(s=='OK'){z=x[2];} else{z=0;}; z;")
'>
'Reset '!ERRORIGNORE' to User Setting:
SET !ERRORIGNORE {{ERROR_IGNORE}}
'PROMPT {{Prev_Clipboard}}<BR>{{Clipboard_OK}}

'Compute Default Msg_Nb for the PROMPT (depending on 'Default_Prefix' defined at the Top of the Script, "msg" is otherwise the Default.):
'SET Default_Msg_Nb_0 EVAL("var s='{{Clipboard_OK}}'; var u='{{Last_URL}}'; var x,y,z; if(s=='OK'){z=u;} else{z='msg00000';}; z;")
'SET Default_Msg_Nb EVAL("var s='{{Default_Msg_Nb_0}}'; var p='{{Default_Prefix}}'; var x,y,z; z=s.replace('msg',p); z;")
SET Add_Zeros EVAL("var d='{{Last_Row_Nb}}'; var x,y,z; if(d<10){z='0000';} else if(d<100){z='000';} else if(d<1000){z='00';} else if(d<10000){z='0';} else{z='';}; z;")
SET Default_Msg_Nb EVAL("var p='{{Default_Prefix}}'; var az='{{Add_Zeros}}'; var lr='{{Last_Row_Nb}}'; var x,y,z; z=p.concat(az,lr); z;")
'PROMPT Last_Row_Nb:<SP>_{{Last_Row_Nb}}_<BR>Add_Zeros:<SP>_{{Add_Zeros}}_<BR>Default_Msg_Nb:<SP>_{{Default_Msg_Nb}}_

'Prompt User for 'Starting Msg_Nb':
'***********************************
ADD PROMPT_Msg <BR>{{PROMPT_Format}}<BR><BR>{{PROMPT_Last_Run}}<BR>{{Last_Run}}<SP>//<SP>{{Last_URL}}
PROMPT {{PROMPT_Msg}} !VAR1 {{Default_Msg_Nb}}
'PROMPT Start_Msg_Nb_inputed_by_User:<SP>_{{!VAR1}}_
WAIT SECONDS=1
'>
'SET Start_Row_Nb EVAL("var s='{{!VAR1}}'; var x,y,z; x=s.replace('msg',''); y=parseInt(x); if((y>=0)&&(y<100000)){z=y+1;} else{z=0;}; z;")
'SET Start_Row_Nb EVAL("var s='{{!VAR1}}'; var p='{{Default_Prefix}}'; var x,y,z; x=s.replace(p,''); y=parseInt(x); if((y>=0)&&(y<100000)){z=y+1;} else{z=0;}; z;")
SET Start_Row_Nb EVAL("var s='{{!VAR1}}'; var p='{{Default_Prefix}}'; var x,y,z; x=s.replace(p,''); y=parseInt(x); if(y>=0){z=y+1;} else{z=0;}; z;")
'PROMPT Start_Msg_Nb_inputed_by_User:<SP>_{{!VAR1}}_<BR>Start_Row_Nb:<SP>_{{Start_Row_Nb}}_
'>
'Abort Macro if Input was not recognized:
SET Err_Msg "  //  WRONG INPUT...!"
ADD Err_Msg <BR><BR>Input<SP>not<SP>recognized:<SP>_{{!VAR1}}_<BR>
ADD Err_Msg "Check the PROMPT for correct Format."
ADD Err_Msg <BR><BR>
'>
SET !ERRORIGNORE NO
SET Abort_Macro EVAL("var d='{{Start_Row_Nb}}'; if(d==0){MacroError('{{Err_Msg}}');}")
SET !ERRORIGNORE {{ERROR_IGNORE}}
'PAUSE


'Check for each URL if it is listed in the 'Excluded_URLs' List,
'and if it is not listed, conditionally open the URL in a new Tab:
'(The List must be opened in a Tab directly on the Left of the main Redhat Page.)
'>
'Define a few Counters (used for Report):
SET Counter_URLs_Processed 0
SET Counter_URLs_Excluded 0
SET Counter_TABs_Opened 0

'URL_1:
'>
'First need to re-compute the Msg_Nb from the Row_Nb:
SET Current_Row_Nb {{Start_Row_Nb}}
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
'>
'Check if Msg_Nb is listed:
TAB T=0
'WAIT SECONDS=1
SET !TIMEOUT_STEP 0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
'>
'Compute Row_Nb to conditionally open the URL (in a new Tab), or do nothing!:
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
'PROMPT Msg_Nb:<SP>_{{Msg_Nb}}_<BR><BR>EXTRACT:<SP>_{{!EXTRACT}}<BR><BR>Row_Nb:<SP>_{{Row_Nb}}_
'>
TAB T=1
'Recorded (EVENT Mode): (Hum..., doesn't work for me...!)
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(2)>DIV:nth-of-type(6)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV>A:nth-of-type(2)" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(2)>DIV:nth-of-type(6)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(2)>DIV:nth-of-type(6)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>A:nth-of-type(2)" BUTTON=0 MODIFIERS="ctrl"
'>
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 2
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(2)>DIV:nth-of-type(6)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type({{Row_Nb}})>A:nth-of-type(2)" BUTTON=0 MODIFIERS="ctrl"
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
SET !ERRORIGNORE {{ERROR_IGNORE}}
'>
'Increment Counters:
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}
'>
'Report:
SET Report_Counters Counter_URLs_Processed:<SP>_{{Counter_URLs_Processed}}_<BR>Counter_URLs_Excluded:<SP>_{{Counter_URLs_Excluded}}_<BR>Counter_TABs_Opened:<SP>_{{Counter_TABs_Opened}}_
SET Debug_Counters URL_Excluded<SP>_{{URL_Excluded}}_<BR>TAB_Opened:<SP>_{{TAB_Opened}}_
'PROMPT {{Report_Counters}}<BR><BR>{{Debug_Counters}}
'PAUSE

'Now we can repeat the Block for URL_1 x9...!
'In "compact" Mode...!

SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 2
SET !TIMEOUT_STEP 0

'URL_2:
ADD Current_Row_Nb 1
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
TAB T=0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}

'URL_3:
ADD Current_Row_Nb 1
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
TAB T=0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}

'URL_4:
ADD Current_Row_Nb 1
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
TAB T=0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}

'URL_5:
ADD Current_Row_Nb 1
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
TAB T=0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}
'>
'Report:
SET Report_Counters Counter_URLs_Processed:<SP>_{{Counter_URLs_Processed}}_<BR>Counter_URLs_Excluded:<SP>_{{Counter_URLs_Excluded}}_<BR>Counter_TABs_Opened:<SP>_{{Counter_TABs_Opened}}_
SET Debug_Counters URL_Excluded<SP>_{{URL_Excluded}}_<BR>TAB_Opened:<SP>_{{TAB_Opened}}_
'PROMPT {{Report_Counters}}<BR><BR>{{Debug_Counters}}
'PAUSE

'URL_6:
ADD Current_Row_Nb 1
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
TAB T=0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}

'URL_7:
ADD Current_Row_Nb 1
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
TAB T=0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}

'URL_8:
ADD Current_Row_Nb 1
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
TAB T=0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}

'URL_9:
ADD Current_Row_Nb 1
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
TAB T=0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}

'URL_10:
ADD Current_Row_Nb 1
SET Add_Zeros EVAL("var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; if(x<10){z='0000';} else if(x<100){z='000';} else if(x<1000){z='00';} else if(x<10000){z='0';} else{z='';}; z;")
SET Msg_Nb EVAL("var az='{{Add_Zeros}}'; var d='{{Current_Row_Nb}}'; var x,y,z; x=d-1; z=az.concat(x); z;")
TAB T=0
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=TXT:*{{Msg_Nb}}* EXTRACT=TXT
SET Row_Nb EVAL("var s='{{!EXTRACT}}'; var d='{{Current_Row_Nb}}'; var x,y,z; if(s=='#EANF#'){z=d;} else{z=0;}; z;")
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>UL:nth-of-type(2)>LI:nth-of-type({{Row_Nb}})>A" BUTTON=1
ADD Counter_URLs_Processed 1
SET URL_Excluded EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=0;} else{z=1;}; z;")
ADD Counter_URLs_Excluded {{URL_Excluded}}
SET TAB_Opened EVAL("var d='{{Row_Nb}}'; var x,y,z; if(d>0){z=1;} else{z=0;}; z;")
ADD Counter_TABs_Opened {{TAB_Opened}}
'>
'Report:
SET Report_Counters Counter_URLs_Processed:<SP>_{{Counter_URLs_Processed}}_<BR>Counter_URLs_Excluded:<SP>_{{Counter_URLs_Excluded}}_<BR>Counter_TABs_Opened:<SP>_{{Counter_TABs_Opened}}_
SET Debug_Counters URL_Excluded<SP>_{{URL_Excluded}}_<BR>TAB_Opened:<SP>_{{TAB_Opened}}_
'PROMPT {{Report_Counters}}<BR><BR>{{Debug_Counters}}
'PAUSE

'You can add some more Blocks if you want to process 15 Msgs/URLs for example instead of 10...!


'Copy Data over Last URL/Msg_Nb processed to Clipboard. (Is used for Next Run for Default Input in PROMPT.)
'Expected Format is "Timestamp // msg01234 // Row_Nb". Example: "2016-09-22_19h43 // msg00239 // 240"
SET Last_Msg_Processed {{!NOW:yyyy-mm-dd_hhhnn}}<SP>//<SP>{{Default_Prefix}}{{Msg_Nb}}<SP>//<SP>{{Current_Row_Nb}}
SET !CLIPBOARD {{Last_Msg_Processed}}
'PROMPT {{!CLIPBOARD}}


'Finish Macro by displaying some mini-Report:
SET Report "  //  REPORT:"
ADD Report <SP>({{!NOW:yyyy-mm-dd_hhhnn}})
ADD Report <BR><BR>{{Report_Counters}}<BR>Last_Msg_Processed:<SP>{{Default_Prefix}}{{Msg_Nb}}<BR>(Current<SP>Default_Prefix<SP>is:<SP>[{{Default_Prefix}}])<BR><BR>
'>
SET !ERRORIGNORE NO
SET Display_Report EVAL("MacroError('{{Report}}')")
SET !ERRORIGNORE {{ERROR_IGNORE}}
'PAUSE
(Written and tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10-x64.)
- (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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: exclude content of a txt/csv file when running script

by disguised sensei on Tue Oct 04, 2016 4:56 am

thank you! Will definitely check out your provided link!

And thank you so much for doing another version! I will check it out in a bit. Hopefully, that will work on other pages too :)
disguised sensei
 
Posts: 32
Joined: Thu Sep 29, 2016 2:44 am

Re: exclude content of a txt/csv file when running script

by chivracq on Tue Oct 04, 2016 5:43 am

disguised sensei wrote:thank you! Will definitely check out your provided link!

And thank you so much for doing another version! I will check it out in a bit. Hopefully, that will work on other pages too :)

Yep, If you provided the "other Pages", I could check on my Side that the Script works as well on them...

+ Again how you store the Excluded_URLs and especially if you store all Excluded_URLs for different Pages in the same File or all Pages have their own File, because for example if from the "msg01234" Page you exclude "01234" and from the "242532574" Page you want to check "000001234" (which you don't want to exclude), it will still find it... Hum, no, it's the other way around, ah-ah...!:
If you have "000001234" as Excluded_URL for the "242532574" Page, and you want to check "01234" from the "msg01234" Page (which is not Excluded), it will still find "000001234" as an URL to exclude because I defined the Check as "*01234*"...! (With 2 Wildcards in front and at the end.)

But I guess you will have the same "Problem" even on "msg01234" Pages if you want to run the Script on different Months...

EDIT:
Hum, but oops, Bug-Bug-Bug I foresee, ah-ah...! :oops: (Well, "oops", but that's because I didn't have the "real" Page to test on...)
=> For "242532574" Pages, because I only handled the Leading Zeros for Max 5 Digits, so "40" becomes "00040", "240" becomes "00240", I forgot to handle it for 9 Digits Msg_Nbs, it will still work for "000123456" (because >99999), but Msg "000000123" will become "00123".

Because of those Leading Zeros that I needed to keep but that get automatically removed by iMacros/JavaScript, I had to constantly convert/reconvert Strings to Numbers to Strings in the Script, because iMacros and JavaScript handle "00240" automatically as "240" as soon as I do some Maths Operation like "00240+1=241" (and not like "00240+1=00241"), the Leading Zeros get lost...

EDIT2:
Hum, "it will still work for "000123456"...", nope, not even, because "000123456" will become "123456", meaning it would find both "300123456" and "010123456" and "222123456' or even "012345600" etc...!
Last edited by chivracq on Tue Oct 04, 2016 11:58 am, edited 2 times in total.
- (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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: exclude content of a txt/csv file when running script

by disguised sensei on Tue Oct 04, 2016 10:28 am

ah shoot, so it's not working as it is?

An example is this page: https://support.twilio.com/hc/en-us

there you will find the number: 203263388

And I don't have to keep these in one txt file. I can just do different ones - NO PROBLEM!

and just a thought: maybe it's easier to make a different iim, which I would simply use for the ones without message and just digits.

I feel like it's getting too complicated otherwise. I don't know :)
disguised sensei
 
Posts: 32
Joined: Thu Sep 29, 2016 2:44 am

Re: exclude content of a txt/csv file when running script

by disguised sensei on Wed Oct 05, 2016 4:31 am

did you have time to try that page?

The important part is: numbers are not always starting from 000000000 to 999999999

it can be any number within that range. Is that hard to do??
disguised sensei
 
Posts: 32
Joined: Thu Sep 29, 2016 2:44 am

Re: exclude content of a txt/csv file when running script

by chivracq on Wed Oct 05, 2016 7:20 am

disguised sensei wrote:ah shoot, so it's not working as it is?

An example is this page: https://support.twilio.com/hc/en-us

there you will find the number: 203263388

And I don't have to keep these in one txt file. I can just do different ones - NO PROBLEM!

and just a thought: maybe it's easier to make a different iim, which I would simply use for the ones without message and just digits.

I feel like it's getting too complicated otherwise. I don't know :)

Yep, I think 2 Macros might be better, I chose for the most efficient Implementation for URLs using the 'msg01234' Format originally with several Checks based on that Format, and it is possible to adapt a Macro, but it's better if I know all the Requirements from the beginning than to have to adapt a Macro to force it to work as well on a completely different Site, iMacros relies heavily on the HTML Structure of Pages...

v1.2 and v1.3 will still work on 'msg01234' Pages, even if I had to drop several Checks in v1.3, so v1.2 might be better actually.

disguised sensei wrote:did you have time to try that page?

The important part is: numbers are not always starting from 000000000 to 999999999

it can be any number within that range. Is that hard to do??

Yeah but the Link you provided to this 'support.twilio' Site only links to some general 'Help Center' Page linking to some other "Top FAQs" / "Top Docs" / etc Pages, provide a direct Link to a Page where this "203263388" and "242532574" are valid Entries...
- (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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


PreviousNext

Return to iMacros for Firefox

Who is online

Users browsing this forum: Majestic-12 [Bot] and 4 guests

-->