Jakub M.
Jakub M.

Reputation: 33827

iMacros + FF : Linux, command line

I want to run iMacros script with Firefox, under Ubuntu, by specifying the script in the command line. Unfortunately, the browser only opens the file as text and not runs it...

Any clue?

Upvotes: 1

Views: 3571

Answers (2)

Sim
Sim

Reputation: 41

Embed your macro code into a local test.htm file and run this file via firefox command line (works even with free iMacros version)

Command line example is:

firefox file:///home/test/test.htm

The test.htm file example is:

<html>
   <body onload="window.setTimeout('document.getElementById(\'criimlaunch\').click();', 1000);">

      <script>
         var macroCode = '';
!!!ADD YOUR MACRO HERE!!!
         macroCode += 'PROMPT HELLO!\n';
         macroCode += 'URL GOTO=http://imacros.net/\n';
         macroCode += 'PROMPT BYE!\n';
!!!ADD YOUR MACRO HERE!!!
         function launchMacro()
            {
            try
               {
                  if(!/^(?:chrome|https?|file)/.test(location))
                  {
                     alert('iMacros: Open webpage to run a macro.');
                     return;
                  }
               
                  var macro = {}; 
                  macro.source = macroCode;
                  macro.name = 'EmbeddedMacro';
               
                  var evt = document.createEvent('CustomEvent');
                  evt.initCustomEvent('iMacrosRunMacro', true, true, macro);
                  window.dispatchEvent(evt);
               }
            catch(e)
            {
               alert('iMacros Bookmarklet error: '+e.toString());
            };
         }
      </script>

      <a id="criimlaunch" href="javascript:launchMacro();">Launch iMacros</a>

   </body>
</html>

See more at: https://wiki.imacros.net/Webextensions#Add_File_Access

Upvotes: 0

user1319182
user1319182

Reputation: 496

You should manually add the macro to your browser then save it under a name of your choice. Then you can call it with

    firefox  http://run.imacros.net/?m=name_of_the_macro.iim

Upvotes: 1

Related Questions