如何在AutoIt中读取其值之前测试对象上是否存在属性?(How to test if object property exists before reading its value?)
如果页面是PDF文件,我有一个IE对象$ oIE,它不会让我访问页面的主体。
如果我尝试访问变量,我的代码会中断。 以下是我如何称呼它:
_IEAction($oIE, 'saveas')
但是这个消息错误了:
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (1959) : ==> The requested action with this object has failed.: $oObject.document.execCommand("SaveAs") $oObject.document^ ERROR
我需要遍历几页PDF并将它们保存到磁盘。 仅当页面是PDF时才会抛出此错误,当它是普通的HTML页面时,它可以正常工作。
有没有办法检查文档主体是否存在? 如果它不存在,它告诉我该页面是PDF,我需要保存它。
My Internet Explorer object
$oIE
, won't let me access the page's body property if it concerns a PDF file (as opposed to a HTML page). If I try to access that property, my code breaks. Here is how I call it:_IEAction($oIE, 'saveas')
But it errors:
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (1959) : ==> The requested action with this object has failed.: $oObject.document.execCommand("SaveAs") $oObject.document^ ERROR
I need to iterate over a few pages of PDF files and save them to disk. This error is thrown only when the page is a PDF document; a normal HTML page works fine. How to check if the document body property exists? If it doesn't, it means the page is a PDF (I need to save it).
原文:https://stackoverflow.com/questions/32977365
最满意答案
如果您有调度规则处于活动状态,则应在管理控制台中的“Main> Dispatch”左侧导航链接下显示它们。
If you have dispatch rules active, they should be visible in the admin console under the "Main > Dispatch" left navigation link.
相关问答
更多-
删除很接近。 一旦你有一个密钥,你可以通过调用db.delete(key)来删除实体。 对于你的例子,这将是这样的: class DeleteHandler(webapp2.RequestHandler): def post(self): key = self.request.get('k') item = db.get(key) blobstore.delete([item.blob_key]) db.delete(item) ...
-
main函数只注册此应用程序。 因此,在main函数中不会引发异常。 因此try ... catch语句不起作用。 处理此异常的方法是定义新的RequestHandler。 然后,所有想要拥有此功能的请求都应该来自新的RequestHandler。 例如: Class MyRequestHandler(RequestHandler): def get(self): try: self.get_handler() except Capabilit ...
-
GAE只支持它们自己提供的纯python扩展或扩展。 OpenCV使用C,所以它不适合。 解释器可以运行任何Python代码,包括您的应用程序中包含的Python模块以及Python标准库。 解释器无法使用C代码加载Python模块; 它是一个“纯粹的”Python环境。 https://developers.google.com/appengine/docs/python/overview 纯Python和GAE No. GAE only supports either pure python exten ...
-
问题出在User类本身。 我有: def __init__(self, **kwargs): super(User, self).__init__(**kwargs) # FLASKY_ADMIN configuration variable, so as soon as that email address appears in a registration request it can be given the correct role if self. ...
-
如果您有调度规则处于活动状态,则应在管理控制台中的“Main> Dispatch”左侧导航链接下显示它们。 If you have dispatch rules active, they should be visible in the admin console under the "Main > Dispatch" left navigation link.
-
我不认为你做错了什么。 有时Google App Engine没有按照您的方式做出响应,因为他们可能会遇到一些问题。 尝试更改版本并重新部署(或在命令行中使用--version=version-name )。 如果这不能解决问题,你将需要等待一段时间,然后再试一次 I don't think that you're doing anything wrong. Sometimes Google App Engine is not responding the way you want, because the ...
-
AFAIK您无法对静态资产进行重定向,因为GAE根据.yaml文件规则直接为其提供服务,甚至无需点击您的应用程序代码。 您可以添加一个模块(例如, 将其称为redirect-module )到您的应用程序,使用调度程序文件将所有旧域URL路由到它,并使用此模块中的动态处理程序将URL重定向到新的域等效项,沿着这些行在您引用的问题的答案中建议。 新域请求将继续未经修改地工作,作为静态资产或应用程序的现有模块提供。 dispatch.yaml文件如下所示: application: your-app-name ...
-
开始:你正在混合标准和灵活的环境文档 - 这不是一个好主意,因为它们的工作方式不同。 请参阅如何判断Google App Engine文档页面是否适用于标准环境或灵活环境 。 由于您的应用程序是Node.JS,您必须使用灵活的env,其script和static_files不适用于app.yaml 。 这就是为什么你不能让他们工作的原因。 列表中的第一个引用显示了为静态文件提供服务的选项。 但我有点质疑您希望使用共享GCS选项 - 无论dev / staging / production环境如何,它都将提供 ...
-
总是在virtualenv中运行,我遇到的问题要少得多。 我同意snakecharmerrb你应该得到打印google.__file__或google.__path_找出你究竟是什么导入。 此代码段也可以解决您的问题: import google gae_dir = google.__path__.append('/path/to/appengine_sdk//google_appengine/google') sys.path.insert(0, gae_dir) # might not be nece ...
-
当您使用路径进行模块路由时,并不意味着路径映射到模块的根,它只是确定哪个模块有机会处理请求。 除非你的列表模块处理/列表中有代码,否则它将是404。 When you use a path for module routing, it doesn't mean that path maps to the root of the module it just determines which module gets a chance to handle the request. Unless you have ...