新昌做网站,app制作教程步骤图,网站开发的四个高级阶段包括,安装好采集侠网站地图后在哪里查看网站地图目录
背景描述 用浏览器访问#xff0c;正常返回
编辑 AHK v2官方示例源代码 AHK v2运行结果报错(0x80092004) 找不到对象或属性
用thqby大佬的WinHttpRequest.ahk库测试报错 0x80092004 找不到对象或属性
附#xff1a;
用Apifox访问#xff0c;也正常返回
AHK v1 …
目录
背景描述 用浏览器访问正常返回
编辑 AHK v2官方示例源代码 AHK v2运行结果报错(0x80092004) 找不到对象或属性
用thqby大佬的WinHttpRequest.ahk库测试报错 0x80092004 找不到对象或属性
附
用Apifox访问也正常返回
AHK v1 官方示例源代码
AHK v1运行失败报错 0x80092004 找不到对象或属性
用Msxml2.XMLHTTP则能正常得到结果 背景描述 想通过ahk编程获取 https://autohotkey.com/download/2.0/version.txt 的文件内容。 在确认用浏览器可以正常访问情况下用官方帮助中的示例运行会报错 Error: (0x80092004) 找不到对象或属性。用 thqby大佬的 WinHttpRequest.ahk 网络请求库 https://github.com/thqby/ahk2_lib/blob/master/WinHttpRequest.ahk 也报同样错误。 求指点 用浏览器访问正常返回 AHK v2官方示例源代码
whr : ComObject(WinHttp.WinHttpRequest.5.1)
whr.Open(GET, https://autohotkey.com/download/2.0/version.txt, true)
whr.Send()
whr.WaitForResponse()
version : whr.ResponseText
MsgBox version AHK v2运行结果报错(0x80092004) 找不到对象或属性 如果把参数 true改为 false ,报错如下 用thqby大佬的WinHttpRequest.ahk库测试报错 0x80092004 找不到对象或属性 /************************************************************************* file: WinHttpRequest.ahk* description: 网络请求库* author thqby* date 2021/08/01* version 0.0.18***********************************************************************/#Requires AutoHotkey v2.0
whr : WinHttpRequest()
whr.Open(Get, https://www.autohotkey.com/download/2.0/version.txt, True)
whr.Send()
whr.WaitForResponse()
MsgBox whr.ResponseTextclass WinHttpRequest {static AutoLogonPolicy : {Always: 0,OnlyIfBypassProxy: 1,Never: 2}static Option : {UserAgentString: 0,URL: 1,URLCodePage: 2,EscapePercentInURL: 3,SslErrorIgnoreFlags: 4,SelectCertificate: 5,EnableRedirects: 6,UrlEscapeDisable: 7,UrlEscapeDisableQuery: 8,SecureProtocols: 9,EnableTracing: 10,RevertImpersonationOverSsl: 11,EnableHttpsToHttpRedirects: 12,EnablePassportAuthentication: 13,MaxAutomaticRedirects: 14,MaxResponseHeaderSize: 15,MaxResponseDrainSize: 16,EnableHttp1_1: 17,EnableCertificateRevocationCheck: 18,RejectUserpwd: 19}static PROXYSETTING : {PRECONFIG: 0,DIRECT: 1,PROXY: 2}static SETCREDENTIALSFLAG : {SERVER: 0,PROXY: 1}static SecureProtocol : {SSL2: 0x08,SSL3: 0x20,TLS1: 0x80,TLS1_1: 0x200,TLS1_2: 0x800,All: 0xA8}static SslErrorFlag : {UnknownCA: 0x0100,CertWrongUsage: 0x0200,CertCNInvalid: 0x1000,CertDateInvalid: 0x2000,Ignore_All: 0x3300}__New(UserAgent : unset) {(this.whr : ComObject(WinHttp.WinHttpRequest.5.1)).Option[0] : IsSet(UserAgent) ? UserAgent : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36 Edg/89.0.774.68}request(url, method : GET, post_data?, headers : {}) {this.Open(method, url)for k, v in headers.OwnProps()this.SetRequestHeader(k, v)this.Send(post_data?)return this.ResponseText}enableRequestEvents(Enable : true) {static vtable : init_vtable()if !Enablereturn this._ievents : this._ref : 0if this._ieventsreturnIConnectionPointContainer : ComObjQuery(pwhr : ComObjValue(this.whr), {B196B284-BAB4-101A-B69C-00AA00341D07})DllCall(ole32\CLSIDFromString, str, {F97F4E15-B787-4212-80D1-D380CBBF982E}, ptr, IID_IWinHttpRequestEvents : Buffer(16))ComCall(4, IConnectionPointContainer, ptr, IID_IWinHttpRequestEvents, ptr*, IConnectionPoint : ComValue(0xd, 0)) ; IConnectionPointContainer-FindConnectionPointIWinHttpRequestEvents : Buffer(3 * A_PtrSize)NumPut(ptr, vtable.Ptr, ptr, ObjPtr(this), ptr, ObjPtr(IWinHttpRequestEvents), IWinHttpRequestEvents)ComCall(5, IConnectionPoint, ptr, IWinHttpRequestEvents, uint*, dwCookie : 0) ; IConnectionPoint-Advisethis._ievents : { __Delete: (*) ComCall(6, IConnectionPoint, uint, dwCookie) }static init_vtable() {vtable : Buffer(A_PtrSize * 7), offset : vtable.Ptrfor nParam in StrSplit(3113213)offset : NumPut(ptr, CallbackCreate(EventHandler.Bind(A_Index), , Integer(nParam)), offset)vtable.DefineProp(__Delete, { call: __Delete })return vtablestatic EventHandler(index, this, arg1 : 0, arg2 : 0) {if (index 4) {IEvents : NumGet(this, A_PtrSize * 2, ptr)if index 1NumPut(ptr, this, arg2)if index 3ObjRelease(IEvents)else ObjAddRef(IEvents)return 0}req : ObjFromPtrAddRef(NumGet(this, A_PtrSize, ptr))req.readyState : index - 2switch index {case 4: ; OnResponseStarttry req.OnResponseStart(arg1, StrGet(arg2, utf-16))case 5: ; OnResponseDataAvailabletry req.OnResponseDataAvailable(NumGet((pSafeArray : NumGet(arg1, ptr)) 8 A_PtrSize, ptr),NumGet(pSafeArray 8 A_PtrSize * 2, uint))case 6: ; OnResponseFinishedtry req._ref : 0, req.OnResponseFinished()case 7: ; OnErrortry req.readyState : req._ref : 0, req.OnError(arg1, StrGet(arg2, utf-16))}}static __Delete(this) {loop 7CallbackFree(NumGet(this, (A_Index - 1) * A_PtrSize, ptr))}}};#region IWinHttpRequest https://learn.microsoft.com/en-us/windows/win32/winhttp/iwinhttprequest-interfaceSetProxy(ProxySetting, ProxyServer, BypassList) this.whr.SetProxy(ProxySetting, ProxyServer, BypassList)SetCredentials(UserName, Password, Flags) this.whr.SetCredentials(UserName, Password, Flags)SetRequestHeader(Header, Value) this.whr.SetRequestHeader(Header, Value)GetResponseHeader(Header) this.whr.GetResponseHeader(Header)GetAllResponseHeaders() this.whr.GetAllResponseHeaders()Send(Body?) (this._ievents this._ref : this, this.whr.Send(Body?))Open(verb, url, async : false) {this.readyState : 0this.whr.Open(verb, url, async)this.readyState : 1}WaitForResponse(Timeout : -1) this.whr.WaitForResponse(Timeout)Abort() (this._ref : this.readyState : 0, this.whr.Abort())SetTimeouts(ResolveTimeout : 0, ConnectTimeout : 60000, SendTimeout : 30000, ReceiveTimeout : 30000) this.whr.SetTimeouts(ResolveTimeout, ConnectTimeout, SendTimeout, ReceiveTimeout)SetClientCertificate(ClientCertificate) this.whr.SetClientCertificate(ClientCertificate)SetAutoLogonPolicy(AutoLogonPolicy) this.whr.SetAutoLogonPolicy(AutoLogonPolicy)Status this.whr.StatusStatusText this.whr.StatusTextResponseText this.whr.ResponseTextResponseBody {get {pSafeArray : ComObjValue(t : this.whr.ResponseBody)pvData : NumGet(pSafeArray 8 A_PtrSize, ptr)cbElements : NumGet(pSafeArray 8 A_PtrSize * 2, uint)return ClipboardAll(pvData, cbElements)}}ResponseStream this.whr.responseStreamOption[Opt] {get this.whr.Option[Opt]set (this.whr.Option[Opt] : Value)}Headers {get {m : Map(), m.Default : loop parse this.GetAllResponseHeaders(), rnif (p : InStr(A_LoopField, :))m[SubStr(A_LoopField, 1, p - 1)] . LTrim(SubStr(A_LoopField, p 1))return m}}/*** The OnError event occurs when there is a run-time error in the application.* prop {(this,errCode,errDesc)void} OnError*/OnError : 0/*** The OnResponseDataAvailable event occurs when data is available from the response.* prop {(this,safeArray)void} OnResponseDataAvailable*/OnResponseDataAvailable : 0/*** The OnResponseStart event occurs when the response data starts to be received.* prop {(this,status,contentType)void} OnResponseDataAvailable*/OnResponseStart : 0/*** The OnResponseFinished event occurs when the response data is complete.* prop {(this)void} OnResponseDataAvailable*/OnResponseFinished : 0;#endregionreadyState : 0, whr : 0, _ievents : 0static __New() {if this ! WinHttpRequestreturnthis.DeleteProp(__New)for prop in [OnError, OnResponseDataAvailable, OnResponseStart, OnResponseFinished]this.Prototype.DefineProp(prop, { set: make_setter(prop) })make_setter(prop) (this, value : 0) value (this.DefineProp(prop, { call: value }), this.enableRequestEvents())}
}
附
用Apifox访问也正常返回 AHK v1 官方示例源代码
whr : ComObjCreate(WinHttp.WinHttpRequest.5.1)
whr.Open(GET, https://www.autohotkey.com/download/1.1/version.txt, true)
whr.Send()
whr.WaitForResponse()
version : whr.ResponseText
MsgBox % version
AHK v1运行失败报错 0x80092004 找不到对象或属性 用Msxml2.XMLHTTP则能正常得到结果
#Requires AutoHotkey v2.0
req : ComObject(Msxml2.XMLHTTP)
req.open(GET, https://www.autohotkey.com/download/2.0/version.txt, true)
req.onreadystatechange : Ready
req.send()PersistentReady() {if (req.readyState ! 4) ; 没有完成.returnif (req.status 200) ; OK.MsgBox Latest AutoHotkey version: req.responseTextelseMsgBox Status req.status,, 16ExitApp
} 文章转载自: http://www.morning.qnbsx.cn.gov.cn.qnbsx.cn http://www.morning.zlrrj.cn.gov.cn.zlrrj.cn http://www.morning.yntsr.cn.gov.cn.yntsr.cn http://www.morning.qcdhg.cn.gov.cn.qcdhg.cn http://www.morning.txtzr.cn.gov.cn.txtzr.cn http://www.morning.rrbhy.cn.gov.cn.rrbhy.cn http://www.morning.byzpl.cn.gov.cn.byzpl.cn http://www.morning.hxlpm.cn.gov.cn.hxlpm.cn http://www.morning.cbnjt.cn.gov.cn.cbnjt.cn http://www.morning.sdhmn.cn.gov.cn.sdhmn.cn http://www.morning.i-bins.com.gov.cn.i-bins.com http://www.morning.dtrz.cn.gov.cn.dtrz.cn http://www.morning.kqzt.cn.gov.cn.kqzt.cn http://www.morning.dqxph.cn.gov.cn.dqxph.cn http://www.morning.zxybw.cn.gov.cn.zxybw.cn http://www.morning.qmrsf.cn.gov.cn.qmrsf.cn http://www.morning.lhztj.cn.gov.cn.lhztj.cn http://www.morning.lywpd.cn.gov.cn.lywpd.cn http://www.morning.kfjnx.cn.gov.cn.kfjnx.cn http://www.morning.tyhfz.cn.gov.cn.tyhfz.cn http://www.morning.qpqwd.cn.gov.cn.qpqwd.cn http://www.morning.bpzw.cn.gov.cn.bpzw.cn http://www.morning.fjfjm.cn.gov.cn.fjfjm.cn http://www.morning.fqsxf.cn.gov.cn.fqsxf.cn http://www.morning.mzhgf.cn.gov.cn.mzhgf.cn http://www.morning.nknt.cn.gov.cn.nknt.cn http://www.morning.fpxyy.cn.gov.cn.fpxyy.cn http://www.morning.cmrfl.cn.gov.cn.cmrfl.cn http://www.morning.thlzt.cn.gov.cn.thlzt.cn http://www.morning.frqtc.cn.gov.cn.frqtc.cn http://www.morning.mqldj.cn.gov.cn.mqldj.cn http://www.morning.hbpjb.cn.gov.cn.hbpjb.cn http://www.morning.pdgqf.cn.gov.cn.pdgqf.cn http://www.morning.pyncx.cn.gov.cn.pyncx.cn http://www.morning.yzktr.cn.gov.cn.yzktr.cn http://www.morning.hnmbq.cn.gov.cn.hnmbq.cn http://www.morning.wpqwk.cn.gov.cn.wpqwk.cn http://www.morning.xqgtd.cn.gov.cn.xqgtd.cn http://www.morning.sbqrm.cn.gov.cn.sbqrm.cn http://www.morning.lctrz.cn.gov.cn.lctrz.cn http://www.morning.rqmr.cn.gov.cn.rqmr.cn http://www.morning.yhwyh.cn.gov.cn.yhwyh.cn http://www.morning.zckhn.cn.gov.cn.zckhn.cn http://www.morning.txjrc.cn.gov.cn.txjrc.cn http://www.morning.pwmpn.cn.gov.cn.pwmpn.cn http://www.morning.fqnql.cn.gov.cn.fqnql.cn http://www.morning.nbhft.cn.gov.cn.nbhft.cn http://www.morning.wbqk.cn.gov.cn.wbqk.cn http://www.morning.tkzrh.cn.gov.cn.tkzrh.cn http://www.morning.rfrx.cn.gov.cn.rfrx.cn http://www.morning.hchrb.cn.gov.cn.hchrb.cn http://www.morning.rbzht.cn.gov.cn.rbzht.cn http://www.morning.cwznh.cn.gov.cn.cwznh.cn http://www.morning.hsjrk.cn.gov.cn.hsjrk.cn http://www.morning.eronghe.com.gov.cn.eronghe.com http://www.morning.lrwsk.cn.gov.cn.lrwsk.cn http://www.morning.rcjqgy.com.gov.cn.rcjqgy.com http://www.morning.bpmdg.cn.gov.cn.bpmdg.cn http://www.morning.hkpyp.cn.gov.cn.hkpyp.cn http://www.morning.trtdg.cn.gov.cn.trtdg.cn http://www.morning.wchcx.cn.gov.cn.wchcx.cn http://www.morning.qrqg.cn.gov.cn.qrqg.cn http://www.morning.tqpr.cn.gov.cn.tqpr.cn http://www.morning.mbmtn.cn.gov.cn.mbmtn.cn http://www.morning.jrtjc.cn.gov.cn.jrtjc.cn http://www.morning.jjrsk.cn.gov.cn.jjrsk.cn http://www.morning.wrtw.cn.gov.cn.wrtw.cn http://www.morning.sjwiki.com.gov.cn.sjwiki.com http://www.morning.pbzlh.cn.gov.cn.pbzlh.cn http://www.morning.grjh.cn.gov.cn.grjh.cn http://www.morning.lfdrq.cn.gov.cn.lfdrq.cn http://www.morning.xtqr.cn.gov.cn.xtqr.cn http://www.morning.kqxng.cn.gov.cn.kqxng.cn http://www.morning.lmfmd.cn.gov.cn.lmfmd.cn http://www.morning.ndrzq.cn.gov.cn.ndrzq.cn http://www.morning.stph.cn.gov.cn.stph.cn http://www.morning.rhpy.cn.gov.cn.rhpy.cn http://www.morning.nhpmn.cn.gov.cn.nhpmn.cn http://www.morning.kdnrc.cn.gov.cn.kdnrc.cn http://www.morning.ntffl.cn.gov.cn.ntffl.cn