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
  • Awesome! Thanks for the help. This is the code I went with.

    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
    Set DmisCommand = DmisCommands.CurrentCommand
    DmisCommands.InsertionPointAfter DmisCommand


    I wasn't sure if I would need the IF IsSet portion of the code though. Seems to work well without it. Is this a safety precaution for something? If the cursor isn't in the edit window?
Reply
  • Awesome! Thanks for the help. This is the code I went with.

    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
    Set DmisCommand = DmisCommands.CurrentCommand
    DmisCommands.InsertionPointAfter DmisCommand


    I wasn't sure if I would need the IF IsSet portion of the code though. Seems to work well without it. Is this a safety precaution for something? If the cursor isn't in the edit window?
Children