Jump to content
Sign in to follow this  
autonoob

Returning Url to _IECreate?

Recommended Posts

autonoob

Hi,

I am trying to get the below script to work.

the idea is to enter a a phone number and it checks on the LNS to see if they are online, now each phone number prefix has a different page to check.

My issue is that when it navigates to "http://0/" in IE, not the returned website as planned.

I am not sure if its not working out the right state or the functions for opening IE are written wrong.

Any help you be great!

Thanks

Other Info

The state checker matchs a prefix to a URL. The prefix is the first two digits of the 10 digit phone number, one prefix (08) is also shared by two states and the 3rd digit becomes the state identifier.

Please note all the URLS are internal sites on an intranet.

#include <IE.au3>

$fnn = InputBox("Online Checker", "Enter FNN", "", "")
$state = PR_State($fnn)


$online = PR_online($state)
    If $online == 1 Then
        MsgBox(0,"ONLINE","ONLINE")
    Else
        MsgBox(0,"OFFLINE","OFFLINE")
    EndIf
; ----------------------------------------------------------------------------
; PR_state($fnn)
; 
; ----------------------------------------------------------------------------

Func PR_State($fnn)
    Switch $fnn
        case "02" ; NSW/ACT
            Return "http://bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=NSW_ACT&lns=sl3%3Asl5%3Aul2%3Aul1"
        Case "03" ; VIC/TAS
            Return "http://bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=QLD&lns=bl1%3Abl2"
        Case "07" ; QLD
            Return "http://bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=QLD&lns=bl1%3Abl2"
        Case "08" ; WA/ SA-NT
            $state_type = StringInStr($fnn) + 3 
                If $state_type = "8" Then  ;SA-NT
                    Return"http://bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=SA_NT&lns=al1%3Aal2"
                Else
                    Return "http://bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=WA&lns=pl1%3Apl2"
                EndIf
    EndSwitch
EndFunc
; ----------------------------------------------------------------------------
; PR_online($state)
; 
; ----------------------------------------------------------------------------
Func PR_online($state)
$oIE = _IECreate($state)
$temp = _IEBodyReadHTML($oIE)
;_IEQuit($oIE) -Commented out until script is working.
$pos = StringInStr(">" & $fnn &)
        If $pos = IsString("Connected") Then
            Return 1
        Else
            Return 0
    EndIf
EndFunc

Share this post


Link to post
Share on other sites
autonoob

Also,

The URL will bring up a page that has 1000's of connections, here is a sample of HTML output for the 02 prefix

CODE

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0298971787N%40router.zedxnet">0298971787N@router.bnoweb<BR></TD><TD><font color="00FF00"> Connected ul1</TD></TR>

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0298975404N%40router.zedxnet">0298975404N@router.bnoweb<BR></TD><TD><font color="FF0000"> Down Fri Sep 14 14:13:50 2007</font></TD></TR>

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0295609446N%40rip.stgatm.vmb">0295609446N@rip.bnoweb<BR></TD><TD><font color="00FF00"> Connected ul1</TD></TR>

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0295317506N%40rip.sdudsl.vmb">0295317506N@rip.bnoweb<BR></TD><TD><font color="00FF00"> Connected ul1</TD></TR>

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=029589578N%40rip.stgatm.vmb">0295889578N@rip.bnoweb<BR></TD><TD><font color="00FF00"> Connected ul2</TD></TR>

Edited by autonoob

Share this post


Link to post
Share on other sites
autonoob

Anyone? i am still lost on this one

Share this post


Link to post
Share on other sites
PsaltyDS

Hi,

I am trying to get the below script to work.

the idea is to enter a a phone number and it checks on the LNS to see if they are online, now each phone number prefix has a different page to check.

My issue is that when it navigates to "http://0/" in IE, not the returned website as planned.

I am not sure if its not working out the right state or the functions for opening IE are written wrong.

Any help you be great!

Thanks

Other Info

The state checker matchs a prefix to a URL. The prefix is the first two digits of the 10 digit phone number, one prefix (08) is also shared by two states and the 3rd digit becomes the state identifier.

Please note all the URLS are internal sites on an intranet.

This line will throw an error for bad syntax:

$state_type = StringInStr($fnn) + 3

And so will this one:

$pos = StringInStr(">" & $fnn &)

Look up StringInStr() in the help file. It requires two parameters and you only provide one in each case, plus in the second you can't end a string with the append operator "&" and nothing after it.

What is it you thought StringInStr() was doing for you?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
autonoob

Not sure what i was thinking, but i understand now. Thanks for that PsaltyDS!

I corrected the first part and its now browsing to the correct page!

; ----------------------------------------------------------------------------
; PR_state($fnn)
; ----------------------------------------------------------------------------
Func PR_State($fnn)
    $fnn1 = StringMid($fnn,2, 2)
    Switch $fnn1
        case "24" To "29"; NSW/ACT
            Return "//bnoweb/NSAC//cgi-bin/zedx_index_v2.cgi?state=NSW_ACT&lns=sl3%3Asl5%3Aul2%3Aul1"
        Case "35" To "39" ; VIC/TAS
            Return "//bnoweb/NSAC//cgi-bin/zedx_index_v2.cgi?state=QLD&lns=bl1%3Abl2"
        Case "73" To "75" ; QLD
            Return "//bnoweb/NSAC//cgi-bin/zedx_index_v2.cgi?state=QLD&lns=bl1%3Abl2"
        Case "88" ; SA-NT
            Return "//bnoweb/NSAC//cgi-bin/zedx_index_v2.cgi?state=SA_NT&lns=al1%3Aal2"
        Case "89" ; SA-NT
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=WA&lns=pl1%3Apl2"
        Case Else
            Return 0
    EndSwitch
EndFunc

I am not sure how to pull the line with right FNN in it (<TR> to </TR>) and check for connect or down.

I know once i get the right line i can StringInStr ( "string", "connected", 0) to check it for the right occurrence.

Any Suggestions on how to go about this?

Below is a sample of the html, the real page has 1000's of lines like this.

CODE

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0298971787N%40router.zedxnet">0298971787N@router.bnoweb<BR></TD><TD><font color="00FF00"> Connected ul1</TD></TR>

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0298975404N%40router.zedxnet">0298975404N@router.bnoweb<BR></TD><TD><font color="FF0000"> Down Fri Sep 14 14:13:50 2007</font></TD></TR>

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0295609446N%40rip.stgatm.vmb">0295609446N@rip.bnoweb<BR></TD><TD><font color="00FF00"> Connected ul1</TD></TR>

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0295317506N%40rip.sdudsl.vmb">0295317506N@rip.bnoweb<BR></TD><TD><font color="00FF00"> Connected ul1</TD></TR>

<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=029589578N%40rip.stgatm.vmb">0295889578N@rip.bnoweb<BR></TD><TD><font color="00FF00"> Connected ul2</TD></TR>

Edited by autonoob

Share this post


Link to post
Share on other sites
PsaltyDS

Not sure what i was thinking, but i understand now. Thanks for that PsaltyDS!

I corrected the first part and its now browsing to the correct page!

I am not sure how to pull the line with right FNN in it (<TR> to </TR>) and check for connect or down.

I know once i get the right line i can StringInStr ( "string", "connected", 0) to check it for the right occurrence.

Any Suggestions on how to go about this?

Below is a sample of the html, the real page has 1000's of lines like this.

If you must do it by brute force, this should work:

; ----------------------------------------------------------------------------
; PR_online($state)
;     Returns 1 if $fnn is found and connected
;     Returns 0 if $fnn is found and down
;     Returns 0 plus @error = 1 if $fnn is not found
; ----------------------------------------------------------------------------
Func PR_online($state)
    Local $oIE = _IECreate($state, 0, 0)
    Local $sHTML = _IEBodyReadHTML($oIE)
    _IEQuit($oIE)
    Local $avHTML = StringSplit($sHTML, @CRLF, 1)
    
    For $n = 1 To $avHTML[0]
        If StringInStr(">" & $avHTML[$n], $fnn) Then
            Select
                Case StringInStr($avHTML[$n], "> Connected ")
                    Return 1
                Case StringInStr($avHTML[$n], "> Down ")
                    Return 0
            EndSelect
        EndIf
    Next

    Return SetError(1, 0, 0) ; @error = 1, $fnn/status not found
EndFunc   ;==>PR_online

There are more elegant ways to work with the page DOM, but one needs access to the web page to work out how to take advantage of that.

:)

Edit: Fixed Select for Switch.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
autonoob

Thanks PsaltyDS!,

The script is giving an error though

Switch

Switch^ERROR

Error in expression

All switchs need expressions yea? what should it put?

There are more elegant ways to work with the page DOM, but one needs access to the web page to work out how to take advantage of that.

:)

I am planning on gettnig a single CGI return of the FNN, but thats a few months away.

Edited by autonoob

Share this post


Link to post
Share on other sites
PsaltyDS

Thanks PsaltyDS!,

The script is giving an error though

Switch

Switch^ERROR

Error in expression

All switchs need expressions yea? what should it put?

I am planning on gettnig a single CGI return of the FNN, but thats a few months away.

Doh! :)

That should be Select/EndSelect, vice Switch/EndSwitch.

:">


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
autonoob

Doh! :)

That should be Select/EndSelect, vice Switch/EndSwitch.

:">

Ahh, i changed it and im not getting an error.

But... all returns seems to be offline.

I changed message box to be a switch so it can handle the errors.

#include <IE.au3>

$fnn = InputBox("Online Checker", "Enter FNN", "", "")
$state = PR_State($fnn)


$online = PR_online($state)
    Switch $online
    Case 1
        MsgBox(0,"ONLINE","ONLINE")
    Case 0 
        MsgBox(0,"OFFLINE","OFFLINE")
    Case 0 And @error = 1
        MsgBox(0,"ONLINE","$fnn is not found")
    EndSwitch
; ----------------------------------------------------------------------------
; PR_state($fnn)
; ----------------------------------------------------------------------------
Func PR_State($fnn)
    $fnn1 = StringMid($fnn,2, 2)
    Switch $fnn1
        case "24" To "29"; NSW/ACT
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=NSW_ACT&lns=sl3%3Asl5%3Aul2%3Aul1"
        Case "35" To "39" ; VIC/TAS
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=QLD&lns=bl1%3Abl2"
        Case "73" To "75" ; QLD
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=QLD&lns=bl1%3Abl2"
        Case "88" ; SA-NT
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=SA_NT&lns=al1%3Aal2"
        Case "89" ; SA-NT
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=WA&lns=pl1%3Apl2"
        Case Else
            Return 0
    EndSwitch
EndFunc
; ----------------------------------------------------------------------------
; PR_online($state)
;     Returns 1 if $fnn is found and connected
;     Returns 0 if $fnn is found and down
;     Returns 0 plus @error = 1 if $fnn is not found
; ----------------------------------------------------------------------------
Func PR_online($state)
    Local $oIE = _IECreate($state, 0, 0)
    Local $sHTML = _IEBodyReadHTML($oIE)
    _IEQuit($oIE)
    Local $avHTML = StringSplit($sHTML, @CRLF, 1)
   
    For $n = 1 To $avHTML[0]
        If StringInStr(">" & $avHTML[$n], $fnn) Then
            Select
                Case StringInStr($avHTML[$n], "> Connected ")
                    Return 1
                Case StringInStr($avHTML[$n], "> Down ")
                    Return 0
            EndSelect
        EndIf
    Next

    Return SetError(1, 0, 0) ; @error = 1, $fnn/status not found
EndFunc   ;==>PR_online

Now i set Local $oIE = _IECreate($state, 0, 0) to Local $oIE = _IECreate($state, 0, 1) and tabbed out the _IEQuit($oIE) to make sure its hitting the right page and its all good there.

any ideas?

Share this post


Link to post
Share on other sites
PsaltyDS

Ahh, i changed it and im not getting an error.

But... all returns seems to be offline.

I changed message box to be a switch so it can handle the errors.

Now i set Local $oIE = _IECreate($state, 0, 0) to Local $oIE = _IECreate($state, 0, 1) and tabbed out the _IEQuit($oIE) to make sure its hitting the right page and its all good there.

any ideas?

Hmm... I don't see the problem, but of course nobody else can test without access to the sites. There was a mistake in checking the HTML line for $fnn, but it was minor and I don't think should have thrown off the results:

If StringInStr(">" & $avHTML[$n], $fnn) Then

If StringInStr($avHTML[$n], ">" & $fnn) Then

All I can think of is to throw in some debug messages to give you chance to see what's up (run from SciTE to see console messages with debug info):

#include <IE.au3>

$fnn = InputBox("Online Checker", "Enter FNN", "", "")
$state = PR_State($fnn)

$online = PR_online($state)
Switch $online
    Case 1
        MsgBox(64, "Status", $fnn & " is ONLINE")
    Case 0
        MsgBox(64, "Status", $fnn & " OFFLINE")
    Case 0 And @error = 1
        MsgBox(16, "Error", "Error: " & $fnn & " was not found")
    Case 0 And @error = 2
        MsgBox(16, "Error", "Error: " & $fnn & " found with invalid status")
EndSwitch

; ----------------------------------------------------------------------------
; PR_state($fnn)
; ----------------------------------------------------------------------------
Func PR_State($fnn)
    $fnn1 = StringMid($fnn, 2, 2)
    Switch $fnn1
        Case "24"  To "29"  ; NSW/ACT
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=NSW_ACT&lns=sl3%3Asl5%3Aul2%3Aul1" 
        Case "35"  To "39"   ; VIC/TAS
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=QLD&lns=bl1%3Abl2" 
        Case "73"  To "75"   ; QLD
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=QLD&lns=bl1%3Abl2" 
        Case "88"   ; SA-NT
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=SA_NT&lns=al1%3Aal2" 
        Case "89"   ; SA-NT
            Return "//bnoweb/NSAC/cgi-bin/zedx_index_v2.cgi?state=WA&lns=pl1%3Apl2" 
        Case Else
            Return 0
    EndSwitch
EndFunc   ;==>PR_State

; ----------------------------------------------------------------------------
; PR_online($state)
;     Returns 1 if $fnn is found and connected
;     Returns 0 if $fnn is found and down
;     Returns 0 plus @error = 1 if $fnn is not found
; ----------------------------------------------------------------------------
Func PR_online($state)
    Local $oIE = _IECreate($state, 0, 0)
    Local $sHTML = _IEBodyReadHTML($oIE)
    _IEQuit($oIE)
    Local $avHTML = StringSplit($sHTML, @CRLF, 1)
    ConsoleWrite("Debug: There are " & $avHTML[0] & " lines in $avHTML" & @LF)
    ConsoleWrite("Debug: $fnn = " & $fnn & @LF)
    For $n = 1 To $avHTML[0]
        ConsoleWrite("Debug: Line " & $n & @LF)
        If StringInStr($avHTML[$n], ">" & $fnn) Then
            ConsoleWrite("Debug: $fnn found in line: " & $avHTML[$n] & @LF)
            Select
                Case StringInStr($avHTML[$n], "> Connected ")
                    Return 1
                Case StringInStr($avHTML[$n], "> Down ")
                    Return 0
                Case Else
                    Return SetError(2, 0, 0) ; @error = 2, unhandled case - not "Connected" or "Down"
            EndSelect
        EndIf
    Next
    
    Return SetError(1, 0, 0) ; @error = 1, $fnn/status not found
EndFunc   ;==>PR_online

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
autonoob

Ran the debug,

looks like it finding the 'FNN" but its not checking the next column that has the status.

i doesnt seem to be checking the next <td></td>

i had a look around for info $avHTML and $sHTML in the help file but i cant find anything. where can i find info on this, the forum seem to be flaky when searching :)

>"E:\autoit\SciTe\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\...\...\onlinetest2.au3"  
Debug: There are 8835 lines in $avHTML
Debug: $fnn = 0262304034
Debug: Line 1
Debug: Line 2
Debug: Line 3
Debug: Line 4
Debug: Line 5
Debug: Line 6
Debug: Line 7
Debug: Line 8
Debug: Line 9
Debug: Line 10
Debug: Line 11
Debug: Line 12
Debug: Line 13
Debug: Line 14
Debug: $fnn found in line: <TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&amp;username=0262304034A%40router.zedxnet">0262304034A@router.zedxnet<BR></A></TD>
>Exit code: 0   Time: 98.739

Share this post


Link to post
Share on other sites
PsaltyDS

Ran the debug,

looks like it finding the 'FNN" but its not checking the next column that has the status.

i doesnt seem to be checking the next <td></td>

i had a look around for info $avHTML and $sHTML in the help file but i cant find anything. where can i find info on this, the forum seem to be flaky when searching :)

It is looking to find the FNN and status on the same line. If the status is on the next line, then just look for it this way:

If StringInStr($avHTML[$n], ">" & $fnn) Then
            ConsoleWrite("Debug: $fnn found in line: " & $avHTML[$n] & @LF)
            Select
                ; Check next line for status
                Case StringInStr($avHTML[$n + 1], "> Connected ")
                    Return 1
                Case StringInStr($avHTML[$n + 1], "> Down ")
                    Return 0
                Case Else
                    Return SetError(2, 0, 0) ; @error = 2, unhandled case - not "Connected" or "Down"
            EndSelect
        EndIf

$sHTML and $avHTML are just variables I named arbitrarily. You won't find them in the help file any more than you would $x or $n.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
autonoob

It is looking to find the FNN and status on the same line. If the status is on the next line, then just look for it this way:

If StringInStr($avHTML[$n], ">" & $fnn) Then
            ConsoleWrite("Debug: $fnn found in line: " & $avHTML[$n] & @LF)
            Select
                ; Check next line for status
                Case StringInStr($avHTML[$n + 1], "> Connected ")
                    Return 1
                Case StringInStr($avHTML[$n + 1], "> Down ")
                    Return 0
                Case Else
                    Return SetError(2, 0, 0) ; @error = 2, unhandled case - not "Connected" or "Down"
            EndSelect
        EndIf

$sHTML and $avHTML are just variables I named arbitrarily. You won't find them in the help file any more than you would $x or $n.

:)

Ahh you can tell it was monday for a silly question like that that :)

Ok, still not working...

Looking at the console,

"Debug: There are 8832 lines in $avHTML'

if i go to said page, view source and dump it in scite, it get 2889 lines.

could the way its being output change it enough to stop it working?

Share this post


Link to post
Share on other sites
PsaltyDS

Ahh you can tell it was monday for a silly question like that that :)

Ok, still not working...

Looking at the console,

"Debug: There are 8832 lines in $avHTML'

if i go to said page, view source and dump it in scite, it get 2889 lines.

could the way its being output change it enough to stop it working?

Have you looked at the actual lines output by the ConsoleWrite? Is the Connected/Down string on the same line as the FNN? Is it on the next line? Use this to see:

If StringInStr($avHTML[$n], ">" & $fnn) Then
            ConsoleWrite("Debug: $fnn found in line number " & $n & ": " & $avHTML[$n] & @LF)
            Select
                ConsoleWrite(@TAB & "Debug: Next line is: " & $avHTML[$n + 1] & @LF)
                ; Check next line for status
                Case StringInStr($avHTML[$n + 1], "> Connected ")
                    ConsoleWrite(@TAB & @TAB & 'Debug: Found "> Connected "' & @LF)
                    Return 1
                Case StringInStr($avHTML[$n + 1], "> Down ")
                    ConsoleWrite(@TAB & @TAB & 'Debug: Found "> Down "' & @LF)
                    Return 0
                Case Else
                    ConsoleWrite(@TAB & @TAB & 'Debug: Did not find Connected\Down' & @LF)
                    Return SetError(2, 0, 0) ; @error = 2, unhandled case - not "Connected" or "Down"
            EndSelect
        EndIf

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
autonoob

I get

>"E:\autoit\SciTe\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\..\..\onlinetest2.au3"    
Debug: There are 8829 lines in $avHTML
Debug: $fnn = 0262304034
Debug: Line 2
Debug: Line 3
Debug: Line 4
Debug: Line 5
Debug: Line 6
Debug: Line 7
Debug: Line 8
Debug: Line 9
Debug: Line 10
Debug: Line 11
Debug: Line 12
Debug: Line 13
Debug: Line 14
Debug: $fnn found in line number 14: <TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&amp;username=0262304034A%40router.zedxnet">0262304034A@router.zedxnet<BR></A></TD>
        Debug: Did not find Connected\Down

Now the two numbers i have been testing with, one is online and one is off line. here is the viewed source i just pulled. this is copy pasta from IE :)

Online test fnn :0262304034

offline test fnn : 0262304486

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<p align="center">
<title>NSW_ACT</title>
</p>
</head>
<body>
<H3 align="center">NSW_ACT</H3><br>
<BR><H4 align=
<BR><H4 align="left">LAC: n2000957k-acb1</H4><table border cellpadding=2 width=70%><th align=left width=30%>Username</th><th align=left width=70%>Status</th>
<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0262301173a%40router.zedxnet">0262301173a@router.zedxnet<BR></TD><TD><font color="00FF00"> Connected ul1</TD></TR>
<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0262304034A%40router.zedxnet">0262304034A@router.zedxnet<BR></TD><TD><font color="00FF00"> Connected ul1</TD></TR>
<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0262304486A%40router.zedxnet">0262304486A@router.zedxnet<BR></TD><TD><font color="FF0000"> Down Mon Sep 24 20:48:48 2007</font></TD></TR>
<TR><TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&username=0262324565A%40rip.ioqdsl.vmb">0262324565A@rip.ioqdsl.vmb<BR></TD><TD><font color="00FF00"> Connected ul1</TD></TR>

Share this post


Link to post
Share on other sites
PsaltyDS

I don't get it... I think I've missed something obvious here. :)

The IE source clearly shows the status on the same line with the FNN. Yet the ConsoleWrite of the line ends before that. This should have been easier. I started down this path because I thought string manipulation would be quicker and easier for you than working through the DOM objects, but this glitch is proving that wrong. :)

One last thing to check out. Run this and post the result so we can see exactly how the script is seeing that portion of the source, specifically, how the line breaks are working out:

If StringInStr($avHTML[$n], ">" & $fnn) Then
            ; Debug display of the HTML as seen after string split:
            ConsoleWrite("Debug: FNN " & $fnn & " found in line number " & $n & @LF)
            For $x = $n To $n + 7
                ConsoleWrite("Debug: Line " & $x & ": " & $avHTML[$x] & @LF)
            Next
            
            Select
                ; Check next line for status
                Case StringInStr($avHTML[$n], "> Connected ")
                    Return 1
                Case StringInStr($avHTML[$n], "> Down ")
                    Return 0
                Case Else
                    Return SetError(2, 0, 0) ; @error = 2, unhandled case - not "Connected" or "Down"
            EndSelect
        EndIf

This should explain what's up.

If not, we just need to buckle down and access the table more directly by DOM objects.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
autonoob

Done,

wow, it destroys it :)

>"E:\autoit\SciTe\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\..\..\onlinetest.au3"    
Debug: FNN 0262304034 found in line number 14
Debug: Line 14: <TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&amp;username=0262304034A%40router.zedxnet">0262304034A@router.zedxnet<BR></A></TD>
Debug: Line 15: <TD><FONT color=#00ff00>Connected ul1</FONT></TD></TR>
Debug: Line 16: <TR>
Debug: Line 17: <TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&amp;username=0262304486A%40router.zedxnet">0262304486A@router.zedxnet<BR></A></TD>
Debug: Line 18: <TD><FONT color=#ff0000>Down Wed Sep 26 08:22:24 2007</FONT></TD></TR>
Debug: Line 19: <TR>
Debug: Line 20: <TD><A href="//bnoweb/NSAC/cgi-bin/single_zedx_v2.pl?state=NSW_ACT&amp;username=0262324565A%40rip.ioqdsl.vmb">0262324565A@rip.ioqdsl.vmb<BR></A></TD>
Debug: Line 21: <TD><FONT color=#00ff00>Connected ul1</FONT></TD></TR>
>Exit code: 0    Time: 33.555

Share this post


Link to post
Share on other sites
PsaltyDS

Well, that answers that... What happened to the space between the right angle bracket and "Connected" or "Down"??? :)

If that's all it was, this should work:

If StringInStr($avHTML[$n], ">" & $fnn) Then
            Select
                ; Check next line for status
                Case StringInStr($avHTML[$n + 1], ">Connected ")
                    Return 1
                Case StringInStr($avHTML[$n + 1], ">Down ")
                    Return 0
                Case Else
                    Return SetError(2, 0, 0) ; @error = 2, unhandled case - not "Connected" or "Down"
            EndSelect
        EndIf

We're back to check the next line after the FNN, and there's no space between the angle bracket and the connection state. Of course you could remove the angle bracket completely from the search strings, and just search for the words too.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
autonoob

Yea i was magic invisible spaces

Ok i updated and tested it and.. we have a winnner!

yay! thanks mate.

after all that it was just missing spaces

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  

×