Page 1 of 1

IF command - automatic WOL

Posted: Sat Mar 13, 2010 3:00 am
by anvar
Hello,I'm having some problems with the IF command.I wrote a script to boot up my homeserver at a specified time.Now I've also added a wait command and ping afterwards.Now if the ping doesn't work, he returns -1. Now I want to use the IF command, if there is a -1 then the previous command must be repeated.Now command is- run wol script (bat file)- delay 240000ms- ping IP   - IF ping IP resolves in -1   - run wol script   - delay 240000ms   - ping IP   - IF ping IP resolves in -1      - Send email      - End IF   - End IF- send emailNow my IF commands states this:- As number, first operand {-1}, comperisan type =Now this isn't working, so can someone help me out with this. Thanks for the replies

IF command - automatic WOL

Posted: Sat Mar 13, 2010 3:12 am
by Oleg
You should compare your variable with -1
i.e.:
first operand: {PingVar}
second operand: -1

Braces must specify the variable name. If you use some expression AS IS you don't need to use symbols "{" and "}"

IF command - automatic WOL

Posted: Sat Mar 13, 2010 4:02 am
by anvar
thanks, looks quite logical.Only it still doesn't read my ping value out.So I've my ping value is as followed- ping ip- timeout: 5msc- reply time to variable 1000msc- value if host doesn't respond -1Then my if then value is:- as string- {PingVar}- comparison type: =- second: -1And then I've change everything to include the Else command, otherwise he allways mails the last oneThe full command is now:- run wol script (bat file)- delay 240000ms- ping IP- IF
ping IP resolves in -1   - run wol script   - delay 240000ms  
- ping IP   - IF ping IP resolves in -1      - Send email   - End IF   - Else   - send email- End IFnow he allways skips the first & second if, also when there is a value "-1" given by the ping command