Jump to content

Is it possible to have a script check for an image in a webpage?


Ashww
 Share

Recommended Posts

Is it possible to have a script check for an image in a webpage?

If so can some tell me how?

Cheers

Ashww

X)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Link to comment
Share on other sites

urm.... Could someone show me an example...

Im trying to get the green arrows off this page there at the very right hand side.

Cheers

Ashww

X)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Link to comment
Share on other sites

To check the images, you can use _InetGetSource, StringInstr, StringRegExp etc: a good example with your site:

#include<inet.au3>
#include<Array.au3>
; Get Source
$Source = _INetGetSource("http://www.rscheata.net/forum/index.php")

; Get Part of website with needed informations
$begin = StringInStr($Source,"windowbg tp_rightblock_body")
$End = StringInStr($Source,"Inaccurate? contact an admin.")
$PartOfWebSite = StringMid($Source,$begin,$End-$begin)

; extract the information
$Strings = StringRegExp($PartOfWebSite,'(?s)<img src="http://www.rscheata.net/tp/Themes/(.+?)".*?>.*?<a href=".*?">(.+?)</a>',3)
If Not @error Then
    ;Make better Array
    Local $ServersUp[UBound($Strings)/2][2]
    For $i = 0 To UBound($Strings)-1 Step 2
        $ServersUp[$i/2][0] = ($Strings[$i] = "up_g.gif") ; If server up: true, else false for down
        $ServersUp[$i/2][1] = $Strings[$i+1] ; the server type
    Next
Else
    MsgBox(0, '', "No data")
    Exit
EndIf

_ArrayDisplay($ServersUp)
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

I was hopeing to have it in a GUI like this:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

Opt("TrayMenuMode",1)  ; Default tray menu items will not be shown.

$GUI = GUICreate("Checkup", 167, 277, 193, 125)
GUISetBkColor(0xF4F7FC)
$litegroup = GUICtrlCreateGroup("neXus iBot Lite", 32, 8, 89, 41)
$litelable = GUICtrlCreateLabel("Up", 64, 24, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Progroup = GUICtrlCreateGroup("neXus iBot Pro", 32, 48, 89, 41)
$Prolable = GUICtrlCreateLabel("Up", 64, 64, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Countergroup = GUICtrlCreateGroup("CounterStrike Servers", 8, 88, 145, 41)
$Counterlable = GUICtrlCreateLabel("Up", 72, 104, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$IRCgroup = GUICtrlCreateGroup("IRC", 48, 128, 65, 41)
$IRlable = GUICtrlCreateLabel("Up", 72, 144, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Ventgroup = GUICtrlCreateGroup("Ventrilo", 48, 168, 65, 41)
$Ventlable = GUICtrlCreateLabel("Up", 72, 184, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Contactgroup = GUICtrlCreateGroup("Inaccurate?", 8, 208, 145, 41)
$Contactlable = GUICtrlCreateLabel("Contact an admin!", 24, 224, 90, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

_Checkup()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Contactlable
        _IECreate("http://www.rscheata.net/forum/index.php/index.php?action=staff")
EndSwitch
WEnd

Func _Checkup()
    
    
EndFunc

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Link to comment
Share on other sites

You can put it in a GUI, but this is not so difficult, just try :)

Read the array and set the Labels according to the values.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

You can put it in a GUI, but this is not so difficult, just try :)

Read the array and set the Labels according to the values.

I dont get how to do it.

Could could post the code just for the neXus iBot Lite lable and then ill try to understand the rest?

Cheers

Ashww

X)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Link to comment
Share on other sites

A big hint:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include<inet.au3>
#include<Misc.au3>


Opt("TrayMenuMode",1)  ; Default tray menu items will not be shown.

$GUI = GUICreate("Checkup", 167, 277, 193, 125)
GUISetBkColor(0xF4F7FC)
$litegroup = GUICtrlCreateGroup("neXus iBot Lite", 32, 8, 89, 41)
$litelable = GUICtrlCreateLabel("Down", 64, 24, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Progroup = GUICtrlCreateGroup("neXus iBot Pro", 32, 48, 89, 41)
$Prolable = GUICtrlCreateLabel("Down", 64, 64, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Countergroup = GUICtrlCreateGroup("CounterStrike Servers", 8, 88, 145, 41)
$Counterlable = GUICtrlCreateLabel("Down", 72, 104, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$IRCgroup = GUICtrlCreateGroup("IRC", 48, 128, 65, 41)
$IRlable = GUICtrlCreateLabel("Down", 72, 144, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Ventgroup = GUICtrlCreateGroup("Ventrilo", 48, 168, 65, 41)
$Ventlable = GUICtrlCreateLabel("Down", 72, 184, 18, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Contactgroup = GUICtrlCreateGroup("Inaccurate?", 8, 208, 145, 41)
$Contactlable = GUICtrlCreateLabel("Contact an admin!", 24, 224, 90, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

_Checkup()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Contactlable
        ShellExecute("http://www.rscheata.net/forum/index.php/index.php?action=staff")
EndSwitch
WEnd

Func _Checkup()
; Prog@ndy
; Get Source
$Source = _INetGetSource("http://www.rscheata.net/forum/index.php")

; Get Part of website with needed informations
$begin = StringInStr($Source,"windowbg tp_rightblock_body")
$End = StringInStr($Source,"Inaccurate? contact an admin.")
$PartOfWebSite = StringMid($Source,$begin,$End-$begin)

; extract the information
$Strings = StringRegExp($PartOfWebSite,'(?s)<img src="http://www.rscheata.net/tp/Themes/(.+?)".*?>.*?<a href=".*?">(.+?)</a>',3)
If Not @error Then
    ;Make better Array
    Local $ServersUp[UBound($Strings)/2][2]
    For $i = 0 To UBound($Strings)-1 Step 2
        $ServersUp[$i/2][1] = ($Strings[$i] = "up_g.gif") ; If server up: true, else false for down
        $ServersUp[$i/2][0] = $Strings[$i+1] ; the server type
    Next
Else
    MsgBox(0, '', "No data")
    Local $ServersUp[5][2] = [["neXus iBot Lite"],["neXus iBot Pro"],["CounterStrike Servers"],["IRC"],["Ventrilo"]]
EndIf
    For $i = 0 To UBound($ServersUp)-1
        Switch StringStripWS($ServersUp[$i][0],7)
            Case "neXus iBot Lite"
                GUICtrlSetData($litelable,_Iif($ServersUp[$i][1],"Up","Down"))
...
        EndSwitch
    Next
EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...