将Python扩展为宏语言 [英] Expanding Python as a macro language

查看:92
本文介绍了将Python扩展为宏语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

当我从Windows迁移到Linux时我选择Python作为我的语言

参考和GUI,Qt(到目前为止调查不多) 。

直到现在我并不后悔但只有一件事:

Python不能充当宏语言,所以你不得不回复

到Windows使用AutoIt,Macro Express或Macro等程序
Scheduler甚至是Office与VBA的宏功能。


Claudio Grondi表示回答帖子的几乎相同的想法:

Hi all,
when I moved from Windows to Linux I choosed Python as my language of
reference and as GUI, Qt (not much investigated up to now).
Till now I didn''t regret but one thing:
Python can''t act as a macro language and so you are obliged to revert
to Windows to use programs like AutoIt, Macro Express or Macro
Scheduler or even the macro features of Office with VBA.

Claudio Grondi expressed almost the same ideas in answering to a post:

我可以指出的不是Python,而是将其嵌入Python中
是执行一行Python代码触发其<的问题执行。
我认为你会被它的功能和易用性所吸引,以及它如何适合你的需求:
http://www.autoitscript.com/autoit3/index.php
Wit你会开始看到,强迫服从Windows的方式做事不仅有坏的方面。
What I can point you to is not Python, but embedding it in Python
is a question of executing one line of Python code triggering its
execution.
I think you will be fascinated by its features and ease of use
and how well it is suited to fit into your needs:
http://www.autoitscript.com/autoit3/index.php
With it you will start to see, that forcing to obey to Windows way
of doing things has not only bad sides.




在回答他时,我表达了为了自动化目的,使用Windows和AutoIt 3

的想法。

然后我改变了想法......如果已经有一年我尝试了

在Linux中找到解决方案(主要是使用Python或DCOP和KDE),

我仍​​然相信有一个解决方案(在Python中我们有很大的

专家......)。

而不仅仅是包括电池我们有很多已经制作的

应用程序(从图形到浏览或编辑等),可以轻松访问,模仿用户操作(主要是按键或鼠标)

操作)...

再见。



In answering to him I expressed the idea to use Windows and AutoIt 3
for automation purposes.
But then I changed idea... Also if it is already one year that I try
to find a solution in Linux (mainly with Python or DCOP and KDE),
I am still confident that there is a solution (in Python we have big
experts...).
Instead of merely "batteries included" we have plenty of already made
applications (from graphics to browsing or editing etc.) that can be
easily accessed emulating users operations (mainly keystrokes or mouse
operations)...
Bye.

推荐答案

在Windows上我使用了一些很久以前wmi模块的类似任务。

它能够分析正在运行的程序,按下按钮并激活菜单

项目。你没有提到它,你可能会看一下。它工作得非常好。

http://tgolden.sc.sabren.com/python/wmi.html


对于linux我不知道。

Well on Windows I used some time ago for similar tasks the wmi module.
It is able to analyse running programs, press buttons and activate menu
items. As you didn''t mention it, you might have a look at it. It works
pretty well.

http://tgolden.sc.sabren.com/python/wmi.html

For linux I don''t know.


嗨!

不是很好的答案,但是,有关信息:


AutoIt是在beta版本中更好(许多版本的beta存在)。 AutoIt

beta可以使用COM调用,并且可以使用带有win32all的Python编写的COM服务器

(PyWin)。


而且,AutoIt的存在就像Active-X(实际上是一个COM服务器),谁可以使用Python(+ PyWin)来使用


@ -salutations


Michel Claveau

Hi !
Not the good answer, but, for information :

AutoIt is very better in beta-release (many versions beta exist). AutoIt
beta can use COM call, and can use COM-server writed in Python with win32all
(PyWin).

And, also, AutoIt exist like Active-X (in reality a COM server), who can to
do used from Python (+ PyWin).
@-salutations

Michel Claveau


感谢您的重播(WMI和AutoIt beta版本)
但如果我在Linux上有类似于标准版本的AutoIt的话,我会感到满意!

关于WMI,它的一部分是有效的只有在Windows下,从我看到的例子中获得
,恕我直言它比

AutoIt强大得多。

在Linux中你可以很容易地获得通过使用shell进行编程或通过在Python中使用os.system(shell

命令字符串)模拟shell来获得几乎相同的结果。

但问题是在Linux中你甚至不能发送击键

a运行GUI应用程序!

我想在专家的帮助下在Linux中找到解决方案

(如果他们不是仅使用Windows ...)有两个原因:

- Windows中免费的可用性降低或打开应用程序

- Windows中更严重的安全问题。

关于第二点,你可以正确地说这是,

至少部分,由于Windows的市场份额更广,但是IMHO

Linux在这个领域更加强大,而且...目前......

的情况就是这样! br />
由于我想主要在互联网上使用自动化,我担心

的安全性,我不想花时间和金钱来防病毒

和防火墙...

我想让你了解自动化的可能应用。

想象一下你想从html服务器访问一个大数据库

只允许您按下ASP文件中的next

按钮以块的形式访问这些数据。单击按钮

需要几个小时,然后保存服务器提供的新数据!

这是AutoIt的典型任务,非常容易编程,

a部分,在脚本执行期间,您处于病毒状态或

其他安全处理!

另一个应用示例是模拟蜘蛛程序make

在互联网上搜索或下载。通过模仿用户,您可以绕过

自动操作(如wget或urlib)对搜索引擎或html服务器施加的限制。

最后一个例子是使用几个b $ b匿名者来保护隐私。这只能通过宏语言来实现

自动连接到网络匿名者。此外

网络操作必须以自动方式执行(恕我直言!)。

当然有很多可能应用的宏语言

以上所有它可以让我免于学习C ++(对于Qt)。

例如,制作一个图表,你没有义务在
中制作一个程序
C ++或PyQt绘制并可能打印数据图表,但是你只需要编程数据准备然后将数据发送到

图纸申请......

再见。

Thank you for your replays (both for WMI and AutoIt beta-release)
but I would be satisfied if I had in Linux something similar to
the standard version of AutoIt!
Concerning WMI, a part the fact that it works only under Windows,
from the examples I have seen, IMHO it is much less powerful than
AutoIt.
In Linux you can easily obtain almost the same results by using shell
programming or by emulation of the shell by means of os.system("shell
command string") in Python.
But the problem is that in Linux you can''t even send a keystroke to
a running GUI application!
I want to find a solution in Linux, with the help of experts
(if they don''t use only Windows...) for two reasons:
- the reduced availability in Windows of "free" or "open" applications
- the more severe security problems in Windows.
Concerning the second point, you can correctly argue that this is,
at least partly, due to the wider market share of Windows but IMHO
Linux is more robust in this field, and ...at the present times the
situation is like that!
As I want to use automation mainly in Internet, I am worried of
security and I don''t want to spend time and money in anti-virus
and firewalls...
I want to give you an idea of possible applications of automation.
Imagine you want to access a big database from a html server which
only allows you to access such data in chunks pressing a "next"
button on an ASP file. It will take several hours to click the button
and then save the new data supplied by the server!
That is a typical task of AutoIt, very easily programmable,
a part that, during the script execution, you are under virus or
other security treat!
Another example of application is to emulate a spider program to make
searches or downloads in Internet. By emulating a user you can bypass
the restrictions imposed by search engines or html servers on
automatic operations (like wget or urlib).
A last example is for protecting the privacy using several
"anonymizers". That can only be possible with a macro language for
automatic connection to the web anonymizers. Also the subsequent
web operations must be carried out (IMHO!) in an automatic manner.
There are of course plenty of possible application of a macro language
and above all it can save me from be obliged to learn C++ (for Qt).
For example, to make a graph you are not obliged to make a program in
C++ or PyQt to draw and possibly print the graph of your data, but you
need only to program the data preparation then send the data to a
drawing application...
Bye.


这篇关于将Python扩展为宏语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆