如何在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
2023-06-21 12:06

满意答案

如果您有调度规则处于活动状态,则应在管理控制台中的“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中的删除(Python)(How to handle delete in Google App Engine (Python))

删除很接近。 一旦你有一个密钥,你可以通过调用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...

AppEngine / Python:为什么不抓住异常?(AppEngine/Python: Why isn't the exception caught?)

main函数只注册此应用程序。 因此,在main函数中不会引发异常。 因此try ... catch语句不起作用。 处理此异常的方法是定义新的RequestHandler。 然后,所有想要拥有此功能的请求都应该来自新的RequestHandler。 例如: Class MyRequestHandler(RequestHandler): def get(self): try: self.get_handler() except Capa...

我可以在Google应用程序引擎上使用python打开cv吗?(Can I use open cv with python on Google app engine?)

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 ...

使用Python远程API在Google App Engine中“在应用程序上下文之外工作”(“working outside of application context” in Google App Engine with Python remote API)

问题出在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 ...

appengine python routing - 在谷歌应用程序引擎控制台确认(appengine python routing - confirming back in google app engine console)

如果您有调度规则处于活动状态,则应在管理控制台中的“Main> Dispatch”左侧导航链接下显示它们。 If you have dispatch rules active, they should be visible in the admin console under the "Main > Dispatch" left navigation link.

Python App Engine不会部署 - 超时(Python App Engine will not deploy - timeout)

我不认为你做错了什么。 有时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, becaus...

使用Google App Engine将所有请求从一个域重定向到另一个域但在yaml中保留静态路由规则(redirect all requests from one domain to another with Google App Engine but keep static routing rules in yaml)

AFAIK您无法对静态资产进行重定向,因为GAE根据.yaml文件规则直接为其提供服务,甚至无需点击您的应用程序代码。 您可以添加一个模块(例如, 将其称为redirect-module )到您的应用程序,使用调度程序文件将所有旧域URL路由到它,并使用此模块中的动态处理程序将URL重定向到新的域等效项,沿着这些行在您引用的问题的答案中建议。 新域请求将继续未经修改地工作,作为静态资产或应用程序的现有模块提供。 dispatch.yaml文件如下所示: application: your-app-...

Google App Engine API +静态架构(Google App Engine API + static architecture)

开始:你正在混合标准和灵活的环境文档 - 这不是一个好主意,因为它们的工作方式不同。 请参阅如何判断Google App Engine文档页面是否适用于标准环境或灵活环境 。 由于您的应用程序是Node.JS,您必须使用灵活的env,其script和static_files不适用于app.yaml 。 这就是为什么你不能让他们工作的原因。 列表中的第一个引用显示了为静态文件提供服务的选项。 但我有点质疑您希望使用共享GCS选项 - 无论dev / staging / production环境如何,...

Google App Engine:ImportError:没有名为appengine.ext的模块(Google App Engine: ImportError: No module named appengine.ext)

总是在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...

Google App Engine模块的路由无效(Google App Engine module's routing is not working)

当您使用路径进行模块路由时,并不意味着路径映射到模块的根,它只是确定哪个模块有机会处理请求。 除非你的列表模块处理/列表中有代码,否则它将是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...

相关文章

更多

Object Oriented Programming

Some might also contend that inheritance should be ...

could not find system property or JNDI

Thanks everyone!! Finally got a solution for this p ...

Guava学习笔记:复写的Object常用方法

  在Java中Object类是所有类的父类,其中有几个需要override的方法比如equals,h ...

reading notes for solr source code

solr source code 1 org.apache.solr.common 基本的类对象 ...

Cannot expose request attribute 'website' because of an existing model object of the same name 的解决方案

在使用springmvc+freemarker,有可能你会遇到以下异常(如:资源找不到重定向到404的 ...

Hadoop 0.21如何运行单个test case

研究 Hadoop 0.21代码时,很多情况下需要运行单个test case,如果新增了功能要测试 ...

oracle数据库中NOT IN 和 NOT EXISTS为什查不到数据

SELECT GA.ADID, GA.ADNAME FROM GAP_AD GA WHERE e ...

mybatis There is no getter for property named 'xx' in 'class java.lang.String

用mybatis查询时,传入一个字符串传参数,且进行判断时,会报 There is no get ...

在main方法中开启线程与@Test中开启线程

用来测试线程同步问题的代码: public class SynchronizeDemo { p ...

《测试驱动开发(中文版)》(Test-driven development:by example)扫描版[PDF]

中文名: 测试驱动开发(中文版) 原名: Test-driven development:by ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本