Jump to content

Counter from web


minaset
 Share

Recommended Posts

Hi. I have counter in my website. Every time someone visits number will get higher.

I would like to get that count to my GUI too. Every time i open my GUI then count should be updated from website, if count number is higher than before

HTML code of it in web is :

<a class="skill-popup-trigger" href="counter_details.php" rel="counting" id="counting_id">114</a>

My guess is that i have to use this line of code:

Local $counter = _IEGetObjById($oIE, "counting_id")

But how can i make for example msgbox?

MsgBox(0, "Hello", $counter)      ; This line of code doesn\t work

Thanks in advance.

Link to comment
Share on other sites

  • Moderators

Hi, minaset, can you please include the URL? It is much easier to assist if we can see the page itself.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

This might work for you.

#include 
#include 
Local $Source = _INetGetSource("http://websiteURL")
Local $Var = _StringBetween($Source, '[url="counter_details.php"]', '[/url]')
MsgBox(0, '', $Var[0])
edit: INet.au3 & String.au3 are the included files..

another edit: forget this example, unless you understand the correct usage of the _StringBetween function. It's in the helpfile if you need more info.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

$counter is an object variable - you cannot use it's value directly.

Try _IEPropertyGet($counter, "innertext")

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

somdcomputerguy's code worked great.

But now i wonder , if it possible if i click a button . Lets say "button" and then then msgbox will appear and tell me the count . with that code before . But i wont close the program and i just close msgbox. And i would like to get another msg if count will be higher than like 500.

I would like to use that program as backround program .

i click "button" then it shows count .

If count will get 500 then appears msgbox which tells that count has reached 500.

and the next would be like 1000. and so on.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
     Case $GUI_EVENT_CLOSE
     Exit
                 Case $button
     Local $Source = _INetGetSource("http://URL")
     Local $Var = _StringBetween($Source, '<a class="skill-popup-trigger" href="counter_details.php" rel="counting" id="counting_id">', '</a>')
     MsgBox(0, '', $Var[0])
    
     ; Waiting till count has reached 500.....[/color][/b]

[color=#282828] ; If $Var[0] = 500 then
     ; MsgBox(0, '',The count has reached $Var[0]) ; count has reached 500
; ElseIf $Var[0] = 1000 then
     ; MsgBox(0, '',The count has reached $Var[0]) ; count has reached 1000
; and so on ..
EndSwitch
Wend

Is is possible with that code ?

Edited by minaset
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...