Integrating iMacros scripts into python

2019-07-14 05:24发布

I'm trying to write a Python script with a GUI that, when I push a button, will execute a iMacros script. That's literally pretty much it, and after a lot of Googling and searching SO, I can't find it. I don't need help with the gui or anything, just how do I make iMacros run within/because of a python function?

2条回答
一纸荒年 Trace。
2楼-- · 2019-07-14 05:33

I figured out how to do this in chrome using python.

See: https://imgur.com/a/iJOe0

Actual reference is here: https://wiki.imacros.net/iMacros_for_Chrome (under comand line support)

After you have followed those instructions, simply do this in python:

import os
macro =r"C:\your\full\file\directory\and\file\name.html"
os.startfile(macro)

查看更多
做个烂人
3楼-- · 2019-07-14 05:49
import os
os.system('"C:\Program Files\iOpus\iMacros\iMacros.exe" -macro my_macro.iim')

http://wiki.imacros.net/Example-Batchfile.bat

or

import win32com.client
def Hello():
 import win32com.client
 w=win32com.client.Dispatch("imacros")
 w.iimInit("", 1)
 w.iimPlay("Demo\\FillForm")
if __name__=='__main__':
 Hello()

http://wiki.imacros.net/Python

see also: http://wiki.imacros.net/Sample_Code

The rub is that these methods will require the business or enterprise editions of imacros
( http://www.iopus.com/imacros/compare/)

You can alternatly use Autoit ( http://www.autoitscript.com/site/autoit/) to script opening of web browser and selecting a (imacro)script and running it by clicking play and you can use autoits python bindings even on the free version :)

查看更多
登录 后发表回答