Can I continue the script while the page loads?

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.

Can I continue the script while the page loads?

by smashedpumpkins on Mon Jun 05, 2017 2:13 pm

Current setup:
iMacros Build 9030808
Windows 10 English
Firefox 53.03 (32-bit)

I've written a basic iMacros script in Javascript but I'm struggling to speed the process up. iMacros is waiting for the page to finish loading before going to the next command but I would prefer it immediately move on. (I can manually add a wait if needed) The script reads a CSV file 1 line at a time, loads a page based on the 1st line, prompts for a yes or no, writes data to a CSV, then continues to line 2 and repeats. Is it possible to avoid waiting for the page to finish loading?

Thank you.

//Loop through all CSV lines
for(i = 0; i < upcsCsvArray.length; i++) {
macro = "CODE:";
macro += "\nURL GOTO=https://www.sample.com/" + upcsCsvArray[i][1];
iimPlay(macro);

var answer = confirm("(T/F) - " + upcsCsvArray[i][3]);
if (answer) {
macro2 = "CODE:";
macro2 += "\nPROMPT \"Quantity?\" !VAR1";
macro2 += "\nSET !VAR2 \"CALL insert_product(\'" + upcsCsvArray[i][2] + "x{{!VAR1}}\',\'" + upcsCsvArray[i][1] + "\',\'" + upcsCsvArray[i][2] + "\',\'\',\'\','{{!VAR1}}',0,0);\"";
macro2 += "\nADD !EXTRACT {{!VAR2}}";
macro2 += "\nSAVEAS TYPE=EXTRACT FOLDER=* FILE=Output.CSV";
iimPlay(macro2);
} else {
//NA for now
}
}
smashedpumpkins
 
Posts: 14
Joined: Tue Aug 24, 2010 12:56 pm

Re: Can I continue the script while the page loads?

by serbeer on Mon Jun 05, 2017 3:10 pm

Yes, you can, just use
Code: Select all
SET !TIMEOUT_PAGE 1
SET !ERRORIGNORE YES

before your URL GOTO=
and don't forget to restore
Code: Select all
SET !ERRORIGNORE NO

afterwards
serbeer
 
Posts: 35
Joined: Thu Sep 10, 2015 10:36 pm

Re: Can I continue the script while the page loads?

by smashedpumpkins on Mon Jun 05, 2017 10:00 pm

serbeer wrote:Yes, you can, just use
Code: Select all
SET !TIMEOUT_PAGE 1
SET !ERRORIGNORE YES

before your URL GOTO=
and don't forget to restore
Code: Select all
SET !ERRORIGNORE NO

afterwards

Excellent, thank you.
smashedpumpkins
 
Posts: 14
Joined: Tue Aug 24, 2010 12:56 pm


Return to iMacros for Firefox

Who is online

Users browsing this forum: Google [Bot], radamanth and 11 guests

-->