converting javascript var to imacro !VAR1

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

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.

converting javascript var to imacro !VAR1

by avocadobaby on Thu May 26, 2016 2:08 pm

I'm trying to define an imacro Variable !VAR1 with an existing javascript var=extract1.

But it doesn't work.

Code: Select all
       
var extract1 = A

           macro="CODE:";
           macro+="SET !TIMEOUT 1\n";
           macro+="SET !ERRORIGNORE YES\n";
           macro+="ADD !VAR1 "+extract1+"\n";     // add js var to the !EXTRACT variable
           retcode = iimPlay(macro);   


Perhaps this is closer to what I want.

macro+="ADD !VAR1 EVAL(var =extract1)\n"; // add js var to the !VAR1 variable
Last edited by avocadobaby on Thu May 26, 2016 10:06 pm, edited 1 time in total.
avocadobaby
 
Posts: 5
Joined: Mon May 31, 2010 10:50 pm

Re: converting javascript var to imacro !VAR1

by avocadobaby on Thu May 26, 2016 11:09 pm

Ah I figured it out.

Code: Select all
var extract1 = A

           macro="CODE:";
           macro+="SET !TIMEOUT 1\n";
           macro+="SET !ERRORIGNORE YES\n";
           retcode = iimSet("NEWVAR", extract1);  // Create NEWVAR using var extract1

           macro+="ADD !VAR1 {{NEWVAR}}"\n";  // done!
           retcode = iimPlay(macro);

 
avocadobaby
 
Posts: 5
Joined: Mon May 31, 2010 10:50 pm

Re: converting javascript var to imacro !VAR1

by janib4all on Tue Jun 07, 2016 1:53 pm

That is the beauty of iMacro!
Hire the BoT-fReeak!
botspecialist.blogspot.com
janib4all
 
Posts: 132
Joined: Tue Jul 20, 2010 11:44 pm
Location: Karachi, Sindh, Pakistan

Re: converting javascript var to imacro !VAR1

by chivracq on Tue Jun 07, 2016 7:52 pm

janib4all wrote:That is the beauty of iMacro!

Hum, fine Comment and I wouldn't have reacted if you didn't post a funny Reply, but mini-Msg to OP, read the Forum Rules (joined the Forum in 2010, I guess you had the time...) and/or my my Sig if you ever want me to respond to any of your Threads... :idea: (Applies to all your Threads then..., well forget about the ones from 2010, unless you still remember which Version you were using, ah-ah...!)

(You would have gotten your Answer/Solution within a few min/hours if you had mentioned your FCI... :idea: Nice that you managed to find it by yourself... And nice that you shared it anyway...)
- (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: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 4 guests

-->