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
  • Thanks dph51 and vpt.se

    I looked in the Help files on, basic script (no topics found) script (no topics found) basic (no topics found)
    and the closest thing is connect, the tool bar at the bottom of the window on what gear is connected to.
    I may be spinning my wheels here.
    Looks like it’s time to send the Hex Help an e-mail.




    AL
Reply
  • Thanks dph51 and vpt.se

    I looked in the Help files on, basic script (no topics found) script (no topics found) basic (no topics found)
    and the closest thing is connect, the tool bar at the bottom of the window on what gear is connected to.
    I may be spinning my wheels here.
    Looks like it’s time to send the Hex Help an e-mail.




    AL
Children
No Data