在windows上编写python脚本

2024-06-01 11:55:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我不熟悉python脚本。在

我几乎没有重复的测试任务,比如记录到各种IM中

ex(OCS,不同的公共信使)等。在

是否可以使用python自动化这些任务。在

如果是,我从哪里开始?在

正在使用windows 2003 server。在

我知道python的基本知识。想提高技能。在

谢谢, 塔齐姆


Tags: 脚本serverwindows技能记录ex信使im
2条回答

接触网

对于OCS,您应该能够使用COM脚本来完成大多数但不是所有的事情[1]。代码应该看起来有点像这样:

import win32com.client

def get_contact(signin_uri, communicator):
   c = communicator.GetContact(signin_uri, communicator.MyServiceId)
   return c

comm = win32com.client.Dispatch('Communicator.UIAutomation')
contact = get_contact("jaya@contoso.com", comm)

您应该能够相当容易地翻译来自API的文档,尤其是当您专注于JScript示例时。在

MSN/Live、AIM、ICQ和IRC

对于MSN/livemessenger,优秀的twisted库包含一个多协议IM客户端(和服务器)的rudimentary implementation。要开始,请查看一些code samples。在


[1]根据文件:

For reasons of security, not all methods or properties can be called using JavaScript or another scripting language. Such restrictions are documented in Office Communicator Automation API Reference.

不完全是一个重复的问题,但是“How can we use ms office communicator client exposed APIs in python, is that possible ?”的答案应该是有价值的。在

如果您是Python的新手,您将需要查看Python Tutorial。在

不过,您也可能希望考虑一些面向Windows的东西,比如VBScript或PowerShell。在

相关问题 更多 >