Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: get the sum of %errorlevel% at the end of a subroutine.  (Read 11930 times)

0 Members and 1 Guest are viewing this topic.

Salmon Trout

  • Guest
Re: get the sum of %errorlevel% at the end of a subroutine.
« Reply #30 on: February 24, 2012, 05:54:35 AM »
Option Explicit

To my shame, I did not spot that.

osvikvi

    Topic Starter


    Rookie

    Thanked: 2
    • Experience: Experienced
    • OS: Windows XP
    Re: get the sum of %errorlevel% at the end of a subroutine.
    « Reply #31 on: February 24, 2012, 07:49:18 AM »
    So I changed the Dim line as suggested, Thanks for that BC_Programmer.

    When I run the test script (like the code in post 128525)
    the vbs messagebox pops up but it doesn't show which devices didn't respond

    You need to call the vbs in the sub, %1 and %2 do not exist in the main part.

    you're right and wrong...
    If I call it in the sub the message pops-up every cycle and this is what I want to avoid. (I want one box showing me where it all went wrong and giving me the option to show the complete log)

    -However when I do so, it shows me which devices triggered the %erry%. (So actually you're right twice and I just stumbled into another problem.

    « Last Edit: February 24, 2012, 08:25:36 AM by osvikvi »

    osvikvi

      Topic Starter


      Rookie

      Thanked: 2
      • Experience: Experienced
      • OS: Windows XP
      Re: get the sum of %errorlevel% at the end of a subroutine.
      « Reply #32 on: February 29, 2012, 01:22:59 AM »
      bump -

      Anymore suggestions on how to make %1 and %2 available in the mainpart?

      Salmon Trout

      • Guest
      Re: get the sum of %errorlevel% at the end of a subroutine.
      « Reply #33 on: February 29, 2012, 10:51:25 AM »
      Anymore suggestions on how to make %1 and %2 available in the mainpart?

      for /f "skip=5 tokens=1,2 delims=<TAB> eol=;" %%a in (%fnm%) do (
          set v1=%%a
          set v2=%%b
          )


      osvikvi

        Topic Starter


        Rookie

        Thanked: 2
        • Experience: Experienced
        • OS: Windows XP
        Re: get the sum of %errorlevel% at the end of a subroutine.
        « Reply #34 on: March 01, 2012, 01:30:41 AM »
        Thanks Salmon Trout,

        Where should I place this, I reckon it loops through fnm and will set column A to v1 and column B to v2. Meaning I can call v1 and it will give me a list of all items in that column?

        And where should i place this? If I place it above the first loop and call the vbs script from the :sub. It results in showing me the same IP and devname over and over again. When I call the vbs after the :sub, I receive only one popup but it lists only one ip-address, while there should be 4.

        Is it correct that I call the vbs with the parameters like this:
        Code: [Select]
        cscript //nologo yesno.vbs "%v2%" "%v1%"
        Excuse me, I'm a novice!

        osvikvi

          Topic Starter


          Rookie

          Thanked: 2
          • Experience: Experienced
          • OS: Windows XP
          Re: get the sum of %errorlevel% at the end of a subroutine.
          « Reply #35 on: March 07, 2012, 01:18:22 AM »
          bump...