How to run a macro from the command line using Chrome

Discussions and Tech Support related to the iMacros Google Chrome extension.

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.

Re: How to run a macro from the command line using Chrome

by chivracq on Mon Jan 15, 2018 12:46 pm

sanfric wrote:Hi
With Firefox, I use this procedure which works very well
Code: Select all
RetVal = Shell("C:\program files\Firefox\firefox.exe imacros://run/?m=TP.iim")

I followed Tom's procedure to do the same thing with Chrome
Code: Select all
RetVal = Shell("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe file:/// C:\Users\...\Documents\iMacros\Macros/TPS.htm")

Here is the TPS file. htm

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

        <script>
           var e_m64 = " VkVSU0lPTiUyMEJVSUxEJTNEMTAwMSUyMFJFQ09SREVSJTNEQ1IlMEFVUkwlMjBHT1RPJTNEaHR0cCUzQSUyRiUyRmNvcnJlc3BvbmRhbnRzLmxldGVsZWdyYW1tZS5mciUyRldEMTYwQVdQJTJGV0QxNjBBd3AuZXhlJTJGQ09OTkVDVCUyRnBvcnRhaWxfY29yciUzRl9XV1JFRkVSRVJfJTNEJTI2X1dXTkFUSU9OXyUzRDUlMEFUQUclMjBQT1MlM0QxJTIwVFlQRSUzRElNRyUyMEFUVFIlM0RJRCUzQUEyJTBBVEFHJTIwUE9TJTNEMSUyMFRZUEUlM0RTRUxFQ1QlMjBGT1JNJTNETkFNRSUzQVBBR0VfQVJUSUNMRVNfTk9VVkVBVV9URVhURSUyMEFUVFIlM0RJRCUzQUExJTIwQ09OVEVOVCUzRCUyNTM=";
        </script>

 
</script>

        <a id="criimlaunch" href="javascript:(function() {try{if(!/^(?:chrome|https?|file)/.test(location)){alert('iMacros: Open webpage to run a macro.');return;}var macro = {};macro.source = decodeURIComponent(atob(e_m64));macro.name = 'MacroBookmarklet';var evt = document.createEvent('CustomEvent');evt.initCustomEvent('iMacrosRunMacro', true, true, macro);window.dispatchEvent(evt);}catch(e){alert('iMacros Bookmarklet error: '+e.toString());}}) ();">Launch CR iMacros</a>

     </body>

<
</script>

 </html>


It works but there are two tabs opened: an useless "TPS.htm" tab with "Lauch Cr iMacros" an after the web page defined in the instructions of the script.

How to have only the web page without the TPS.htm tab ? Or close immédiately this tab?

thank you in advance for your help.
Sanfric

FCIM...! :mrgreen: (Read my Sig...)

Simply use a:
Code: Select all
TAB CLOSEALLOTHERS
in your '.iim' Script if you don't mind closing all "other" Tabs, or a:
Code: Select all
TAB T=0
TAB CLOSE
if you only want to close the "previous" Tab, I would think...
You might need '!ERRORIGNORE' for the Script to pass Parsing-Validation as I think there is a Check there for 'TAB T>0', but Negative Tab_Nbs do work, at least in iMacros for FF until at least v8.9.7, I reckon it will work in iMacros for CR as well, v8.4.4 or v10.0.

Hum, and mini-Detail, you have a "dangerous" or at least unneeded Space in "file:/// C:\Users\..."... :idea:
- (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: 7308
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to run a macro from the command line using Chrome

by sanfric on Thu Jan 18, 2018 5:39 am

Hi,
Thank you for your help. The result is achieved. It's more clean!
Now, I'm looking for Chrome something equivalent to this code used with Firefox
Code: Select all
TAG POS=1 TYPE=TEXTAREA FORM=NAME:PAGE_ARTICLES_NOUVEAU_TEXTE ATTR=ID:A7 CONTENT={{!clipboard}}


That allows me to paste in the web page I opened the contents of the clipboard from a Winword file .. I read that this procedure did not work with Chrome.

What can I do , in Chrome, for the same result as the Firefox code.

Thank for your answer

sanfric
sanfric
 
Posts: 32
Joined: Mon Dec 07, 2009 9:33 am

Re: How to run a macro from the command line using Chrome

by chivracq on Thu Jan 18, 2018 5:53 am

sanfric wrote:Hi,
Thank you for your help. The result is achieved. It's more clean!
Now, I'm looking for Chrome something equivalent to this code used with Firefox
Code: Select all
TAG POS=1 TYPE=TEXTAREA FORM=NAME:PAGE_ARTICLES_NOUVEAU_TEXTE ATTR=ID:A7 CONTENT={{!clipboard}}


That allows me to paste in the web page I opened the contents of the clipboard from a Winword file .. I read that this procedure did not work with Chrome.

What can I do , in Chrome, for the same result as the Firefox code.

Thank for your answer

sanfric

Yep, I have another Workaround for '{{!CLIPBOARD}}' on CR..., hum... maybe 2, hum 4 now, ah-ah...!, well, depending on your FCI... :roll:
=> Grrr...!, but FCIM again, sorry... Is it so complicated to mention 3 Versions about your Config...?
- (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: 7308
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to run a macro from the command line using Chrome

by sanfric on Thu Jan 18, 2018 9:24 am

For Chivracq

I do not understand exactly what you are asking to me. May be my configuration?

Version 1709 (16229.192) Windows 10 Pro French

Chrome: Version 63.0.3239.132 (Official Build) (64-bit)

iMacros for Chrome: BUILD VERSION = 1001 RECORDER = CR


Sanfric
sanfric
 
Posts: 32
Joined: Mon Dec 07, 2009 9:33 am

Re: How to run a macro from the command line using Chrome

by chivracq on Thu Jan 18, 2018 1:43 pm

sanfric wrote:For Chivracq

I do not understand exactly what you are asking to me. May be my configuration?

Code: Select all
Version 1709 (16229.192) Windows 10 Pro French

Chrome: Version 63.0.3239.132 (Official Build) (64-bit)

iMacros for Chrome: BUILD VERSION = 1001 RECORDER = CR


Sanfric

Yep, the 'C' in "FCI" stands for "Configuration", like explained in my Sig that I asked you to read... And if you registered in 2009, you should have had the time by now to read the Forum Rules for Required Info to include in your Posts when you start a Thread or post for the first time in some existing Thread, I would think... :roll:

So OK..., you are on iMacros for CR v10.0.1 + CR63, that means you can use the 'EVENT' Mode for a 'Ctrl^v' (= Clipboard 'Paste'), which is the easiest Workaround for pasting the Content of your OS Clipboard on CR as '{{!CLIPBOARD}}' is surprisingly not supported on CR.

Other possible Workarounds I would have in mind would be to use your 'Winword' Doc as a DataSource for iMacros if you convert it to a '.CSV' or '.TXT' File, or even open it from a 2nd Tab in your Browser as '.TXT' or '.HTML' File... ('.CSV' Files are often a bit "problematic" to open this way, as the '.CSV' File Extension is often associated to Excel which will then go "fighting" with the Browser on who is going to handle that File, at least on FF last time I had done some Testing with it...), and I wouldn't be very surprised if you even could open "Word" Docs directly from your Browser..., I've never tried...
Depending on if you "only" use the Free-Free Add-on for CR, v10.0.1 is now limited in Functionality and File Access is not supported anymore in the Free Version, then the '!DATASOURCE' Solutions wouldn't work.

Another possibility would be to convert your Word Doc to a GoogleDoc Doc that you then as well can open and extract or edit directly from your Script in a 2nd Tab. GoogleDocs work actually best on CR, the Integration is "smoother" than with other Browsers supported by iMacros...
- (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: 7308
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to run a macro from the command line using Chrome

by sanfric on Wed Jan 24, 2018 6:23 am

Hi,
I tried several syntax from the wiki iMacros.I am not a developer: I can not find the correct syntax for Event
I can paste only the letter "V" with this code
Code: Select all
EVENT TYPE=KEYPRESS SELECTOR="HTML" CHAR="v" MODIFIERS="ctrl"


I see that MODIFIERS work only with Firefox but not with Chrome

What can I do for pasting the clipboard with CTRL+V with Chrome

Tnahks for your hlep
Sanfric
sanfric
 
Posts: 32
Joined: Mon Dec 07, 2009 9:33 am

Re: How to run a macro from the command line using Chrome

by chivracq on Wed Jan 24, 2018 8:52 am

sanfric wrote:Hi,
I tried several syntax from the wiki iMacros.I am not a developer: I can not find the correct syntax for Event
I can paste only the letter "V" with this code
Code: Select all
EVENT TYPE=KEYPRESS SELECTOR="HTML" CHAR="v" MODIFIERS="ctrl"


I see that MODIFIERS work only with Firefox but not with Chrome

What can I do for pasting the clipboard with CTRL+V with Chrome

Tnahks for your hlep
Sanfric

Arrggghhh...!!, oh yep-yep, you're right...!, grrr..., I forgot about the 'MODIFIERS' Parameter not being supported on CR, as I only use FF myself...

OK-OK-OK..., then..., pfff..., you'll have to go back to one of the other Alternatives I mentioned then, ah-ah...!

But hum..., stg to "investigate" then..., is that the iMacros for FF Add-on is coded in pure JavaScript, meaning the whole 'EVENT' Mode/Functionality must be achievable in pure JavaScript, with and without the 'Modifiers' Functionality, maybe other Advanced User @iimfun will know how if he notices this Thread, and/or you might want to check on the SOF Forum how accessing the OS Clipboard and/or triggering a 'Ctrl^v' can be done in pure JS, then you can probably apply that Syntax in iMacros using the 'URL GOTO=javascript' Syntax...
- (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: 7308
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Previous

Return to iMacros for Chrome

Who is online

Users browsing this forum: No registered users and 3 guests

-->