hexagon logo

Insert script at cursor location

I recently created some scripts from PC-DMIS program code that are attached to shortcuts. Once you click on the shortcut, it inserts commonly used codes to the end of the program. I would like it to insert the code wherever the cursor currently is. Is there a way to do this? This code is in the script...
DmisCommands.InsertionPointAfter DmisCommand

... and I'm assuming there is something I can do with this, I just don't know what it is. I searched the help file and tried to look on here and haven't found anything yet. Can anyone point me in the right direction?
Thanks again!
Parents
  • I recently created some scripts from PC-DMIS program code that are attached to shortcuts. Once you click on the shortcut, it inserts commonly used codes to the end of the program. I would like it to insert the code wherever the cursor currently is. Is there a way to do this? This code is in the script...
    DmisCommands.InsertionPointAfter DmisCommand

    ... and I'm assuming there is something I can do with this, I just don't know what it is. I searched the help file and tried to look on here and haven't found anything yet. Can anyone point me in the right direction?
    Thanks again!


    Here's a PcDmis script example for you...
    ' Created by: KP61dude!
    ' Create date: 02-03-2020
    ' What: Select command at cursor location.
    Sub Main()
    Dim oPcd As Object
    Dim oPart As Object
    Dim oEw As Object
    
    Set oPcd = CreateObject("PCDLRN.Application")
    Set oPart = oPcd.ActivePartProgram
    Set oEw = oPart.EditWindow
    
    If Not oEw Then
    GoTo exitsub
    End If
    
    ' select currect command
    oEw.SelectCommand
    
    ' clean up
    Set oPcd = Nothing
    Set oPart = Nothing
    Set oEw = Nothing
    exitsub:
    End Sub
    


    Here's another
    ' Created by: KP61dude!
    ' Create date: 01-31-2020
    ' What: Removes command at cursor location.
    Sub Main()
    Dim oPcd As Object
    Dim oPart As Object
    Dim oEw As Object
    
    Set oPcd = CreateObject("PCDLRN.Application")
    Set oPart = oPcd.ActivePartProgram
    Set oEw = oPart.EditWindow
    
    If Not oEw Then
    msgbox("failed")
    GoTo exitsub
    End If
    
    ' select currect command
    oEw.SelectCommand
    oEw.CutSelectedToClipboard
    
    ' clean up
    Set oPcd = Nothing
    Set oPart = Nothing
    Set oEw = Nothing
    
    exitsub:
    End Sub
    
Reply
  • I recently created some scripts from PC-DMIS program code that are attached to shortcuts. Once you click on the shortcut, it inserts commonly used codes to the end of the program. I would like it to insert the code wherever the cursor currently is. Is there a way to do this? This code is in the script...
    DmisCommands.InsertionPointAfter DmisCommand

    ... and I'm assuming there is something I can do with this, I just don't know what it is. I searched the help file and tried to look on here and haven't found anything yet. Can anyone point me in the right direction?
    Thanks again!


    Here's a PcDmis script example for you...
    ' Created by: KP61dude!
    ' Create date: 02-03-2020
    ' What: Select command at cursor location.
    Sub Main()
    Dim oPcd As Object
    Dim oPart As Object
    Dim oEw As Object
    
    Set oPcd = CreateObject("PCDLRN.Application")
    Set oPart = oPcd.ActivePartProgram
    Set oEw = oPart.EditWindow
    
    If Not oEw Then
    GoTo exitsub
    End If
    
    ' select currect command
    oEw.SelectCommand
    
    ' clean up
    Set oPcd = Nothing
    Set oPart = Nothing
    Set oEw = Nothing
    exitsub:
    End Sub
    


    Here's another
    ' Created by: KP61dude!
    ' Create date: 01-31-2020
    ' What: Removes command at cursor location.
    Sub Main()
    Dim oPcd As Object
    Dim oPart As Object
    Dim oEw As Object
    
    Set oPcd = CreateObject("PCDLRN.Application")
    Set oPart = oPcd.ActivePartProgram
    Set oEw = oPart.EditWindow
    
    If Not oEw Then
    msgbox("failed")
    GoTo exitsub
    End If
    
    ' select currect command
    oEw.SelectCommand
    oEw.CutSelectedToClipboard
    
    ' clean up
    Set oPcd = Nothing
    Set oPart = Nothing
    Set oEw = Nothing
    
    exitsub:
    End Sub
    
Children
No Data