hexagon logo

Need help with scripting

This is my first attempt at script so please be kind.
What I want to do is to see what active part program Pc Gear has opened.
I have found a way to do this in Dmis but cannot find the gear application.
When I try I get - runtime error on line 9 – OLE automation server cannot create object.
I have tried Gear.application, PcDmisGear.application, Pc-dmis gear.application.
I looked at the windows task manager for its description with no help.
What I have

[B]Sub[/B][B] main[/B]
[B]  'Delare variable[/B]
[B]     Dim strFileName As String    [/B]
[B]     Dim ObjApp As Object[/B]
[B]     Dim ObjPart As Object[/B]
[B]     Dim StrDimID As String[/B]
 
  [B]' Line works For PC Dmis         Set ObjApp = CreateObject("pcdlrn.application")[/B]
[B]     Set ObjApp = CreateObject("[/B]Pc-dmis gear.application[B]")[/B]
[B]     Set ObjPart = ObjApp.ActivePartProgram         [/B]
  
[B]   'Build And assign file Name[/B]
[B]     strFileName = "C:\PCD output.txt"[/B]
[B]     Open strFileName For Output As #1[/B]
[B]              StrDimID = ObjPart [/B]
 
[B]   'Remove .prg [/B]
[B]   If len(StrDimID)>0 Then   [/B]
[B]        StrDimID = mid(StrDimID,1,len(StrDimID)-4)    [/B]
[B]   End If [/B]
 
[B]   'Write To file And save[/B]
[B]     Write #1, StrDimID[/B]
[B]            Close #1[/B]
[B]     MsgBox("File save complete")[/B]
[B]End[/B][B] Sub[/B]

I repeat my first attempt and what I have I picked up from everyone here and some help files.
The other would be PC Gear and Basic script is not compatible.
I do not have a script editor so any ideas would be helpful.

AL
Parents
  • PCDLRN.EXE is the executable file name.


      [B]' Line works For PC Dmis         Set ObjApp = CreateObject("pcdlrn.application")[/B]
    


    I think,(sometimes not too clearly), that you should be able to look up the executable file for the gear program and then substitute it into that line of code.

    I am not an expert on scripting, but I muddle along.

    hope this is helpful.
Reply
  • PCDLRN.EXE is the executable file name.


      [B]' Line works For PC Dmis         Set ObjApp = CreateObject("pcdlrn.application")[/B]
    


    I think,(sometimes not too clearly), that you should be able to look up the executable file for the gear program and then substitute it into that line of code.

    I am not an expert on scripting, but I muddle along.

    hope this is helpful.
Children
No Data