OLE 1129 errors when attempting to use an InProcess server
Keywords: OLE 1129
Question:
While running an evaluation of WinBatch for my company, ALLTEL, Inc., I have run into a problem with creating an OLE (COM) object using EXTRA! Personal Client. This failure gives an 1129 error even when EXTRA! is already open. The failing WinBatch statements are:; Open EXTRA! ver. 6.3 system object ErrorMode(@OFF) LastError() ExtraSystem = ObjectOpen("EXTRA.System") ;Failure occurs here with error code 1129 Error = LastError() ErrorMode(@ON) If(Error != 0)Then Message("Open Error","Failed to open Extra! system object. Error Code: %Error%") Exit EndIf ; Rest of script omitted for clarityYet I can open and control EXTRA! with VBScript and Delphi3. For instance, the following VBScript works fine (run against Windows Scripting Host):' VBScript - Test of Extra! OLE Interface dim ExtraSystem, ExtraSession Set ExtraSystem = CreateObject("EXTRA.System") if (ExtraSystem <> "EXTRA! Personal Client") then 'Do we have a valid Extra system object? MsgBox "Error trying to create Extra System object.", vbOKOnly + vbCritical, "Script Error" else Set ExtraSession = ExtraSystem.Sessions.Open("D:\Apps\Extra\Sessions\Session1.EDP") if(ExtraSession <> "Session1")then MsgBox "Failed to create session.", vbOKOnly + vbCritical, "Script Error" else ' ExtraSession.Visible = TRUE ExtraSession.Connected = TRUE MsgBox "Successful", vbOKOnly + vbInformation, "Session Open and Connected" ExtraSession.Connected = FALSE Set ExtraSession = Nothing end if ' Release the system object variable. Set ExtraSystem = Nothing end ifAnyone have any ideas?Answer:
Try ObjectAccess with app already running.And maybe try ObjectOpen with some other app (like Word or Netscape) to see if our OLE is working on your system at all.
Question (cont'd):
Can't get WinBatch to open Word or Excel. Same 1129 error.Answer:
Here's one script I've seen work, where you have a Word document called OLEWORD.DOC that contains the following text:Fee fie alpha doe fum
and you want to change "alpha" to "beta". Try this out:
;------------------------------ file = "C:\Incoming\Enroute to Tech Support\oleword.doc" oldtext = "alpha" newtext = "beta" ;------------------------------ App = ObjectOpen("Word.Application") Docs = App.Documents Doc = Docs.Open(file) Content = Doc.Content Find = Content.Find Find.Execute(:: FindText = oldtext, ReplaceWith = newtext, Replace = 2) Doc.Save() Doc.Close() App.Quit() ObjectClose(Find) ObjectClose(Content) ObjectClose(Doc) ObjectClose(Docs) ObjectClose(App) Message("Replace", "Done")Question:
I attempted the script almost verbatim (changing only the file directory to "D:\Temp\...".) and then created a simple test file with the word alpha in it. The script fails with an 1129 on the statementApp = ObjectOpen("Word.Application")I am using NT 4.0 with Service Pack 4, a PC with 128MB RAM, and a 200MHz Pentium Pro.I developed some very simple in-process and out-of-process test servers to test WinBatch with. I got WinBatch to work with a very simple out-of-process server but cannot get it to work with an equally simple in-process server (1129 again). Both test servers work with every other language I have tried (Delphi, MSVC++, and VBScript).
Answer:
Get the latest version of Winbatch, which has several OLE enhancements.And our developers suggested you try it on a different machine and see what happens.
Question:
I took it to a "clean" test PC that boots to Win95, Win98, and NT4 using System Commander. The failure is the same in all three operating systems: all in-process OLE servers fail.By the way, your script for Word failed because "Word.Application" is not valid for Word 7 - you have to use "Word.Basic" and then use WordBasic commands. No backward compatibility from Microsoft. So my status is that I can run Word, Excel, and any other out-of-process server but all in-process servers fail with error 1129. I can only test under the IDE since I have the trial version.
Answer:
OLE for inprocess servers added to list of improvements to add to Winbatch.We're hoping to get this out early next year (1999)...
Article ID: W13663Filename: OLE - Word and 1129 Errors with InProcess Server.txt