我正在使用 Ruby 1.8。使用 WIN32OLE 模块 -
1) 如何确定 OLE 对象实例的类名?2) 如何判断对象实例是否支持特定方法?
在 Outlook 自动化脚本中,我试图删除“已删除项目”文件夹中超过 21 天的项目。对于邮件项目,我想使用 ReceivedTime 属性,但为了做到这一点,我需要检查该项目是否实际上是 MailItem 实例。
其次,我能想到的最好的方法是(真的很慢):
def MethodExists(obj, methodName)
obj.ole_methods.each{|method|
if (method.name == methodName)
return true
end
}
return false
end