ActiveXObjects for Chrome

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
sterlingtuttle
Posts: 1
Joined: Sun Nov 23, 2014 5:36 pm

ActiveXObjects for Chrome

Post by sterlingtuttle » Sun Nov 23, 2014 5:48 pm

Chrome does not support ActiveXObjects what is the proper Javascript work-around? Or, am I missing something else?

[img]
http://i.imgur.com/yeurdxL.png
[/img]

Code: Select all

<script type="text/javascript">
//YP_RUN SCRIPT * THIS SCRIPT WILL SCRAPE YP FOR BIZ NAME, ADDY, PHONE, & EMAIL

function runimacros() {
      var iMacros = new ActiveXObject("imacros");
      var queryLoop = 1;
      var loopNumber = 1;
      var command;
      var run = true;
      var extract = true;
      
      //START COMPLETE QUERY SCRAPE
      while ( run ) {
      
      	//INSERT QUERY
      	command = iMacros.iimOpen( "-cr" , true );  //OPEN iMacros BROWSER
      	command = iMacros.iimSet( "QUERYNUMBER" , queryLoop );  //QUERY NUMBER VARIABLE
      	command = iMacros.iimPlay("yellowpages\\InsertYPQuery");  //RUN INSERT QUERY MACRO
      	return_msg = iMacros.iimGetErrorText();  //GET RETURN MESSAGE
      	queryLoop = queryLoop + 1;
      	
      	//IF QUERY WAS INSERTED
      	if (return_msg > 0) {
      		
      		//EXTRACT LISTINGS LOOP
      		while ( extract ) {
      		
	      		//EXTRACT LISTING
	      		command = iMacros.iimSet( "LOOPNUMBER" , loopNumber );
	      		command = iMacros.iimPlay( "yellowpages\\ExtractYPLising" );
	      		extract_msg = iMacros.iimGetErrorText();
	      		loopNumber = loopNumber + 1
	      		
	      		//END OF PAGE 
	      		if ( extract_msg === "-1300" ) {
	      		
	      			//NAVIGATE TO NEXT LISTING PAGE
	      			command = iMacros.iimPlay( "yellowpages\\NextListingsPage" );
	      			nextPage = iMacros.iimGetErrorText();
	      			
	      			//END OF ALL PAGES FOR QUERIES
	      			if ( nextPage === "-1300" ) {
	      			
	      				extract = false;  //STOP EXTRACT LOOP
	      				command = iMacros.iimClose(); //CLOSE ALL MACROS
	      				run = false;
	      			
	      			}
	      		
	      		//EXTRACT MACRO ENCOUNTERED SOME OTHER ERROR
	      		} else if ( extract_msg < 0 ) { 
	      		
	      			command = iMacros.iimDisplay( "EXTRACT ERROR:" + extract_msg );  //SEND ERROR TO IMACROS
	      			console.log( extract_msg );  //SEND ERROR TO CONSOLE
	      			command = iMacros.iimClose();  //CLOSE MACRO BROWSER TO RESET
	      			
	      		}
	      	
	      	//END OF EXTRACT LISTINGS LOOP
	      	}
	      	
      	} 
      	
      	//QUERY NOT ENTERED
      	else {
      	
	      	command = iMacros.iimDisplay( return_msg );  //SHOW ERROR IN MACROS LOG
	      	console.log( return_msg );  //SHOW ERROR IN JS CONSOLE
      		command = iMacros.iimClose();  //CLOSE IMACROS BROWSER TO RESET
      		
      	};
    
    
      //END OF COMPLETE QUERY SCRAPE
      };

//END OF FUNCTION  
}
</script>
Post Reply