Jump to content

Autorefresh


Recommended Posts

I have a problem..I created a script with a GUI; it take a value from an internet site and return me on a label...I would like it automatically refresh every 1 minute..Which is the string to use?

Link to comment
Share on other sites

  • Moderators

I have a problem..I created a script with a GUI; it take a value from an internet site and return me on a label...I would like it automatically refresh every 1 minute..Which is the string to use?

We are to assume you are using IE.au3 right? You might want to think about that 1 second thing, how long does your browser take to actually reload the page on a refresh? Some take longer than 1 second, so you could be in an endless loop with no information gathered. Just a thought anyway.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

We are to assume you are using IE.au3 right? You might want to think about that 1 second thing, how long does your browser take to actually reload the page on a refresh? Some take longer than 1 second, so you could be in an endless loop with no information gathered. Just a thought anyway.

Yes, I'm using IE.au3

But I would like it refresh every 1 minute, and not every 1 second.. :D

Link to comment
Share on other sites

  • Moderators

Yes, I'm using IE.au3

But I would like it refresh every 1 minute, and not every 1 second.. :D

:P My interpretation skills were not so good right there :D

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hi,

where is the problem? can you show your script? I don't get why you cannot pull the info every minute instaed of sec?

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

where is the problem? Yan you show your script? I don't get why you cannot pull the info every minute instaed of sec?

So long,

Mega

I would like to start with 1 minute, then maybe I will change it

The code is:

#include <GuiConstants.au3>
#include <Array.au3>
#include <GuiListView.au3>
#include <GuiTab.au3>

;GUI
GuiCreate("Programma di borsa", 1000, 700,0, 0 , _ 
$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS )
GuiSetIcon(@SystemDir & "\notepad.exe", 0)


$filemenu = GuiCtrlCreateMenu("File")
$fileitem = GuiCtrlCreateMenuItem("Apri", $filemenu)
$fileitem2 = GuiCtrlCreateMenuItem("Salva", $filemenu)
$fileitem3 = GuiCtrlCreateMenuItem("Salva con nome", $filemenu)
$fileitem4 = GuiCtrlCreateMenuItem("Chiudi", $filemenu)
$fileitem5 = GuiCtrlCreateMenuItem("Esci", $filemenu)
$modificamenu = GuiCtrlCreateMenu("Modifica")
$modificaitem = GuiCtrlCreateMenuItem("Annulla", $modificamenu)
$modificaitem2 = GuiCtrlCreateMenuItem("Taglia", $modificamenu)
$modificaitem3 = GuiCtrlCreateMenuItem("Copia", $modificamenu)
$modificaitem4 = GuiCtrlCreateMenuItem("Incolla", $modificamenu)
$modificaitem5 = GuiCtrlCreateMenuItem("Seleziona tutto", $modificamenu)

$button1 = GuiCtrlCreateButton("1", 0, 0, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 5)
$button2 = GuiCtrlCreateButton("2", 0, 40, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 6)
$button3 = GuiCtrlCreateButton("2", 0, 80, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 2)
$button4 = GuiCtrlCreateButton("2", 0, 120, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 8)
$button5 = GuiCtrlCreateButton("2", 0, 160, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 1)
$button6 = GuiCtrlCreateButton("2", 0, 200, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 10)
$button7 = GuiCtrlCreateButton("2", 0, 240, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 11)
$button8 = GuiCtrlCreateButton("2", 0, 280, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 8)
$button9 = GuiCtrlCreateButton("2", 0, 320, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 2)
$button10 = GuiCtrlCreateButton("2", 0, 360, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 14)

GUICtrlCreateLabel("", 41, 0, 960, 700)
GUICtrlSetBkColor(-1, 0x000000)

GuiSetState()

InetGet ( "http://www.borsaitalia.it/bitApp/scheda.bit?target=IndexDetail&isin=IS945&lang=it", "c:\prova\pagina.txt", 1)
$fil = FileRead("C:\prova\pagina.txt", 100000)
$cerca = StringInStr ( $fil, "Ultimo Valore:")
$parti = StringMid ( $fil, $cerca, 42)
$valore = StringMid($parti, 31, 6)


GuiCtrlCreateLabel("ITALIA: S&P/Mib:", 41, 0, 120, 17)
GUICtrlSetBkColor(-1, 0x33CCFF)
GuiCtrlCreateLabel($valore, 167, 0, 50, 17)
GUICtrlSetBkColor(-1, 0x99FF99)

If $valore = 1 Then
    $valore = $valore
Else
    InetGet ( "http://www.borsaitalia.it/bitApp/scheda.bit?target=IndexDetail&isin=IS945&lang=it", "c:\prova\pagina.txt", 1)
$fil = FileRead("C:\prova\pagina.txt", 100000)
$cerca = StringInStr ( $fil, "Ultimo Valore:")
$parti = StringMid ( $fil, $cerca, 42)
$valore = StringMid($parti, 31, 6)
Endif

GuiCtrlCreateLabel("Ultimo aggiornamento " & @HOUR & ":" & @MIN & ":" & @SEC, 600, 0, 200, 17)
GUICtrlSetBkColor(-1, 0x99FF99)

InetGet ( "http://www.borsaitalia.it/bitApp/scheda.bit?target=IndexDetail&isin=IS945&lang=it", "c:\prova\pagina1.txt", 1)
$fil1 = FileRead("C:\prova\pagina1.txt", 100000)
$cerca1 = StringInStr ( $fil1, "Var %:")
$parti1 = StringMid ( $fil1, $cerca1, 55)
$valore1 = StringMid($parti1, 25, 7)

GuiCtrlCreateLabel("Variazione%:", 223, 0, 80, 17)
GUICtrlSetBkColor(-1, 0x33CCFF)
GuiCtrlCreateLabel($valore1, 309, 0, 50, 17)
GUICtrlSetBkColor(-1, 0x99FF99)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

As you can see, it takea value from a web site...But I don't know how to repeat this operation every X seconds (or minutes)

Edited by polto
Link to comment
Share on other sites

just a side question ?

why not just use _INetGetSource instead of this very WRONG way.

InetGet ( "http://www.borsaitalia.it/bitApp/scheda.bit?target=IndexDetail&isin=IS945&lang=it", "c:\prova\pagina1.txt", 1)

$fil1 = FileRead("C:\prova\pagina1.txt", 100000)

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

just a side question ?

why not just use _INetGetSource instead of this very WRONG way.

InetGet ( "http://www.borsaitalia.it/bitApp/scheda.bit?target=IndexDetail&isin=IS945&lang=it", "c:\prova\pagina1.txt", 1)

$fil1 = FileRead("C:\prova\pagina1.txt", 100000)

Because I don't know this function....But I'm ok whith this, but the problem is that I can't repeat the operation..How can I do?

Link to comment
Share on other sites

Because I don't know this function....But I'm ok whith this, but the problem is that I can't repeat the operation..How can I do?

What I would like to do is to set a cell in wich user can modify the time for repeat the operation...I can'f find anithing about it, I tried to search in AutoIt Help and in Search Forum, but I didn't find anything

Link to comment
Share on other sites

What I would like to do is to set a cell in wich user can modify the time for repeat the operation...I can'f find anithing about it, I tried to search in AutoIt Help and in Search Forum, but I didn't find anything

Hi,

what about making a func which is called when user hits a button? That should do the trick.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I prefer it change automatically...It is not possible?

HI,

of course it is. Just make a func out of the stuff getting info from web and update the label. Call the func whenever you want. With adlib you can call it every 250 ms.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

HI,

of course it is. Just make a func out of the stuff getting info from web and update the label. Call the func whenever you want. With adlib you can call it every 250 ms.

So long,

Mega

I'm sure you know this mega but for clarity.

Adlib can be called with any timespan you like, just ... am i gonna say it?.. look at the help file. lol.

Link to comment
Share on other sites

I'm sure you know this mega but for clarity.

Adlib can be called with any timespan you like, just ... am i gonna say it?.. look at the help file. lol.

HI,

yes i knew it. :D the sentence I wrote is a bit misleading, I guess. :D

Thanks for clarification.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

This is the problem..Which command I have to use to update the label?

I need the same command than you to test the availlability of a server and I want to put the updated value all minutes.

I have try to find a time function that fit but don't find it. If an expert can give us an example we will be very happy :-)

Link to comment
Share on other sites

Hi,

have a look at GUICtrlSetData()

So long,

Mega

PS: If that doesn't help you, I will post an example.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

have a look at GUICtrlSetData()

So long,

Mega

PS: If that doesn't help you, I will post an example.

Is this?

GUICtrlSetData ( controlID, data [, default] )

What is the ControlID? I saw that, in an example, AutoIt Help inserted "-1": what mean?

I don't understand how this command help to automatically refresh the label.. :D

Link to comment
Share on other sites

For me it's OK using GUICtrlSetData() and AdlibEnable()

Thanks a lot

I tried in this way:

#include <GuiConstants.au3>
#include <Array.au3>
#include <GuiListView.au3>
#include <GuiTab.au3>

;GUI
GuiCreate("Programma di borsa", 1000, 700,0, 0 , _ 
$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS )
GuiSetIcon(@SystemDir & "\notepad.exe", 0)


$filemenu = GuiCtrlCreateMenu("File")
$fileitem = GuiCtrlCreateMenuItem("Apri", $filemenu)
$fileitem2 = GuiCtrlCreateMenuItem("Salva", $filemenu)
$fileitem3 = GuiCtrlCreateMenuItem("Salva con nome", $filemenu)
$fileitem4 = GuiCtrlCreateMenuItem("Chiudi", $filemenu)
$fileitem5 = GuiCtrlCreateMenuItem("Esci", $filemenu)
$modificamenu = GuiCtrlCreateMenu("Modifica")
$modificaitem = GuiCtrlCreateMenuItem("Annulla", $modificamenu)
$modificaitem2 = GuiCtrlCreateMenuItem("Taglia", $modificamenu)
$modificaitem3 = GuiCtrlCreateMenuItem("Copia", $modificamenu)
$modificaitem4 = GuiCtrlCreateMenuItem("Incolla", $modificamenu)
$modificaitem5 = GuiCtrlCreateMenuItem("Seleziona tutto", $modificamenu)

$button1 = GuiCtrlCreateButton("1", 0, 0, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 5)
$button2 = GuiCtrlCreateButton("2", 0, 40, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 6)
$button3 = GuiCtrlCreateButton("2", 0, 80, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 2)
$button4 = GuiCtrlCreateButton("2", 0, 120, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 8)
$button5 = GuiCtrlCreateButton("2", 0, 160, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 1)
$button6 = GuiCtrlCreateButton("2", 0, 200, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 10)
$button7 = GuiCtrlCreateButton("2", 0, 240, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 11)
$button8 = GuiCtrlCreateButton("2", 0, 280, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 8)
$button9 = GuiCtrlCreateButton("2", 0, 320, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 2)
$button10 = GuiCtrlCreateButton("2", 0, 360, 40, 40, $BS_ICON)
GuiCtrlSetImage (-1, "shell32.dll", 14)

GUICtrlCreateLabel("", 41, 0, 960, 700)
GUICtrlSetBkColor(-1, 0x000000)

GuiSetState()

Func Prima ()
InetGet ( "http://www.borsaitalia.it/bitApp/scheda.bit?target=IndexDetail&isin=IS945&lang=it", "c:\prova\pagina.txt", 1)
$fil = FileRead("C:\prova\pagina.txt", 100000)
$cerca = StringInStr ( $fil, "Ultimo Valore:")
$parti = StringMid ( $fil, $cerca, 42)
$valore = StringMid($parti, 31, 6)


GuiCtrlCreateLabel("ITALIA: S&P/Mib:", 41, 0, 120, 17)
GUICtrlSetBkColor(-1, 0x33CCFF)
GuiCtrlCreateLabel($valore, 167, 0, 50, 17)
GUICtrlSetBkColor(-1, 0x99FF99)
EndFunc 

AdlibEnable("Prima", 5900)

GuiSetState()

Func Seconda ()
InetGet ( "http://www.borsaitalia.it/bitApp/scheda.bit?target=IndexDetail&isin=IS945&lang=it", "c:\prova\pagina1.txt", 1)
$fil1 = FileRead("C:\prova\pagina1.txt", 100000)
$cerca1 = StringInStr ( $fil1, "Var %:")
$parti1 = StringMid ( $fil1, $cerca1, 55)
$valore1 = StringMid($parti1, 25, 7)

GuiCtrlCreateLabel("Variazione%:", 223, 0, 80, 17)
GUICtrlSetBkColor(-1, 0x33CCFF)
GuiCtrlCreateLabel($valore1, 309, 0, 50, 17)
GUICtrlSetBkColor(-1, 0x99FF99)
EndFunc

AdlibEnable("Seconda", 5900)


GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

But it works only for Func Prima and not for Func Seconda..While, if I cancel Func Prima, then Func Seconda works..Why? :D

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