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++.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
Shoop
Posts: 18
Joined: Fri Apr 17, 2015 10:58 am

javascript and SET

Post by Shoop » Mon May 11, 2015 1:13 pm

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
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: javascript and SET

Post by chivracq » Thu May 21, 2015 6:59 am

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