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 feel like an idiot here. I've tried inputting the code into what I have and I get Type Mismatch error in line 10.

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


    I guess I'm confused as to where I put those lines of code.
Reply
  • I feel like an idiot here. I've tried inputting the code into what I have and I get Type Mismatch error in line 10.

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


    I guess I'm confused as to where I put those lines of code.
Children