WinBatch® Technical Support Forum

Archived Boards => COM Automation and dotNet => Topic started by: sbanu on October 06, 2015, 10:32:37 AM

Title: OleInitiate: Initiate Failed - WRQ reflection for IBM
Post by: sbanu on October 06, 2015, 10:32:37 AM
Hello,
I am a newbie to winbatch. And iam trying to debug a winbatch program. This program was written to work with WRQ Reflection for IBM to get the OLEServerName. We are upgrading the WRQ Reflection for IBM to Attachmate Reflection 2014 and the winbatch program doesnt work.

I have added the debug trace and here is the output.

if (WRQ1 == 0) ;;&& !winexist(desiWin)  ;
(858) IF DO==>TRUE

WRQ1 = ObjectAccess('ReflectionIBM.Application',@FALSE)   ;
(889) GOSUB Error handler

WIL ERROR SUPPRESSED =>1129 (OleInitiate: Initiate Failed)

Error=LastError()
(889) VALUE INT => 1129

Message("LastError Value is",Error)
(8346) VALUE INT => 1

Message("wberrorhandlerline",wberrorhandlerline)
(32370) VALUE INT => 1

Message("wberrorhandleroffset",wberrorhandleroffset)
(34148) VALUE INT => 1

Message("wberrorhandlerassignment",wberrorhandlerassignment)
(38392) VALUE INT => 1

Message("wberrorhandlerfile", wberrorhandlerfile)
(45958) VALUE INT => 1

Message("wberrortextstring", wberrortextstring)
(50996) VALUE INT => 1

Message("wberroradditionalinfo", wberroradditionalinfo)
(52603) VALUE INT => 1

Message("wberrorinsegment", wberrorinsegment)
(53695) VALUE INT => 1

Message("wberrorhandlerlinenumber", wberrorhandlerlinenumber)
(58438) VALUE INT => 1

wrq1="eeek"
(58453) VALUE STRING => "eeek"

Return
(58453) RETURN VALUE INT => 0

end if
(58469) END OPERATOR

if WRQ1 <> 0  ;; so, an object exist (inside this IF block) ;
(58469) IF DO==>TRUE

while !Session1IDConfirmed                               ;; try, when not yet "glued", to do the following to a particular Reflection' session
(58484) WHILE==>TRUE

tOLEServerName = WRQ1.OLEServerName                ;
(149651) VALUE INT => 0

TERMINAL WIL ERROR=>3131 (OleExecute: Not a valid OLE object. Period may have been used in place of a comma.)

;;;END OF JOB;;;

---------- Begin structure stack dump ----------
  1 while              56 while @TRUE                      TDSWindowsWaiter.wbt
  2 for                58 for wrqix = 1 to WRQSessions     TDSWindowsWaiter.wbt
  3 if                 67 if winexist(targetWin) ;;&& !... TDSWindowsWaiter.wbt
  4 if                 76 if WRQ%wrqix% <> 0  ;; so, an... TDSWindowsWaiter.wbt
  5 while              78 while !Session%wrqix%IDConfir... TDSWindowsWaiter.wbt
-------- End structure stack dump --------

---------- Begin WWWBATCH.INI dump ----------
[COM & CLR Sub-system]
Function=CComObjectAg::MakeObject
ErrorCode=483 (0x800401E3)
ErrorDesc=Operation unavailable

Here is the code snippet
            if winexist(targetWin)                       
             if (WRQ%wrqix% == 0)                     
                   WRQ%wrqix% = ObjectAccess('ReflectionIBM.Application',@FALSE)   ;; create/use existing object id in WRQn
                 ;  message('session 2','confirmed')
                 end if

             if WRQ%wrqix% <> 0 
                while !Session%wrqix%IDConfirmed                               
                      tOLEServerName = WRQ%wrqix%.OLEServerName       


Looks like i am having issues with the below line.
WRQ%wrqix% = ObjectAccess('ReflectionIBM.Application',@FALSE)   ;;

Not sure if this needs to be changed to something else for Attachmate Reflection 2014.

Any pointers on where can i find info on the ObjectAccess funtion and how to use it with reflection.

I read in a different post that someone had issue with reflection when they upgraded to windows 7, but it turned out to be security issue. And there was not details on what was the security issue was.
http://forum.winbatch.com/index.php?topic=374.msg1572#msg1572

Any help is appreciated.
Title: Re: OleInitiate: Initiate Failed - WRQ reflection for IBM
Post by: td on October 06, 2015, 12:54:22 PM
Your problems have more to do with Reflection than WinBatch.  You will need to look at the COM Automation documentation from Attachmate to determine what you should be using as the progid parameter to your ObjectAccess function.   Attachmate makes it available here:

http://docs.attachmate.com/reflection/2014/r1/help/en/vba_guide/index.html#topic25.html (http://docs.attachmate.com/reflection/2014/r1/help/en/vba_guide/index.html#topic25.html)

or

http://docs.attachmate.com/reflection/2014/r1/help/en/vba_guide/index.html#topic24.html (http://docs.attachmate.com/reflection/2014/r1/help/en/vba_guide/index.html#topic24.html)

The ObjectAccess function has been superseded by the ObjectGet and ObjectCreate functions.  If you have a new enough version of WinBatch use them instead because it make it easier to translate VBS/VBA examples into WinBatch.  Also if your version is new enough,  you will also have the WIL TypeViewer that allows you to peruse installed COM Automation object on your computer.   Check your Consolidated WIL Help file for more information.

Also note that the security issue was (surprise surprise) UAC related as the topic suggests.  Basically, the script has to run at the same security level as the currently running object it's trying to access.
Title: Re: OleInitiate: Initiate Failed - WRQ reflection for IBM
Post by: sbanu on October 07, 2015, 08:56:06 AM
Thanks td for your time responding to this. i will look in to those documentation and try replacing ObjectAccess with ObjectCreate and ObjectGet.
Title: Re: OleInitiate: Initiate Failed - WRQ reflection for IBM
Post by: sbanu on October 08, 2015, 09:53:13 AM
I was able to get hold of the existign reflection session by replacing the below line for code

WRQ%wrqix% = ObjectAccess('ReflectionIBM.Application',@FALSE)

with this,

WRQ%wrqix% = ObjectGet(WRQKey)

(WRQKey in the above is the OLEServername of the reflection session)

Issue resolved.