| 1. |
Solve : get the sum of %errorlevel% at the end of a subroutine.? |
|
Answer» I composed a batch file to ping a list of DEVICES, and return a notification whenever a device did not reply. These errors are also prepend to an existing logfile. [PM] Thanks for the tip, where did you INTEND to insert it? I don't see why I should return anywhere, or am I missing something.Who did you recieve a PM from ? ?PM stands for private message, so let's keep that private. I PRESUME that that person has good reasons why not posting in public. He has the right to do so and I think we should respect that. What does it matter anyway?....Do as you like... I have a good reason for asking.Okay, I'm still not with you but nevertheless... Do you have any suggestions?If you want help privately then do it through some other means. This is a help forum. All answers to a thread need to be posted here. Makes absolutely no sense to get some of your help from a PM and some of it here in your thread.what the Why do you think I post my question on this forum? I didn't pm myself to give this suggestion, some other guy did. I was just being open by posting his pm to the public as I figured it could also be useful to others. and I wanted some more explanation on his thought. so why are you dissing me with this shite, I just want some advice from experienced users, but it seems to me they aren't here..... the room is full of old tarts! Quote from: osvikvi on February 22, 2012, 09:31:12 AM the room is full of old tarts! Yeah, that's a really good way to get people to help. Labeling the whole based on the replies of the few. Please forgive me if I'm not my usual helpful, explanatory self. If you want one check after the list of ips has run through, try this: Code: [Select]ping -n 1 %1 IF %ERRORLEVEL% EQU 1 ( ECHO ** # %1 - %2 is not responding ** >> %tnm% mplayerc.exe /minimized /play /close "dingdong.wav" MSG "%username%" /TIME:600 %2 - %1 is not responding set erry=1 ) Then after your REN command in label3, put: Code: [Select]ren "testtemp.txt" "testpingme.txt" if "%erry%"=="1" (cscript yesno.vbs) goto :eof Alternatively, try this in your subroutine if you want it to check after each time the subroutine runs: Code: [Select]ping -n 1 %1 IF %ERRORLEVEL% EQU 1 ( ECHO ** # %1 - %2 is not responding ** >> %tnm% mplayerc.exe /minimized /play /close "dingdong.wav" MSG "%username%" /TIME:600 %2 - %1 is not responding cscript yesno.vbs ) Next time you are looking for help, try not to call the person/people capable of helping you "old tarts." Usually, it doesn't get you the results you are hoping for. Keep it clean...we have Members of all ages here. Quote from: osvikvi on February 22, 2012, 09:31:12 AM and I wanted some more explanation on his thought.I have no idea what they were thinking. I am not omniscient. Maybe you should ask the person to post here and explain themselves better.That's why I posted his pm here in the open. I couldn't reply to his pm for some reason. Anyway, Thanks Raven19528 I'll give it a try when I return to the office. to set things straight I said "it seems..." Sorry Patio, you may clean-out the irrelevant stuff, I would do it myself but I can't edit my posts.. Thanks for your supportNo problem...HOORAY works like a charm, thanks Raven19528. As usual the solution is simple, you just have to come up with it! Now I have only one messageprompt and at the end of the cycle. giving me the option to open the logfile containing the errors. Maybe I can show these errors in the vbs messagebox, is there any way to port %erry% to another script? Thanks a lot Quote is there any way to port %erry% to another script? I hope it's not bad manners of me to jump in here, but you can pass parameters to a VBScript on the command line like so (I always use //nologo) cscript //nologo Scriptname.vbs "p1" "p2" "p3" (etc) (quotes are stripped in the script) and in the VBScript there is an object called WScript.Arguments that acts like a zero-based array so that: WScript.Arguments(0) will be p1 WScript.Arguments(1) will be p2 WScript.Arguments(2) will be p3 You are not limited to 9 parameters like in batch, but total command line string length cannot exceed 8192 characters. |
|