luckyluke Posted October 8, 2008 Share Posted October 8, 2008 Here my code: While 1 $temp = GUICtrlRead(GUICtrlRead($listview1)) If $temp == 0 Then Else Call("getinfo") EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func getinfo() EndFunc How to call function getinfo() only one time when $temp <> 0 ??? Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 8, 2008 Share Posted October 8, 2008 If you only need it once it would be easier to place the function call before your while loop. If you must have it in your while loop then try something like this. CODEWhile 1 $temp = GUICtrlRead($listview1) ;only need to read it once. If $temp = 0 Then Else Call("getinfo") $temp = 0 EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitchWEndFunc getinfo()EndFunc Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
erik7426 Posted October 8, 2008 Share Posted October 8, 2008 Here my code: While 1 $temp = GUICtrlRead(GUICtrlRead($listview1)) If $temp == 0 Then Else Call("getinfo") EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func getinfo() EndFunc How to call function getinfo() only one time when $temp <> 0 ??? Try $counter = 0 While 1 $temp = GUICtrlRead(GUICtrlRead($listview1)) If $temp == 0 Then Else If $counter = 0 Then Call("getinfo") $counter = $counter + 1 EndIf EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func getinfo() EndFunc Link to comment Share on other sites More sharing options...
ken82m Posted October 8, 2008 Share Posted October 8, 2008 (edited) Try this something simple I commonly do in similiar cases Basically your just counting the loops and using an if statement so it only runs while $Loop = 1 being the first time it runs. $Loop = 0 While 1 $Loop = $Loop + 1 If $Loop = 1 Then ;One Time Commands EndIf $temp = GUICtrlRead(GUICtrlRead($listview1)) If $temp == 0 Then Else Call("getinfo") EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited October 8, 2008 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
ken82m Posted October 8, 2008 Share Posted October 8, 2008 (edited) nevermind, almost the same thing erik just gave you really. Kenny Edited October 8, 2008 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
luckyluke Posted October 9, 2008 Author Share Posted October 9, 2008 thanks all, but how to get one time commands when $temp change from GUICtrlRead($listview1) Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 9, 2008 Share Posted October 9, 2008 Case GUICtrlRead($listview1) Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Skruge Posted October 9, 2008 Share Posted October 9, 2008 thanks all, but how to get one time commands when $temp change from GUICtrlRead($listview1) Can you rephrase your question and perhaps give some examples? It's a little ambiguous and I'm not sure if the nested GUICtrlRead's are intended. Here's how I would interpret it, based on your original post and your last reply: "How can I trigger a function every time the value in $listview1 changes? (Different Control is listed)" $LastControl = GUICtrlRead($listview1) While 1 If $LastControl <> GUICtrlRead($listview1) Then $LastControl = GUICtrlRead($listview1) getinfo() EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndoÝ÷ Ø mz¹Úµérªê-jr-®( z¶ºw-Þ½êò¶)¶¯j[{ayÊ'¶º%çÞéÜyÖòÓ~¥Ëoì5r§ëjg¢{k¢Pâ}÷«z{oj[ªê-jëh×6$LastValue = GUICtrlRead(GUICtrlRead($listview1)) While 1 If $LastValue <> GUICtrlRead(GUICtrlRead($listview1)) Then $LastValue = GUICtrlRead(GUICtrlRead($listview1)) getinfo() EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
luckyluke Posted October 9, 2008 Author Share Posted October 9, 2008 I'm done, thank Skruge. Here my code: expandcollapse popup#include <GUIConstants.au3> #include <String.au3> #include <array.au3> #include <INet.au3> $Form1 = GUICreate("Comic.vuilen.com", 633, 447, 193, 125) ;$Edit1 = GUICtrlCreateEdit("", 16, 16, 289, 409) GUICtrlSetData(-1, "") $listview1 = GUICtrlCreateListView(" STT | Booklist ", 16, 16, 289, 409) $Group1 = GUICtrlCreateGroup("Group1", 328, 25, 281, 145) $Label1 = GUICtrlCreateLabel("Info", 328, 25, 59, 20) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Part", 352, 64, 43, 20) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("Status", 352, 112, 63, 20) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("", 480, 60, 100, 80) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") $Label4 = GUICtrlCreateLabel("", 480, 64, 100, 20) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) Global $book, $temp Global $bookid[5] $files = _INetGetSource('http://comic.vuilen.com/') $aArray1 = _StringBetween($files, "<option value='viewbook.php?bookid=", "</option>");Not using SRE _ArrayAdd($aArray1, "EndOfList") $book = _ArraySearch($aArray1, "EndOfList") For $i = 0 To ($book-1) $array = StringSplit($aArray1[$i], ">") GUICtrlCreateListViewItem(& ($i+1)"|" & $array[2] , $listview1) GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping Next $temp = GUICtrlRead(GUICtrlRead($listview1)) MsgBox(0,"", $temp) While 1 If $temp <> GUICtrlRead($listview1) Then $temp = GUICtrlRead(GUICtrlRead($listview1)) call("getinfo") EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func getinfo() For $i = 0 To ($book-1) $select = StringSplit($temp, "|") $bookid = StringSplit($aArray1[$select[1]-1], "'") ExitLoop Next $info = _INetGetSource("http://comic.vuilen.com/viewbook.php?bookid="& $bookid[1]) $aArray2 = _StringBetween($info, '<tr class="thead"><td ><b>', "</b></td><tr>") $state = StringSplit($aArray2[0], "-") GUICtrlSetData($Label5, $state[3]) GUICtrlSetData($Label4, $state[2]) EndFunc One last question: How to display my language (vietnamese) in autoit ???. I have been chosen file>encoding>UTF-8 but nothing change. Link to comment Share on other sites More sharing options...
luckyluke Posted October 9, 2008 Author Share Posted October 9, 2008 I'm done, thank Skruge. Here my code: expandcollapse popup#include <GUIConstants.au3> #include <String.au3> #include <array.au3> #include <INet.au3> $Form1 = GUICreate("Comic.vuilen.com", 633, 447, 193, 125) GUICtrlSetData(-1, "") $listview1 = GUICtrlCreateListView(" STT | Booklist ", 16, 16, 289, 409) $Group1 = GUICtrlCreateGroup("Group1", 328, 25, 281, 145) $Label1 = GUICtrlCreateLabel("Info", 328, 25, 59, 20) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Part", 352, 64, 43, 20) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("Status", 352, 112, 63, 20) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("", 480, 60, 100, 80) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") $Label4 = GUICtrlCreateLabel("", 480, 64, 100, 20) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) Global $book, $temp Global $bookid[5] $files = _INetGetSource('http://comic.vuilen.com/') $aArray1 = _StringBetween($files, "<option value='viewbook.php?bookid=", "</option>");Not using SRE _ArrayAdd($aArray1, "EndOfList") $book = _ArraySearch($aArray1, "EndOfList") ;#cs For $i = 0 To ($book-1) $array = StringSplit($aArray1[$i], ">") GUICtrlCreateListViewItem(& ($i+1)"|" & $array[2] , $listview1) GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping Next ;#ce $temp1 = GUICtrlRead($listview1) MsgBox(0,"", $temp) While 1 If $temp1 <> GUICtrlRead($listview1) Then $temp1 = GUICtrlRead($listview1) $temp = GUICtrlRead(GUICtrlRead($listview1)) call("getinfo") EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func getinfo() For $i = 0 To ($book-1) $select = StringSplit($temp, "|") $bookid = StringSplit($aArray1[$select[1]-1], "'") ExitLoop Next $info = _INetGetSource("http://comic.vuilen.com/viewbook.php?bookid="& $bookid[1]) $aArray2 = _StringBetween($info, '<tr class="thead"><td ><b>', "</b></td><tr>") $state = StringSplit($aArray2[0], "-") GUICtrlSetData($Label5, $state[3]) GUICtrlSetData($Label4, $state[2]) EndFunc One last question: How to display my language (vietnamese) in autoit ???. I have been chosen file>encoding>UTF-8 but nothing change. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now