Subroutines

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Subroutines

    Is it possible to create a subroutine for frequently used comments & operator input? For example, each time I create a new program I add these four input comments.

    COMMENT1 =COMMENT/INPUT,YES,'OPERATOR'
    COMMENT2 =COMMENT/INPUT,YES,'P.O.#'
    COMMENT3 =COMMENT/INPUT,YES,'SEQ#'
    COMMENT4 =COMMENT/INPUT,YES,'CUSTOMER'

    The help files in V3.7 on subroutines is about as clear as mud to me. No good examples. I don't believe a comment is considered to be an argument.

    Thanks to anyone who responds.

  • #2
    I know nothing about subroutines.

    What I did though was create a 'template' program. The beginning of the program has comments and pictures and such. When I want a new program, I open the template, do a save-as, modify anything in it that needs to be changed, and program from there. I also made the template read-only so that I don't accidentally change it and save it.

    Comment


    • #3
      I don't really know about subroutines but, I have a builder program. It containns things such as your list plus highly used routines as well as those that I tend to forget. I create a new program and then open my builder program do a copy colse it and paste. Sounds like a pain but it's not really. And works really well.

      Comment


      • #4
        WOW; great minds....

        Comment


        • #5
          I've been doing the same sort of thing and it is a pain. It would be nice if you could use a word or notepad doc to cut & paste from.

          Comment


          • #6
            Originally posted by Tested View Post
            I don't really know about subroutines but, I have a builder program. It containns things such as your list plus highly used routines as well as those that I tend to forget. I create a new program and then open my builder program do a copy colse it and paste. Sounds like a pain but it's not really. And works really well.
            You know you can leave the "builder" program open. If you just go to window a the top you can switch from one program to the other. Just make sure the "builder" program is opened second as it will be offline and your new one online.

            Comment


            • #7
              I also use a “template” program with all the duplicate information required in each of our programs and it works well for our needs. Never had much luck using subroutines because our programs are used at other sister plants and some of them do not use subroutines and have trouble getting them to run.

              If anyone has a method they use for their subroutines in programs that are used at other site I would be interested in this information.

              Kevin
              B & S XCEL 7-10-7
              Sharpe32 Controller
              PH10MQ & ACR1 Toolchanger
              TP20 & TP2 Probes
              Pcdmis CAD++ 3.7mr3, 4.3mr1, 2009mr1, 2010mr1
              Datapage RT 3.33
              sigpic

              Comment


              • #8
                This is another place where a true programable HOT KEY would be so nice. You could create a new program and hot key in your custom "what ever".

                Comment


                • #9
                  Here's a VB solution. Simply paste this into the VB Editor in PC-DMIS and test it out. When you have it how you like it, save it as a .BAS file. You can then tie that .BAS file into a toolbar icon, shortcut key and so forth:

                  Code:
                  Sub Main
                  
                    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 Cmd As Object
                    Dim lngCommentType As Long
                  
                  ' Script that inserts these initial comments:
                  'COMMENT =COMMENT/Input,YES,'OPERATOR'
                  'COMMENT =COMMENT/Input,YES,'P.O.#'
                  'COMMENT =COMMENT/Input,YES,'SEQ#'
                  'COMMENT =COMMENT/Input,YES,'CUSTOMER'
                  
                  ' Sets the comment Type To an Input comment
                      lngCommentType = 3
                  
                  
                  ' This statement adds the initial comment For OPERATOR
                      Set Cmd = Cmds.Add(SET_COMMENT, True)
                  ' This statement changes the comment Type To lngCommentType
                      Cmd.SetToggleString lngCommentType, COMMENT_TYPE, 0
                  ' This statement displays the comment text.
                      Cmd.PutText "OPERATOR:", COMMENT_FIELD, 1
                  
                  ' This statement adds the initial comment For P.O#
                      Set Cmd = Cmds.Add(SET_COMMENT, True)
                  ' This statement changes the comment Type To lngCommentType
                      Cmd.SetToggleString lngCommentType, COMMENT_TYPE, 0
                  ' This statement displays the comment text.
                      Cmd.PutText "P.O#:", COMMENT_FIELD, 1
                  
                  ' This statement adds the initial comment For SEQ#
                      Set Cmd = Cmds.Add(SET_COMMENT, True)
                  ' This statement changes the comment Type To lngCommentType
                      Cmd.SetToggleString lngCommentType, COMMENT_TYPE,0
                  ' This statement displays the comment text.
                      Cmd.PutText "SEQ#:", COMMENT_FIELD,1
                  
                  ' This statement adds the initial comment For CUSTOMER#
                      Set Cmd = Cmds.Add(SET_COMMENT, True)
                  ' This statement changes the comment Type To lngCommentType
                      Cmd.SetToggleString lngCommentType, COMMENT_TYPE, 0
                  ' This statement displays the comment text.
                      Cmd.PutText "CUSTOMER:", COMMENT_FIELD, 1
                  
                  
                  ' Redraw the Edit window
                      part.refreshpart
                  
                  End Sub
                  Enjoy,
                  Jared Hess - Techwriter @ WAI
                  [View 2008 Reporting Tutorials Here]

                  Comment

                  Related Topics

                  Collapse

                  Working...
                  X