System Name Utility

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • System Name Utility

    A question came up yesterday, I thought I'd share the solution. A customer has several systems with PC-DMIS, and runs the same programs on all. One of these has a network issue, which requires some operator intervention before proceeding. They wanted a way to alert the operator, but only on this particular system. We came up with a short exercise which identified the name of the system, and if it were the one in question, displayed a message to the operator. Here is how we did it.

    We wrote a short DOS batch file with the following command -

    IPCONFIG /ALL > JUNK.TXT

    and we called this file "GET_NAME.BAT" and placed it in the PC-DMIS install folder. Then we added these commands to the top of the program (note that the 1st line is 'wrapped') -

    EXTERNALCOMMAND/NO_DISPLAY, WAIT ; C:\PCDMISW_V37B\GET_NAME.BAT
    FPTR =FILE/OPEN,JUNK.TXT,READ
    V1 =FILE/READLINE,FPTR,{T1}
    V2 =FILE/READLINE,FPTR,{T2}
    V3 =FILE/READLINE,FPTR,{T3}
    V4 =FILE/READLINE,FPTR,{T4}
    COMMENT/OPER,NO,T4
    ASSIGN/V5 = INDEX(T4,"CMM2")
    COMMENT/OPER,NO,V5
    IF/V5
    COMMENT/OPER,NO,Check the network please
    END_IF/


    The program runs the batch file, which displays a load of information and re-directs the output into a text file called "JUNK.TXT". The only thing we want out of this text file is on the 4th line, se we read and ignore the 1st 3 lines. On the 4th line, we read it and then check for the existence of the string "CMM2". This 4th line might have had something like the following -

    Host Name . . . . . . . . . . . . : Desktop_CMM2PC_AJD

    but we only need to determine that it contains any unique character set which will identify it as the one we are searching for.

    With this, we were able to make use of an EXTERNAL command and a few FILE I/O commands to achieve what this customer wanted. I doubt that many people will be able to use this utility as-is, but I decided to post it here as an example to stir people into thinking about what else they can write to make their jobs a little easier.

  • #2
    DANG!
    sigpic
    Originally posted by AndersI
    I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

    Comment


    • #3
      If all you want is the 4th line of text you should be able to do a file/readline,fptr four times. You do not need to assign a variable to the first three, only the fourth. You could also loop it. Just my $0.02
      <internet bumper sticker goes here>

      Comment


      • #4
        Not the only way. . . .

        Those are good points. I'm sure there are more efficient ways to do this. We had just thrown it together quickly to solve this guys problem, and some of the stuff you see in is remnant from our debugging/devlopment efforts. We were displaying each line as we read it to make sure we got the right line.

        I was originally tempted to start writing a VB program, but then I figured that PC-DMIS should be able to handle it, so I gave it a shot and it worked fine.

        Comment


        • #5
          Absolutely, nice job. There is always more than one way to skin a cat.
          <internet bumper sticker goes here>

          Comment


          • #6
            Shows what's important here

            Monty Python - 52 and counting

            Don - 4, 1 of which is my own

            We know what people consider valuable on this board

            Comment


            • #7
              Hers one more Don, because I like you. Never mind 3 of them are me.
              <internet bumper sticker goes here>

              Comment


              • #8
                Thanks

                I think I get negative points for having a guy picking his nose in response to my post.

                Comment


                • #9
                  Sheez you guys are cynical. I didn't post anything because its' out of my league to respond.


                  But, I did make the thread printable and put it into my DMIS FORUM scrap book right next to my directions for the south african shim sham sand dance(Mel Brooks History of the world I believe, Gregory Hines as the slave?).
                  Sorru all the good Monty Python stuff was used.
                  Last edited by JamesMannes; 05-03-2006, 09:45 PM.
                  sigpic

                  James Mannes

                  Comment


                  • #10
                    That avitar is evil. Eeeeeeeeeeeeeeee-vile. I love it! I absolutely love it! Now everyone say "Thank you Tom Miller" for turning us on to the animation thing (what a great idea Tom, what would I be without you?).
                    <internet bumper sticker goes here>

                    Comment


                    • #11
                      Thank you. And "Thank You Tom Miller!!".
                      sigpic

                      James Mannes

                      Comment


                      • #12
                        Get them collections together ....b4 trail runs out
                        sigpic
                        if you had soap on a rope it would be tied to yer ankle

                        Comment


                        • #13
                          I would of gotten the IT dept. to fix the network issue. But that solution sounds great! Good job.
                          I used to be high on life but I built up a tolerance.

                          Brown & Sharpe Global Advantage
                          PCDMIS CAD++ v2011mr2
                          PH10MQ/SP600M


                          sigpic

                          Comment


                          • #14
                            Just a post to get one in too!~

                            Gabriel
                            sigpic

                            Comment


                            • #15
                              Originally posted by Cumofo
                              Just a post to get one in too!~

                              Gabriel
                              And he is a non-nose-picker too!
                              <internet bumper sticker goes here>

                              Comment

                              Related Topics

                              Collapse

                              Working...
                              X
                              😀
                              🥰
                              🤢
                              😎
                              😡
                              👍
                              👎