Jump to content



Photo

[Request] Line Result


  • Please log in to reply
1 reply to this topic

#1 nauip

nauip

    Seeker

  • Active Members
  • 15 posts

Posted 31 August 2007 - 06:03 PM

I would love to see a debug tool that tells me what the result of a particular line of code.

currently I am working on this script

#include <library.au3> _func_Alert("server1/server2 @ 33% battery. Servers will be shut down.", "NP"); alert called from library - sends text alert to phone $test = 0 If MsgBox(4, "Test?", "Is this a test run?", 5) = 6 Then $test = 1 If $test = 1 then         $machine="\\server1"; test server     else         $machine = "\\server2"; production server EndIf RunWait(@ComSpec & ' /c shutdown -s -m ' & $machine & ' -t 9999 -c "Power Outage - UPS LOW" -d :6:12', @SW_HIDE)


my situation is I'm very new to this and I've taken over a position of someone who loved this stuff. programming drives me nuts, but I must admit that this is a very handy solution to many repetitive tasks.

We have 2 servers on 1 ups, so I need for the attached server to send a shutdown to the 2nd server that doesn't have the ups data cable to monitor the ups.

This will be one of the easier problems to work around, but there have been MANY times I have wished I could right-click on a line of code and choose an option that would display what the line develops in to. Whether it's a DOS command, a line of output text or whatever. Just have it have execute the code and pop-up an alert window that says: This is your result at line (whatever line I've highlighed/specified)- "some shutdown command that didn't work on the 1st draft".

I hope this makes sense and I hope it's doable.

Thanks,
Dave

edit : (just now I realized I did not have a 2nd EndIf - probably the majority of my problem. - or maybe not. Grrr.

Edited by nauip, 31 August 2007 - 06:08 PM.






#2 nauip

nauip

    Seeker

  • Active Members
  • 15 posts

Posted 31 August 2007 - 11:54 PM

in case anyone cares, or might want to use it

#include <library.au3> _MB_Alert("server1/server2 @ 33% battery. Servers will be shut down.", "NP") $test = 0 If MsgBox(4, "Test?", "Is this a test run?", 5) = 6 Then $test = 1     If $test = 1 then             $machine = "\\testserver"         else             $machine = "\\prodserver"     EndIf $shutdowncmd = 'shutdown -s -m ' & $machine & ' -t 15 -c "Power Outage - UPS LOW" -d :6:12' RunWait(@ComSpec &' /c' & $shutdowncmd , "", @SW_HIDE)



I had to separately define the shutdown command because autoit kept insisting that an invalid directory was defined which is due to the breakup of the shutdown command to define a test or production server.

the code in "library" is just using blat.exe to smtp an email to a mail server to get a text message to a phone (flag P) and a netsend to my workstation (flag N) (in case I'm blissfully unaware that the power is out).

Hopefully this will come in useful or inspire something else handy.

Edited by nauip, 31 August 2007 - 11:55 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users