hexagon logo

Custom Comment Script, upgraded

I have a version of this script hooked to a custom icon so with one-click I can run it and add comments quickly, or add canned (standadized) comments quickly.

Credit goes to Nate on the other forum.

I've modified it 10,000 times to suit my whims of whatever silly text character strings I like to add. My personal version has 13 different canned $$ comments.

One thing I noticed that could be construed as a bug:
If in your PC-DMIS program you have a $$ comment that you want to show on the report, you may toggle it from NO to YES.

However once you do that, any subsequent $$ comments you add with the BAS all default to YES display on the report.

So I fixed it.

Also new is a Form Feed checkbox to space your report out alot.

'Custom Comment Script
Sub Main()

Dim buttonval As Integer

Dim App As Object
Set App = CreateObject("PCDLRN.Application")

Dim Part As Object
Set Part = App.ActivePartProgram

Dim Cmds As Object
Set Cmds = Part.Commands

Dim PartProg As Object
Set PartProg = App.ActivePartProgram

Dim Cmd As Object

Begin Dialog DLG_REPORT_COMMENT 50, 32, 290, 300, "What Comments Do You Need?"


OKButton 225, 175, 50, 25



CheckBox 12, 10, 150, 8, "$$ THAT COMMENT YOU ALWAYS USE", .CheckBox1

CheckBox 205, 10, 60, 8, "FORM FEED", .CheckBox13


Text 12, 35, 120, 8, "Custom $$ Comment:"
TextBox 15, 45, 180, 12, .EditBox13
TextBox 15, 55, 180, 12, .EditBox14
TextBox 15, 65, 180, 12, .EditBox15

Text 12, 85, 125, 8, "Custom Report Comment:"
TextBox 15, 95, 180, 12, .EditBox1
TextBox 15, 105, 180, 12, .EditBox2
TextBox 15, 115, 180, 12, .EditBox3

Text 12, 135, 125, 8, "Custom Operator Comment:"
TextBox 15, 145, 180, 12, .EditBox23
TextBox 15, 155, 180, 12, .EditBox24
TextBox 15, 165, 180, 12, .EditBox25
TextBox 15, 175, 180, 12, .EditBox26
TextBox 15, 185, 180, 12, .EditBox27
TextBox 15, 195, 180, 12, .EditBox28

End Dialog

'-------------------------------------------------------------------------------------------------------

Dim dlg1 As DLG_REPORT_COMMENT
buttonval = Dialog(dlg1)
If button1 = 0 Then

Dim customstr1 As String
customstr1 = dlg1.EditBox1
Dim lenstr1 As Integer
lenstr1 = Len(dlg1.EditBox1)

Dim customstr2 As String
customstr2 = dlg1.EditBox2
Dim lenstr2 As Integer
lenstr2 = Len(dlg1.EditBox2)

Dim customstr3 As String
customstr3 = dlg1.EditBox3
Dim lenstr3 As Integer
lenstr3 = Len(dlg1.EditBox3)

'

Dim customstr13 As String
customstr13 = dlg1.EditBox13
Dim lenstr13 As Integer
lenstr13 = Len(dlg1.EditBox13)

Dim customstr14 As String
customstr14 = dlg1.EditBox14
Dim lenstr14 As Integer
lenstr14 = Len(dlg1.EditBox14)

Dim customstr15 As String
customstr15 = dlg1.EditBox15
Dim lenstr15 As Integer
lenstr15 = Len(dlg1.EditBox15)

'


Dim customstr23 As String
customstr23 = dlg1.EditBox23
Dim lenstr23 As Integer
lenstr23 = Len(dlg1.EditBox23)

Dim customstr24 As String
customstr24 = dlg1.EditBox24
Dim lenstr24 As Integer
lenstr24 = Len(dlg1.EditBox24)

Dim customstr25 As String
customstr25 = dlg1.EditBox25
Dim lenstr25 As Integer
lenstr25 = Len(dlg1.EditBox25)

Dim customstr26 As String
customstr26 = dlg1.EditBox26
Dim lenstr26 As Integer
lenstr26 = Len(dlg1.EditBox26)

Dim customstr27 As String
customstr27 = dlg1.EditBox27
Dim lenstr27 As Integer
lenstr27 = Len(dlg1.EditBox27)

Dim customstr28 As String
customstr28 = dlg1.EditBox28
Dim lenstr28 As Integer
lenstr28 = Len(dlg1.EditBox28)

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


If dlg1.CheckBox1 = 1 Then
Set Cmd = Cmds.Add(SET_COMMENT, True)
retvaltype = Cmd.PutText("$$", COMMENT_TYPE, 0)
retvaltype = Cmd.SetToggleString (1, OUTPUT_TYPE, 0)
If dlg1.CheckBox1 = 1 Then
retvaltype = Cmd.PutText("THAT COMMENT YOU ALWAYS USE", COMMENT_FIELD, 1)
End If
Cmd.ReDraw
End If


If dlg1.CheckBox13 = 1 Then
Set Cmd = Cmds.Add(PRINT_FORM_FEED, TRUE)
End If


'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If lenstr1 > 0 Then
Set Cmd = Cmds.Add(SET_COMMENT, True)
retvaltype = Cmd.PutText("REPT", COMMENT_TYPE, 0)
retvaltype = Cmd.PutText(customstr1, COMMENT_FIELD, 1)
If lenstr2 > 0 Then
retvaltype = Cmd.PutText(customstr2, COMMENT_FIELD, 2)
End If
If lenstr3 > 0 Then
retvaltype = Cmd.PutText(customstr3, COMMENT_FIELD, 3)
End If
Cmd.ReDraw
End If

If lenstr13 > 0 Then
Set Cmd = Cmds.Add(SET_COMMENT, True)
retvaltype = Cmd.PutText("$$", COMMENT_TYPE, 0)
retvaltype = Cmd.SetToggleString (1, OUTPUT_TYPE, 0)
retvaltype = Cmd.PutText(customstr13, COMMENT_FIELD, 1)
If lenstr14 > 0 Then
retvaltype = Cmd.PutText(customstr14, COMMENT_FIELD, 2)
End If
If lenstr15 > 0 Then
retvaltype = Cmd.PutText(customstr15, COMMENT_FIELD, 3)
End If
Cmd.ReDraw
End If


If lenstr23 > 0 Then
Set Cmd = Cmds.Add(SET_COMMENT, True)
retvaltype = Cmd.PutText("OPER", COMMENT_TYPE, 0)
retvaltype = Cmd.PutText(customstr23, COMMENT_FIELD, 1)
If lenstr24 > 0 Then
retvaltype = Cmd.PutText(customstr24, COMMENT_FIELD, 2)
End If
If lenstr25 > 0 Then
retvaltype = Cmd.PutText(customstr25, COMMENT_FIELD, 3)
End If
If lenstr26 > 0 Then
retvaltype = Cmd.PutText(customstr26, COMMENT_FIELD, 4)
End If
If lenstr27 > 0 Then
retvaltype = Cmd.PutText(customstr27, COMMENT_FIELD, 5)
End If
If lenstr28 > 0 Then
retvaltype = Cmd.PutText(customstr28, COMMENT_FIELD, 6)
End If
Cmd.ReDraw
End If

End If
End Sub





To add a script to a custom icon:
Right-click on toolbar area
Select customize

On left-most tab "Menu", click on Create Item
Use the ... button to navigate to where the BAS is stored
It won't show up - you gotta toggle the Files Of Type to Basic Script
Choose it
Now there's a Change Icon buton too, google free icons there's a bazillion out there.

Now go to Toolbars tab
There click on New then Toolbar
Now you can Add your new Item to your new toolbar from the bottom-most User Defined Commands.

Done.

Profit.
Parents
  • I did a total revamp, adding some new bells and whistles and cleaning up the layout.
    Had to chop this up into several posts, 10k character limit slays me.
    '______________________ CUSTOM COMMENTS ___________________________________________________________
    '                v8, Josh Carpenter April 3013
    'TOTALLY FREE OPEN SOURCE CODE NO TRADEMARK OR COPYRIGHT WHATSOEVER
    'NO WARRANTY OR GUARANTEE IMPLIED OR SPECIFIED
    'ONLY FOR USE WITH PC-DMIS SOFTWARE copyright Wilcox Associates
    
    'Version 8 addes the ability to create and use one new 'canned' comment.
    ' It requires system permission to write a text file to C:\TEMP
    ' Only one new canned comment is possible, and will be overwritten
    ' by selecting "make this a New Canned Comment" checkbox.
     
    Sub Main()
    Dim buttonval As Integer
    Dim App As Object
    Set App = CreateObject("PCDLRN.Application")
    Dim Part As Object
    Set Part = App.ActivePartProgram
    Dim Cmds As Object
    Set Cmds = Part.Commands
    Dim PartProg As Object
    Set PartProg = App.ActivePartProgram
    Dim Cmd As Object
    
    Begin Dialog DLG_REPORT_COMMENT 50, 32, 415, 350, "What Comments Do You Need?"
    
    CheckBox 10, 7, 40, 8, "$$ <>", .CheckBox1
    CheckBox 50, 7, 40, 8, "$$ |", .CheckBoX8
    CheckBox 90, 7, 50, 8, "$$ - - - - -", .CheckBox5
    CheckBox 150, 7, 40, 8, "$$ /\/\/\", .CheckBox14
    
    CheckBox 10, 35, 50, 8, "$$ \\\ Slope", .CheckBox2
    CheckBox 10, 48, 50, 8, "$$ /// Slope", .CheckBox3
    
    CheckBox 80, 35, 50, 8, "$$ ||| Slope", .CheckBox9
    CheckBox 80, 48, 50, 8, "$$ ||| Slope", .CheckBox10
    
    CheckBox 150, 35, 50, 8, "$$ >>>>>", .CheckBox6
    CheckBox 150, 48, 50, 8, "$$ <<<<<", .CheckBox7
    
    CheckBox 130, 65, 30, 8, "$$ \ ", .CheckBox15
      Text   140, 73, 27, 8, "     /"
    
    CheckBox 170, 65, 40, 8, "$$ / ", .CheckBox16
      Text   180, 73, 27, 8, "     \"
    
    CheckBox 130, 90, 30, 8, "$$ \\\", .CheckBox19
        Text 150, 98, 20, 8, "///"
        Text 150, 106, 20, 8, "\\\"
    
    CheckBox 170, 90, 40, 8, "$$ ///", .CheckBox20
        Text 190, 98, 20, 8, "\\\"
        Text 190, 106, 20, 8, "///"
    
    CheckBox 150, 21, 50, 8, "$$ ~", .CheckBox17
    
    CheckBox 10, 21, 100, 8, "$$ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", .CheckBox18
    
    CheckBox 10, 65, 105, 8, "$$ !!! WARNING MOVE ALL !!!", .CheckBox11
    
    CheckBox 10, 78, 115, 8, "$$ _-_-_- PROBE CHANGE -_-_-_", .CheckBox12
    
    CheckBox 10, 92, 100, 8, "$$ ||| DIMENSIONS |||", .CheckBox4
    
    
    
    GroupBox 208, 3, 195,190
    GroupBox 206, 1, 199,194
    GroupBox 208, 3, 84,20
        Text 212, 10, 70, 8, "Custom $$ Comment:"
    CheckBox 320, 15, 70, 8, "NOTE:", .CheckBox7071
    CheckBox 212, 25, 135, 8, "$$ - - - - Program Revision Record - - - -", .CheckBoxE36
    Text     222, 35, 50, 8, "Created by:"
    TextBox 265, 35, 100, 10, .EditBoxE36
    CheckBox 212, 50, 145, 8, "$$ - - - - SETUP INSTRUCTIONS - - - -", .CheckBoxE46
    TextBox 215, 65, 180, 12, .EditBox13
    TextBox 215, 75, 180, 12, .EditBox14
    TextBox 215, 85, 180, 12, .EditBox15
    TextBox 215, 95, 180, 12, .EditBox16
    TextBox 215, 105, 180, 12, .EditBox17
    TextBox 215, 115, 180, 12, .EditBox18
    TextBox 215, 125, 180, 12, .EditBox19
    TextBox 215, 135, 180, 12, .EditBox20
    TextBox 215, 145, 180, 12, .EditBox21
    CheckBox 220, 165, 150, 8, "Make this a New Canned Comment", .CheckBox7072
    CheckBox 230, 180, 160, 8, "Use previously created New Canned Comment", .CheckBox7073
    
    
    GroupBox 8, 138,190,130
    GroupBox 6, 136,194,134
    GroupBox 8, 138, 70,20
    Text    12, 145, 65, 8, "Operator Comment:"
    CheckBox 90, 148, 70, 8, "CLICK OK, THEN...", .CheckBox2327
    TextBox 15, 160, 180, 12, .EditBox23
    TextBox 15, 170, 180, 12, .EditBox24
    TextBox 15, 180, 180, 12, .EditBox25
    TextBox 15, 190, 180, 12, .EditBox26
    TextBox 15, 200, 180, 12, .EditBox27
    TextBox 15, 210, 180, 12, .EditBox28
    CheckBox 120, 223, 70, 8, "... THEN CLICK OK", .CheckBox2328
     GroupBox 8,233,190,35
    CheckBox 20, 240, 65, 8, "Yes/No Question", .CheckBox2329
    CheckBox 120, 240, 65, 8, "Operator Input", .CheckBox2330
        Text 20, 252, 70, 8, "Required ID:"
    TextBox 70, 250, 80, 12, .EditBox29
    
    
    
    GroupBox 206, 206,199,124
    GroupBox 208, 208,195,120
    GroupBox 208, 208, 90,20
       Text 212, 215, 85, 8, "Custom Report Comment:"
       Text 320, 220, 80, 8, "Special Chars Brackets"
    Textbox 330, 230, 65, 8, .EditBox95
    CheckBox 220, 230, 80, 8, "SPACE LINE BEFORE", .CheckBox9193
     TextBox 215, 240, 180, 12, .EditBox91
     TextBox 215, 250, 180, 12, .EditBox92
     TextBox 215, 260, 180, 12, .EditBox93
    CheckBox 220, 275, 80, 8, "SPACE LINE AFTER", .CheckBox9194
    CheckBox 320, 275, 80, 8, "1-LINE BLANK", .CheckBox9195
    
         Text 215, 290, 50, 10, "Page #:"
      Textbox 245, 290, 40, 10, .Editbox202
    CheckBox 305, 290, 60, 8, "FORM FEED", .CheckBox133
         Text 230, 300, 140, 10, "View/Section/Detail:"
      Textbox 245, 310, 110, 10, .Editbox201
    
    
    
      GroupBox 13,296,88,38
      GroupBox 15,298,84,34
      GroupBox 17,300,80,30
          Text 22, 305, 70, 10, "# of Times to Repeat:"
       Textbox 45, 315, 20, 10, .Editbox650
    
    
    OKButton 135, 305, 50, 25
    
    End Dialog
    
    
    
    
    
    '-------------------------------------------------------------------------------------------------------
    ' Begin Actions Based on Inputs
    '-------------------------------------------------------------------------------------------------------
    
    Dim dlg1 As DLG_REPORT_COMMENT
    buttonval = Dialog(dlg1)
    
    
    Dim Repeater as Integer
    Repeater = dlg1.EditBox650
    
    Dim LR As Integer
    LR = Len(dlg1.EditBox650)
    
    If LR > 0 Then
    Repeater = dlg1.EditBox650
    End If
    
    If LR = 0 Then
    Repeater = 1
    End If
    
    
    '---------------------- LOOP FOR # OF TIMES TO REPEAT OPTION -------------------
    Do While Repeater > 0
    
    
    
    
    
    
    
Reply
  • I did a total revamp, adding some new bells and whistles and cleaning up the layout.
    Had to chop this up into several posts, 10k character limit slays me.
    '______________________ CUSTOM COMMENTS ___________________________________________________________
    '                v8, Josh Carpenter April 3013
    'TOTALLY FREE OPEN SOURCE CODE NO TRADEMARK OR COPYRIGHT WHATSOEVER
    'NO WARRANTY OR GUARANTEE IMPLIED OR SPECIFIED
    'ONLY FOR USE WITH PC-DMIS SOFTWARE copyright Wilcox Associates
    
    'Version 8 addes the ability to create and use one new 'canned' comment.
    ' It requires system permission to write a text file to C:\TEMP
    ' Only one new canned comment is possible, and will be overwritten
    ' by selecting "make this a New Canned Comment" checkbox.
     
    Sub Main()
    Dim buttonval As Integer
    Dim App As Object
    Set App = CreateObject("PCDLRN.Application")
    Dim Part As Object
    Set Part = App.ActivePartProgram
    Dim Cmds As Object
    Set Cmds = Part.Commands
    Dim PartProg As Object
    Set PartProg = App.ActivePartProgram
    Dim Cmd As Object
    
    Begin Dialog DLG_REPORT_COMMENT 50, 32, 415, 350, "What Comments Do You Need?"
    
    CheckBox 10, 7, 40, 8, "$$ <>", .CheckBox1
    CheckBox 50, 7, 40, 8, "$$ |", .CheckBoX8
    CheckBox 90, 7, 50, 8, "$$ - - - - -", .CheckBox5
    CheckBox 150, 7, 40, 8, "$$ /\/\/\", .CheckBox14
    
    CheckBox 10, 35, 50, 8, "$$ \\\ Slope", .CheckBox2
    CheckBox 10, 48, 50, 8, "$$ /// Slope", .CheckBox3
    
    CheckBox 80, 35, 50, 8, "$$ ||| Slope", .CheckBox9
    CheckBox 80, 48, 50, 8, "$$ ||| Slope", .CheckBox10
    
    CheckBox 150, 35, 50, 8, "$$ >>>>>", .CheckBox6
    CheckBox 150, 48, 50, 8, "$$ <<<<<", .CheckBox7
    
    CheckBox 130, 65, 30, 8, "$$ \ ", .CheckBox15
      Text   140, 73, 27, 8, "     /"
    
    CheckBox 170, 65, 40, 8, "$$ / ", .CheckBox16
      Text   180, 73, 27, 8, "     \"
    
    CheckBox 130, 90, 30, 8, "$$ \\\", .CheckBox19
        Text 150, 98, 20, 8, "///"
        Text 150, 106, 20, 8, "\\\"
    
    CheckBox 170, 90, 40, 8, "$$ ///", .CheckBox20
        Text 190, 98, 20, 8, "\\\"
        Text 190, 106, 20, 8, "///"
    
    CheckBox 150, 21, 50, 8, "$$ ~", .CheckBox17
    
    CheckBox 10, 21, 100, 8, "$$ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", .CheckBox18
    
    CheckBox 10, 65, 105, 8, "$$ !!! WARNING MOVE ALL !!!", .CheckBox11
    
    CheckBox 10, 78, 115, 8, "$$ _-_-_- PROBE CHANGE -_-_-_", .CheckBox12
    
    CheckBox 10, 92, 100, 8, "$$ ||| DIMENSIONS |||", .CheckBox4
    
    
    
    GroupBox 208, 3, 195,190
    GroupBox 206, 1, 199,194
    GroupBox 208, 3, 84,20
        Text 212, 10, 70, 8, "Custom $$ Comment:"
    CheckBox 320, 15, 70, 8, "NOTE:", .CheckBox7071
    CheckBox 212, 25, 135, 8, "$$ - - - - Program Revision Record - - - -", .CheckBoxE36
    Text     222, 35, 50, 8, "Created by:"
    TextBox 265, 35, 100, 10, .EditBoxE36
    CheckBox 212, 50, 145, 8, "$$ - - - - SETUP INSTRUCTIONS - - - -", .CheckBoxE46
    TextBox 215, 65, 180, 12, .EditBox13
    TextBox 215, 75, 180, 12, .EditBox14
    TextBox 215, 85, 180, 12, .EditBox15
    TextBox 215, 95, 180, 12, .EditBox16
    TextBox 215, 105, 180, 12, .EditBox17
    TextBox 215, 115, 180, 12, .EditBox18
    TextBox 215, 125, 180, 12, .EditBox19
    TextBox 215, 135, 180, 12, .EditBox20
    TextBox 215, 145, 180, 12, .EditBox21
    CheckBox 220, 165, 150, 8, "Make this a New Canned Comment", .CheckBox7072
    CheckBox 230, 180, 160, 8, "Use previously created New Canned Comment", .CheckBox7073
    
    
    GroupBox 8, 138,190,130
    GroupBox 6, 136,194,134
    GroupBox 8, 138, 70,20
    Text    12, 145, 65, 8, "Operator Comment:"
    CheckBox 90, 148, 70, 8, "CLICK OK, THEN...", .CheckBox2327
    TextBox 15, 160, 180, 12, .EditBox23
    TextBox 15, 170, 180, 12, .EditBox24
    TextBox 15, 180, 180, 12, .EditBox25
    TextBox 15, 190, 180, 12, .EditBox26
    TextBox 15, 200, 180, 12, .EditBox27
    TextBox 15, 210, 180, 12, .EditBox28
    CheckBox 120, 223, 70, 8, "... THEN CLICK OK", .CheckBox2328
     GroupBox 8,233,190,35
    CheckBox 20, 240, 65, 8, "Yes/No Question", .CheckBox2329
    CheckBox 120, 240, 65, 8, "Operator Input", .CheckBox2330
        Text 20, 252, 70, 8, "Required ID:"
    TextBox 70, 250, 80, 12, .EditBox29
    
    
    
    GroupBox 206, 206,199,124
    GroupBox 208, 208,195,120
    GroupBox 208, 208, 90,20
       Text 212, 215, 85, 8, "Custom Report Comment:"
       Text 320, 220, 80, 8, "Special Chars Brackets"
    Textbox 330, 230, 65, 8, .EditBox95
    CheckBox 220, 230, 80, 8, "SPACE LINE BEFORE", .CheckBox9193
     TextBox 215, 240, 180, 12, .EditBox91
     TextBox 215, 250, 180, 12, .EditBox92
     TextBox 215, 260, 180, 12, .EditBox93
    CheckBox 220, 275, 80, 8, "SPACE LINE AFTER", .CheckBox9194
    CheckBox 320, 275, 80, 8, "1-LINE BLANK", .CheckBox9195
    
         Text 215, 290, 50, 10, "Page #:"
      Textbox 245, 290, 40, 10, .Editbox202
    CheckBox 305, 290, 60, 8, "FORM FEED", .CheckBox133
         Text 230, 300, 140, 10, "View/Section/Detail:"
      Textbox 245, 310, 110, 10, .Editbox201
    
    
    
      GroupBox 13,296,88,38
      GroupBox 15,298,84,34
      GroupBox 17,300,80,30
          Text 22, 305, 70, 10, "# of Times to Repeat:"
       Textbox 45, 315, 20, 10, .Editbox650
    
    
    OKButton 135, 305, 50, 25
    
    End Dialog
    
    
    
    
    
    '-------------------------------------------------------------------------------------------------------
    ' Begin Actions Based on Inputs
    '-------------------------------------------------------------------------------------------------------
    
    Dim dlg1 As DLG_REPORT_COMMENT
    buttonval = Dialog(dlg1)
    
    
    Dim Repeater as Integer
    Repeater = dlg1.EditBox650
    
    Dim LR As Integer
    LR = Len(dlg1.EditBox650)
    
    If LR > 0 Then
    Repeater = dlg1.EditBox650
    End If
    
    If LR = 0 Then
    Repeater = 1
    End If
    
    
    '---------------------- LOOP FOR # OF TIMES TO REPEAT OPTION -------------------
    Do While Repeater > 0
    
    
    
    
    
    
    
Children
No Data