Announcement

Collapse
No announcement yet.

I'm going crazy over this vbscript......

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I'm going crazy over this vbscript......

    Const conURLSrc = "http://checkip.dyndns.org/"
    Const conFilSpec = "externalip.txt"

    Dim st(0)
    st(0) = "Current IP Address: "

    set http = createobject("microsoft.xmlhttp")
    set fso = CreateObject("Scripting.FileSystemObject")
    set fOutput = fso.CreateTextFile(conFilSpec,true)

    ' Get HTML from http://checkip.dyndns.org/ page
    http.open "GET",conURLSrc,False
    http.send

    ' Create array with each line as an element
    aHTML = Split(http.responsetext, vbLf)

    for i=0 To UBound(aHTML)
    if (Instr(aHTML(i),st(0))>0) then
    a = Instr(aHTML(i),st(0)) + len(st(0))
    b = Instr(a,aHTML(i),"<br>") - a
    fOutput.WriteLine Mid(aHTML(i),a,b)
    end if
    next
    it goves an errormsg that 'Mid' is not alowed....



    do anyone have a clue?
    If there's artificial intelligence, there's bound to be some artificial stupidity.

    Jeremy Clarkson "806 brake horsepower..and that on that limp wrist faerie liquid the Americans call petrol, if you run it on the more explosive jungle juice we have in Europe you'd be getting 850 brake horsepower..."

  • #2
    Just tested it on mine

    a=21
    b=-21

    that looks to be the problem

    I had to change this line:
    b = Instr(a,aHTML(i),"
    ") - a

    to
    b = Instr(a,aHTML(i),chr(13)) - a

    though to get it to even run.

    this would do it:

    for i=0 To UBound(aHTML)
    if (Instr(aHTML(i),st(0))>0) then
    a = Instr(aHTML(i),st(0)) + len(st(0))
    fOutput.WriteLine right(aHTML(i),len(aHtml(i))-a+1)
    end if
    next
    Last edited by Rob(QG); 9 February 2003, 02:51.

    Comment


    • #3
      Thank you!
      it works now

      Edit: spelling
      Last edited by Technoid; 9 February 2003, 03:30.
      If there's artificial intelligence, there's bound to be some artificial stupidity.

      Jeremy Clarkson "806 brake horsepower..and that on that limp wrist faerie liquid the Americans call petrol, if you run it on the more explosive jungle juice we have in Europe you'd be getting 850 brake horsepower..."

      Comment

      Working...
      X