converting javascript var to imacro !VAR1

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
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
avocadobaby
Posts: 5
Joined: Tue Jun 01, 2010 5:50 am

converting javascript var to imacro !VAR1

Post by avocadobaby » Thu May 26, 2016 9: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 Fri May 27, 2016 5:06 am, edited 1 time in total.
avocadobaby
Posts: 5
Joined: Tue Jun 01, 2010 5:50 am

Re: converting javascript var to imacro !VAR1

Post by avocadobaby » Fri May 27, 2016 6:09 am

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); 

  
janib4all
Posts: 132
Joined: Wed Jul 21, 2010 6:44 am
Location: Karachi, Sindh, Pakistan
Contact:

Re: converting javascript var to imacro !VAR1

Post by janib4all » Tue Jun 07, 2016 8:53 pm

That is the beauty of iMacro!
Hire the BoT-fReeak!
botspecialist.blogspot.com
chivracq
Posts: 9412
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: converting javascript var to imacro !VAR1

Post by chivracq » Wed Jun 08, 2016 2:52 am

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)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply