javascript and SET

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++.

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.

javascript and SET

by Shoop on Mon May 11, 2015 6:13 am

win8.1, BUILD=8920312, ff 3702

Code: Select all
var retcode, i, x, n, macro, macro2, macro3, macro4, macro5, macro6;
var cijenanaoglasniku, cijenanaoglasnikm, cijenanakupi;
var urlkupi1m, urlkupi1;
var urlkupi2m, urlkupi2;



for(n=2;n<=80;n=n+2){
      macro2 = "CODE:";
      macro2 +="EVENT TYPE=CLICK SELECTOR=#_frm_mass_process>TABLE>TBODY>TR:nth-of-type("+ n +")>TD:nth-of-type(3)>A BUTTON=1" + "\n";
      macro2 +="EVENT TYPE=CLICK SELECTOR=#_frm_mass_process>TABLE>TBODY>TR:nth-of-type("+ n +")>TD:nth-of-type(7)>A BUTTON=1" + "\n";
      macro2 +="TAG POS=4 TYPE=TD ATTR=* EXTRACT=TXT"  + "\n";
      macro2 +="SET cijenanaoglasnikm EVAL(\"var x=\"{{!EXTRACT}}\"; x=x.match(/[\\.\\d]+/g);" + "\n";         
      macro2 +="SET !EXTRACT NULL" + "\n";
      macro2 +="TAB T=2" + "\n";
      macro2 +="TAG POS=2 TYPE=P ATTR=* EXTRACT=TXT" + "\n";
      macro2 +="SET urlkupi1m EVAL(\"var urlkupi1=\"{{!EXTRACT}}\"; x=x.match(/http.*$/);\")" + "\n";
      macro2 +="SET !EXTRACT NULL" + "\n";
      macro2 +="URL GOTO={{urlkupi1m}}" + "\n";
      macro2 +="SET urlkupi2m EVAL(\"var urlkupi2=\"{{!URLCURRENT}}\";\")" + "\n";
retcode = iimPlay(macro2);}


can set statement be used like this? or thats a nogo?

also i know i can use iimgetlastextract, but would prefer not to use it if possible
Shoop
 
Posts: 18
Joined: Fri Apr 17, 2015 3:58 am

Re: javascript and SET

by chivracq on Wed May 20, 2015 11:59 pm

Shoop wrote:win8.1, BUILD=8920312, ff 3702

Code: Select all
var retcode, i, x, n, macro, macro2, macro3, macro4, macro5, macro6;
var cijenanaoglasniku, cijenanaoglasnikm, cijenanakupi;
var urlkupi1m, urlkupi1;
var urlkupi2m, urlkupi2;

for(n=2;n<=80;n=n+2){
      macro2 = "CODE:";
      macro2 +="EVENT TYPE=CLICK SELECTOR=#_frm_mass_process>TABLE>TBODY>TR:nth-of-type("+ n +")>TD:nth-of-type(3)>A BUTTON=1" + "\n";
      macro2 +="EVENT TYPE=CLICK SELECTOR=#_frm_mass_process>TABLE>TBODY>TR:nth-of-type("+ n +")>TD:nth-of-type(7)>A BUTTON=1" + "\n";
      macro2 +="TAG POS=4 TYPE=TD ATTR=* EXTRACT=TXT"  + "\n";
      macro2 +="SET cijenanaoglasnikm EVAL(\"var x=\"{{!EXTRACT}}\"; x=x.match(/[\\.\\d]+/g);" + "\n";         
      macro2 +="SET !EXTRACT NULL" + "\n";
      macro2 +="TAB T=2" + "\n";
      macro2 +="TAG POS=2 TYPE=P ATTR=* EXTRACT=TXT" + "\n";
      macro2 +="SET urlkupi1m EVAL(\"var urlkupi1=\"{{!EXTRACT}}\"; x=x.match(/http.*$/);\")" + "\n";
      macro2 +="SET !EXTRACT NULL" + "\n";
      macro2 +="URL GOTO={{urlkupi1m}}" + "\n";
      macro2 +="SET urlkupi2m EVAL(\"var urlkupi2=\"{{!URLCURRENT}}\";\")" + "\n";
retcode = iimPlay(macro2);}


can set statement be used like this? or thats a nogo?

also i know i can use iimgetlastextract, but would prefer not to use it if possible

Late Reply, I had not noticed your Thread..., Pb is not 'SET' but 'EVAL()' with Double Quotes (around the Variables) which need to be Triple Escaped, I think... (=> you should rather use Single Quotes which don't need to be escaped), and the Backslashes in your 'match()' Function might give some Pb as well...
- (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)


Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: Google [Bot] and 3 guests

-->