Jump to content
Sign in to follow this  
vi6ora

No idea how.

Recommended Posts

vi6ora

Hi. Can someone tell me if this is possible in autoit. I want AutoIt to read the info from a page and add it to proggressbar.

For example. I want autoit to check this page http://my-trac.assembla.com/aion-emu/milestone/AE%20Stage%20II. There is an progressbar with percentages. Is it possible to get the info from this progress bar and percentages and put the into an autoit progressbar with percentages.

Share this post


Link to post
Share on other sites
bo8ster

Many things are possible. For web stuff, look at the IE and FF libraries.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
vi6ora

Well i read them but i cant do it.

Can you atleast give me an example.

Share this post


Link to post
Share on other sites
Nutster

I have written scripts that read the HTML on the page and then look for certain tags using the regular expression mechanism. What I did was download the web page using InetGet than look for the tags that I was interested in, in my case "<A ...>". If you understand HTML, you might want to try something like this.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites
jvanegmond

This example comes with the price of learning. You're supposed to repair the simple mistake.

#include <Inet.au3>

$url = http://my-trac.assembla.com/aion-emu/milestone/AE%20Stage%20II

$src = _INetGetSource($url)

$regexp = StringRegExp($src, '<p class="percent">([0-9]*)%</p>', 1)
$percentage = $regexp[0]

MsgBox(0,"", $percentage)

Share this post


Link to post
Share on other sites
vi6ora

Thanks alot. Now i am having hard time to add it into an progress bar.

Here is my script:

#include <Inet.au3>

$url = "http://my-trac.assembla.com/aion-emu/milestone/AE%20Stage%20II"

$src = _INetGetSource($url)

$regexp = StringRegExp($src, '<p class="percent">([0-9]*)%</p>', 1)
$percentage = $regexp[0]



ProgressOn("Progress Meter", "Increments every second", "0 percent")
 For $i = $percentage to $percentage
    ProgressSet($i, $i & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
Edited by vi6ora

Share this post


Link to post
Share on other sites
vi6ora

nvm. I fixed it myself.

#include <Inet.au3>

$url = "http://my-trac.assembla.com/aion-emu/milestone/AE%20Stage%20II"

$src = _INetGetSource($url)

$regexp = StringRegExp($src, '<p class="percent">([0-9]*)%</p>', 1)
$percentage = $regexp[0]
GUICreate("Progress", 300, 100)
GuiCtrlCreateLabel( "Server Working progress is: " & $percentage, 0, 30, 200, 200)
$progress = GUICtrlCreateProgress(0, 0, 100, 20)
GUISetState()


While $percentage
    GUICtrlSetData($progress, $percentage)
WEnd
Edited by vi6ora

Share this post


Link to post
Share on other sites
jvanegmond

nvm. I fixed it myself.

#include <Inet.au3>

$url = "http://my-trac.assembla.com/aion-emu/milestone/AE%20Stage%20II"

$src = _INetGetSource($url)

$regexp = StringRegExp($src, '<p class="percent">([0-9]*)%</p>', 1)
$percentage = $regexp[0]
GUICreate("Progress", 300, 100)
GuiCtrlCreateLabel( "Server Working progress is: " & $percentage, 0, 30, 200, 200)
$progress = GUICtrlCreateProgress(0, 0, 100, 20)
GUISetState()


While $percentage
    GUICtrlSetData($progress, $percentage)
WEnd

In your script $percentage is never updated and the data is set constantly.

Try this:

#include <Inet.au3>

$url = "http://my-trac.assembla.com/aion-emu/milestone/AE%20Stage%20II"

$hwnd = GUICreate("Progress", 300, 100)
GuiCtrlCreateLabel( "Server Working progress is: " & $percentage, 0, 30, 200, 200)
$progressbar = GUICtrlCreateProgress(0, 0, 100, 20)
GUISetState()


While GUIGetMsg() <> -3 ; wait until close is pressed
    GUICtrlSetData( $progressbar, _GetPercentageComplete($url) )
    Sleep(500)
WEnd

Func _GetPercentageComplete($url)
    $src = _INetGetSource($url)

    $regexp = StringRegExp($src, '<p class="percent">([0-9]*)%</p>', 1)
    $percentage = $regexp[0]

    Return $percentage
EndFunc

Share this post


Link to post
Share on other sites
vi6ora

Thanks but when i run it the progress bar loads as it should but it says: Server working progress: . It doesnt show the percentages

EDIT: I am so dumbass. I forgot to edit it >_<. I fixed it. Thanks alot.

#include <Inet.au3>


Global $percentage
$url = "http://my-trac.assembla.com/aion-emu/milestone/AE%20Stage%20II"

$hwnd = GUICreate("Progress", 300, 100)
GuiCtrlCreateLabel( "Server Working progress is: " & _GetPercentageComplete($url), 0, 30, 200, 200)
$progressbar = GUICtrlCreateProgress(0, 0, 100, 20)
GUISetState()


While GUIGetMsg() <> -3 ; wait until close is pressed
    GUICtrlSetData( $progressbar, _GetPercentageComplete($url))
Sleep(500)
WEnd



Func _GetPercentageComplete($url)
    $src = _INetGetSource($url)

    $regexp = StringRegExp($src, '<p class="percent">([0-9]*)%</p>', 1)
    $percentage = $regexp[0]

    Return $percentage
EndFunc
Edited by vi6ora

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  

×