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'm trying to figure out how to get this to work with the current code that I have. This is the full code..

    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim DmisCommands As Object
    Dim DmisCommand As Object
    
    Sub Part1
    Set DmisApp = CreateObject("PCDLRN.Application")
    Set DmisPart = DmisApp.ActivePartProgram
    Set DmisCommands = DmisPart.Commands
    CommandCount = DmisCommands.Count
    Set DmisCommand = DmisCommands.Item(CommandCount)
    DmisCommands.InsertionPointAfter DmisCommand


    I'm assuming the code I would need to input from yours is..

    Dim oEw As Object
    Set oEw = DmisPart.EditWindow
    oEw.SelectCommand
    


    ...edited so the objects match what I already have. Does the oEw.SelectCommand line return where the cursor currently is in the program?
Reply
  • I'm trying to figure out how to get this to work with the current code that I have. This is the full code..

    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim DmisCommands As Object
    Dim DmisCommand As Object
    
    Sub Part1
    Set DmisApp = CreateObject("PCDLRN.Application")
    Set DmisPart = DmisApp.ActivePartProgram
    Set DmisCommands = DmisPart.Commands
    CommandCount = DmisCommands.Count
    Set DmisCommand = DmisCommands.Item(CommandCount)
    DmisCommands.InsertionPointAfter DmisCommand


    I'm assuming the code I would need to input from yours is..

    Dim oEw As Object
    Set oEw = DmisPart.EditWindow
    oEw.SelectCommand
    


    ...edited so the objects match what I already have. Does the oEw.SelectCommand line return where the cursor currently is in the program?
Children
No Data