COM: Access denied

Started by George Vagenas, December 20, 2014, 11:20:55 PM

Previous topic - Next topic

George Vagenas

I'm getting this error but I have no idea how to fix it.  My script is trying to access an IE document item.
Code (winbatch) Select
   prqDoc = prqIE.Document                                            ; Safety refresh.
   prqAll = prqDoc.All

   prqObj = prqAll.item(prqHdrNum)

The value in prqHdrNum is 100 and as usual with IE this used to work fine with version 8 but now throws an error in IE 11.
Thanks

George

....IFICantBYTE

Regards,
....IFICantBYTE

Nothing sucks more than that moment during an argument when you realize you're wrong. :)

George Vagenas

Deprecated but still supported is my understanding but its a moot point as I have revised my script to not use document.all. 
Which has led me to another problem, these lines work fine when stepping through the script in Studio:
Code (winbatch) Select
      prqType = prqDoc.getElementById("acctnum")
      if prqType==''
         pause('Error! in CUrAcct.wbt::GetTxs', 'Line #1056' : @lf : 'prqType = prqDoc.getElementById("acctnum")': @tab:'failed.')
         exit
      endif
      prqType.value = gAcctNo
     
      objEvent = prqDoc.createEvent("HTMLEvents")
      i = prqDoc.GetElementById("Continue")
      If objEvent == ""
         i.click
      Else
         objEvent.initEvent("click", @true, @true)
         i.dispatchEvent(objEvent)
      EndIf
     
; pause(`DEBUG PAUSE`, strCat(`gPwd = `, gPwd))   ;***DEBUG LINE***
breakpoint     
      prqType       = prqDoc.getElementById("pac")
      prqType.value = gPwd

I defined prqIE earlier in the script:
Code (winbatch) Select
   ; Script requires access to these MSIE objects.
   prqDoc = prqIE.Document

But when I run the script normally I get this error:
QuotewErrFile = GetTxs
wError = 3131
wErrStr = OleExecute: Not a valid OLE object. Period may have been used in place of a comma.
wErrLine = prqType.value = gPwd
wErrOffset = 970
wErrAssign =
Stumped as to why the last two lines now throw an error.
Thanks

George

td

Since scripts run much more slowly in the debugger, one possibility is a timing issue.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

George Vagenas

Yes, thanks! Silly me, I should have thought of that.  A liberal sprinkling of:
Code (winbatch) Select
   ieChk = IEWait4Page(prqIE)
fixed the problem.
Thanks

George

DAG_P6

Quote from: George Vagenas on December 23, 2014, 03:01:32 PM
Yes, thanks! Silly me, I should have thought of that.  A liberal sprinkling of:
Code (winbatch) Select
   ieChk = IEWait4Page(prqIE)
fixed the problem.

That's why Microsoft put DoEvents into every version of its Basic languages for Windows. Surely, C# has an analogue, although I haven't found or needed it, since the vast majority of the C# code that I've written to date is class libraries that manipulate data and console programs.

Write 100 times the following sentence. Most things in Windows are event driven. That includes Web browsers and most application windows.
David A. Gray
You are more important than any technology.