Integrating iMacros scripts into python

喜你入骨 提交于 2020-01-04 09:04:02

问题


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?


回答1:


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 :)




回答2:


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)


来源:https://stackoverflow.com/questions/11990723/integrating-imacros-scripts-into-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!