Jump to content
Sign in to follow this  
diikee

run a script according to time of the day

Recommended Posts

diikee

$ip = InputBox("Get Ip Address", "Enter 1 or more IP Address separated by a comma: ")
If $ip = "" Then Exit

$ip = StringSplit($ip, ",")
For $i = 1 to 20 Step 1
    For $x = 1 To $ip[0]
        $oIE = _IECreate($ip[$x])
        Sleep(2000)
        $file = FileOpen("logfile_" &@MDAY &@MON &@HOUR &@MIN &"_" &$ip[$x] & ".txt", 9)
        If $file = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Exit
        EndIf
        Sleep(2000)
        FileWrite($file, "SQA Testing IP#: " & $ip[$x] & @CRLF)
        ToolTip('Testing ' & $ip[$x], 0, 0)
                win() 
        Sleep(2000)
                FileWrite($file,"SQA Testing Finished at:"& @MDAY & @MON & @YEAR & @HOUR & @MIN &@CRLF)
        Sleep(2000)
        FileClose($file)
        Sleep(2000)
        $oIE = ""
        Next
Next

With the script above, I can execute the win() for one IP after another (comma separated) which is great.

Question1:

Now, I want to go another notch higher and execute win() on all ip's (comma separated).

1 - bring the first one to the top, click a button then move it to the back

2 - bring the second one to the top, click the same button in [1] move it back

basically swapping back and forth for all browsers.

Question2:

I want to schedule my script so that after 8pm, it executes win() on just 2 of the 4 (comma separated) ip's.

how can I do this??

Share this post


Link to post
Share on other sites
anixon

$ip = InputBox("Get Ip Address", "Enter 1 or more IP Address separated by a comma: ")
If $ip = "" Then Exit

$ip = StringSplit($ip, ",")
For $i = 1 to 20 Step 1
    For $x = 1 To $ip[0]
        $oIE = _IECreate($ip[$x])
        Sleep(2000)
        $file = FileOpen("logfile_" &@MDAY &@MON &@HOUR &@MIN &"_" &$ip[$x] & ".txt", 9)
        If $file = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Exit
        EndIf
        Sleep(2000)
        FileWrite($file, "SQA Testing IP#: " & $ip[$x] & @CRLF)
        ToolTip('Testing ' & $ip[$x], 0, 0)
                win() 
        Sleep(2000)
                FileWrite($file,"SQA Testing Finished at:"& @MDAY & @MON & @YEAR & @HOUR & @MIN &@CRLF)
        Sleep(2000)
        FileClose($file)
        Sleep(2000)
        $oIE = ""
        Next
Next

With the script above, I can execute the win() for one IP after another (comma separated) which is great.

Question1:

Now, I want to go another notch higher and execute win() on all ip's (comma separated).

1 - bring the first one to the top, click a button then move it to the back

2 - bring the second one to the top, click the same button in [1] move it back

basically swapping back and forth for all browsers.

Question2:

I want to schedule my script so that after 8pm, it executes win() on just 2 of the 4 (comma separated) ip's.

how can I do this??

;//Process at 8PM

$PingIP2 = "192.168.0.1"

$PingDelay2 = 750

If @HOUR = 20 And $OldHour = 19 Then

Ping($PingIP2, $PingDelay2)

EndIf

$OldHour = @HOUR

You can create a Function that includes an array of the addresses to Ping then sequentially read the array assign the value to a variable then individually ping each address and then repeat the routine by wrapping it in a For Next Loop. You can error trap Nil responses to each ping and write the detail to a txt file. There may be more elegant ways of doing it but I am sure with this approach you can develop a script that meets with your requirements. Ant.. :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.