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

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.

ActiveXObjects for Chrome

by sterlingtuttle on Sun Nov 23, 2014 10:48 am

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

Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: No registered users and 4 guests

-->