JavaScript READ from .txt file the iMacros code

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
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
Colibry
Posts: 48
Joined: Sun Sep 25, 2011 6:47 pm
Contact:

JavaScript READ from .txt file the iMacros code

Post by Colibry » Sat Mar 07, 2015 12:06 am

How can I read the imacros code from .txt file and insert it in JS code?

I tried this txt code

Code: Select all

CODE:SET !ERRORIGNORE YES \n URL GOTO=www.google.com
But I get this error message.

Code: Select all

SyntaxError: wrong format of SET command, line 1 (Error code: -910)
But when i put the same code in JS code like this it works.

Code: Select all

iimPlay("CODE:SET !ERRORIGNORE YES \n URL GOTO=www.google.com");
Klemik
Posts: 36
Joined: Sun Dec 07, 2014 7:14 pm
Contact:

Re: JavaScript READ from .txt file the iMacros code

Post by Klemik » Sun May 10, 2015 3:14 pm

\n means new line
You can either:

.iim

Code: Select all

SET !ERRORIGNORE YES 
URL GOTO=www.google.com
.js

Code: Select all

macro="CODE:\n"
macro+="SET !ERRORIGNORE YES\n";
macro+="URL GOTO=www.google.com";
iimPlay(macro);
910 code means Syntax Error, and that would mean that the "\n" is not recognized as any command - simply hit enter instead.
http://imacrosbots.weebly.com/
Post Reply