Danp2 891 Posted November 16, 2020 Post your code again so that we can see your progress. [UDF] WebDriver Latest version Wiki FAQs Share this post Link to post Share on other sites
Valnurat 3 Posted November 16, 2020 Yes, of course. I do would like to know how I can catch how many seats there's for each trip. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <Constants.au3> #include <IE.au3> Local $sOrigin = "CPH", $sDest = "EWR", $sDepart = "20210117", $iAdult = 2 Local $sURL = "https://www.sas.dk/book/flights?search=OW_" & $sOrigin & "-" & $sDest & "-" & $sDepart & "_a" & $iAdult & _ "c0i0y0&view=upsell&bookingFlow=points&sortBy=stop&filterBy=all" Local $oIE = _IECreate($sURL), $oWarn, $oTable, $oTableTrs, $oOffers, $oTrs, $oTags, $oSpans For $i = 1 To 30 Sleep(100) $oWarn = _IEGetObjById ($oIE,"got-it") If Not @error Then ExitLoop Next If Not IsObj($oWarn) Then Exit ConsoleWrite("Unable to get warning screen") $oWarn.click() ;_IELoadWait($oIE) Sleep(5000) $oOffers = _IETagNameGetCollection($oIE, "offers") For $oOffer In $oOffers $oTrs = _IETagNameGetCollection($oOffer, "tr") For $oTr In $oTrs If $oTr.className = 'product-column-wrap' and $oTr.id <> '' Then $oTable = _GetObj($oIE, $oTr.id, 2000) If Not IsObj($oTable) Then Exit MsgBox ($MB_SYSTEMMODAL,"","Unable to get price table") $oTags = _IETagNameGetCollection($oTable,"p") For $oTag in $oTags If $oTag.innerText = "48 000" Then $oSpans = _IETagNameGetCollection($oTable,"span") For $oSpan In $oSpans ConsoleWrite ($oSpan.className & @CRLF) Next EndIf Next EndIf Next Next Func _GetObj (ByRef $oIE, $sStr, $iTime) Local $oObj For $i = 1 To Int($iTime/100) Sleep(100) $oObj = _IEGetObjById ($oIE, $sStr) If Not @error Then Return $oObj Next Return SetError(1, 0, 0) EndFunc For some reason the _IELoadWait($oIE) dos not work, so I use the sleep function. ConsoleWrite ($oSpan.className & @CRLF) I use for see what I get, but I don't get anything. Yours sincerelyKenneth. Share this post Link to post Share on other sites
Danp2 891 Posted November 16, 2020 Maybe this will help you towards your goal -- #include <IE.au3> Local $sOrigin = "CPH", $sDest = "EWR", $sDepart = "20210117", $iAdult = 2 Local $sURL = "https://www.sas.dk/book/flights?search=OW_" & $sOrigin & "-" & $sDest & "-" & $sDepart & "_a" & $iAdult & _ "c0i0y0&view=upsell&bookingFlow=points&sortBy=stop&filterBy=all" Local $oIE = _IECreate($sURL), $oWarn For $i = 1 To 30 Sleep(100) $oWarn = _IEGetObjById ($oIE,"got-it") If Not @error Then ExitLoop Next If Not IsObj($oWarn) Then Exit ConsoleWrite("Unable to get warning screen") $oWarn.click() Sleep(5000) $oOffers = _IETagNameGetCollection($oIE, "offers") For $oOffer In $oOffers ConsoleWrite($oOffer.firstChild.id & @crlf) $oTDs = _IETagNameGetCollection($oOffer, "TD") For $oTD IN $oTDs If StringInStr($oTD.className, "slide") Then ConsoleWrite($oTD.innerText & @CRLF) EndIf Next Next [UDF] WebDriver Latest version Wiki FAQs Share this post Link to post Share on other sites
Valnurat 3 Posted November 18, 2020 On 11/16/2020 at 11:32 PM, Danp2 said: Maybe this will help you towards your goal -- #include <IE.au3> Local $sOrigin = "CPH", $sDest = "EWR", $sDepart = "20210117", $iAdult = 2 Local $sURL = "https://www.sas.dk/book/flights?search=OW_" & $sOrigin & "-" & $sDest & "-" & $sDepart & "_a" & $iAdult & _ "c0i0y0&view=upsell&bookingFlow=points&sortBy=stop&filterBy=all" Local $oIE = _IECreate($sURL), $oWarn For $i = 1 To 30 Sleep(100) $oWarn = _IEGetObjById ($oIE,"got-it") If Not @error Then ExitLoop Next If Not IsObj($oWarn) Then Exit ConsoleWrite("Unable to get warning screen") $oWarn.click() Sleep(5000) $oOffers = _IETagNameGetCollection($oIE, "offers") For $oOffer In $oOffers ConsoleWrite($oOffer.firstChild.id & @crlf) $oTDs = _IETagNameGetCollection($oOffer, "TD") For $oTD IN $oTDs If StringInStr($oTD.className, "slide") Then ConsoleWrite($oTD.innerText & @CRLF) EndIf Next Next Yes, that did it. I can use this. Thank you. Yours sincerelyKenneth. Share this post Link to post Share on other sites
Valnurat 3 Posted November 18, 2020 I'm trying to use PushOver to send notifications to my phone, but according to https://support.pushover.net/i44-example-code-and-pushover-libraries I don't see anything related to AutoIT. How is it possible to send notifications by using this feature? Yours sincerelyKenneth. Share this post Link to post Share on other sites
Danp2 891 Posted November 18, 2020 You really expected them to provide an Autoit example?! 🤨 Your best bet is to translate the Windows command line or Powershell examples into Autoit. Should be able to do this using the WinHTTP UDF. [UDF] WebDriver Latest version Wiki FAQs Share this post Link to post Share on other sites
Danp2 891 Posted November 18, 2020 (edited) See here for prior Pushover / WinHTTP discussion -- P.S. You can find other examples if you use the forum's search feature. Edited November 18, 2020 by Danp2 [UDF] WebDriver Latest version Wiki FAQs Share this post Link to post Share on other sites
Valnurat 3 Posted November 18, 2020 No, but maybe something from the examples was useful, but thank you for the link. I will look into it. Yours sincerelyKenneth. Share this post Link to post Share on other sites
Valnurat 3 Posted November 18, 2020 Holy crap. 😲 #include "WinHttp.au3" $sAddress = "https://api.pushover.net/1/messages.json" $sApiToken = "av26ac2nAXLyPKg2QMy4zf9YcUjz2G" ; <-yours here $sUserKey = "uMQf396GvMgrsDroaryKEvVyWkgfkw" ; <-yours here $sMessage = "hello world" ; Construct the form Const $sForm = '<form action="' & $sAddress & '" method="post">' & _ '<input name="token" value="' & $sApiToken & '"/>' & _ '<input name="user" value="' & $sUserKey & '"/>' & _ '<input name="message" value="' & $sMessage & '"/>' & _ '</form>' ; Open session $hOpen = _WinHttpOpen() ; To collect connection handle (because the form is inlined) $hConnect = $sForm ; Fill the form $sRead = _WinHttpSimpleFormFill($hConnect, $hOpen) ; Close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Tada mtfk! MsgBox(4096, "Simon says", $sRead) This worked. 1 Danp2 reacted to this Yours sincerelyKenneth. Share this post Link to post Share on other sites
Valnurat 3 Posted November 22, 2020 (edited) I'm trying to stop the for..next loop when I press the stop button, but how can it be done? What I already did dos not do any good. I hope you can help me. 🙂 expandcollapse popup#include <Array.au3> #include <IE.au3> #include "WinHttp.au3" #include <GuiListBox.au3> #include <GUIConstantsEx.au3> #include <DateTimeConstants.au3> #include <File.au3> Local $aBase[15][2] = [["Copenhagen", "CPH"], ["Beijing", "PEK"], ["Boston", "BOS"], ["Chicago", "ORD"], ["Hong Kong", "HKG"], ["Los Angeles", "LAX"] _ ,["Miami", "MIA"], ["Manila", "MNL"], ["New Jersey", "EWR"], ["Oslo", "OSL"], ["San Francisco", "SFO"], ["Shanghai", "PVG"], ["Stockholm", "ARN"] _ ,["Tokyo", "NRK"], ["Washington", "IAD"]], $sFill, $aTmpRejser[0] ;_ArrayDisplay($aTmpRejser) Global $Rejserspath = "Rejser.txt" ; Create GUI GUICreate("MyProject", 400, 296) GUICtrlCreateLabel("Fra:",10,10) $idComboFra = GUICtrlCreateCombo("", 10, 25, 106, 25) For $i = 0 To UBound($aBase) -1 $sFill &= $aBase[$i][0] & "|" ; Note variables added as number datatype here Next $sFill = StringTrimRight($sFill, 1) GUICtrlSetData($idComboFra, $sFill, "Copenhagen") $sFill = "" GUICtrlCreateLabel("Til:",10,52) $idComboTil = GUICtrlCreateCombo("", 10, 68, 106, 25) For $i = 0 To UBound($aBase) -1 $sFill &= $aBase[$i][0] & "|" ; Note variables added as number datatype here Next $sFill = StringTrimRight($sFill, 1) GUICtrlSetData($idComboTil, $sFill, "Copenhagen") GUICtrlCreateLabel("Dato:",10,95) Local $idDate = GUICtrlCreateDate("" ,10, 110, 106, Default, $DTS_SHORTDATEFORMAT) $idMylist = GUICtrlCreateList("", 122, 10, 270, 170) Local $idButton_AddTrip = GUICtrlCreateButton("Add Trip", 10, 145, 105, 25) Local $idButton_Delete = GUICtrlCreateButton("Delete From List", 140, 180, 105, 25) Local $idButton_Mark = GUICtrlCreateButton("Marker", 270, 180, 105, 25) GUICtrlCreateLabel("Time to rerun",10,180) GUICtrlCreateInput("45", 10, 230, 30, 20) Local $idButton_Run = GUICtrlCreateButton("Start", 10, 260, 105, 25) GUISetState(@SW_SHOW) If FileExists($Rejserspath) Then _Fill_List() EndIf $state = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Local $sFill = "" For $i = 0 to _GUICtrlListBox_GetCount($idMylist) -1 $sFill &= _GUICtrlListBox_GetText($idMylist,$i) & "|" Next $sFill = StringTrimRight($sFill, 1) _ArrayAdd($aTmpRejser, $sFill) _FileWriteFromArray($Rejserspath, $aTmpRejser) ExitLoop Case $idButton_AddTrip $sOrigin = GUICtrlRead($idComboFra) $sOrigin = $aBase[_ArraySearch($aBase, $sOrigin, 0, 0, 0, 1, 1, 0)][1] $sDest = GUICtrlRead($idComboTil) $sDest = $aBase[_ArraySearch($aBase, $sDest, 0, 0, 0, 1, 1, 0)][1] _GUICtrlListBox_AddString($idMylist, "Fra: " & $sOrigin & " Til: " & $sDest & " Antal: 2" & " Afr: " & (GUICtrlRead($idDate) & " Ikke fundet")) ; Case $idButton_Clear ; GUICtrlSetData($idMylist, "") Case $idButton_Run If $state Then $state = 0 GUICtrlSetData($idButton_Run, "Start") ExitLoop Else $state = 1 GUICtrlSetData($idButton_Run, "Stop") For $i = 0 to _GUICtrlListBox_GetCount($idMylist) -1 $RDMSleep = Random(5,9,1) $RDMSleep = $RDMSleep & '000' Sleep($RDMSleep) ConsoleWrite(_GUICtrlListBox_GetText($idMylist,$i) & @CRLF) Next EndIf EndSwitch WEnd Func _Fill_List() ; Read the file into an array Local $array _FileReadToArray($rejserspath, $array) ; Check we read something If IsArray($array) Then ; Convert to a string with delimiters $sList = "" For $i = 1 To $array[0] $sList &= "|" & $array[$i] Next ; And fill the list GUICtrlSetData($idMylist, $sList) EndIf EndFunc Edited November 22, 2020 by Valnurat Yours sincerelyKenneth. Share this post Link to post Share on other sites
Nine 931 Posted November 22, 2020 Which For...Next loop ???? Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites
Danp2 891 Posted November 22, 2020 @Nine I'm sure he means the one in Case $idButton_Run, right after he changes the button text to "stop". 😎 @Valnurat You can't as written because the For...Next has to finish before the GUI will respond to anything again. [UDF] WebDriver Latest version Wiki FAQs Share this post Link to post Share on other sites
Valnurat 3 Posted November 23, 2020 (edited) @Danp2 Yes, it is true in the $idButton_Run. If that can't be done, how can I add a timer that re-run my for..next loop after 45 min with the option to break the timer instead of closing the application? Edited November 23, 2020 by Valnurat Yours sincerelyKenneth. Share this post Link to post Share on other sites
GokAy 60 Posted November 23, 2020 @Valnurat You can get time right before entering for-next and get time again each iteration of the loop, and do an if check for elapsed time. Another option might be adding a msgbox that appears every n iterations for a brief moment, ie, a couple of seconds. You should be able to achieve this by putting the msgbox inside an if statement which checks for (mathematical function) "mod ($i, n) = 0". You will have to figure out what would be approriate for n. Also, don't forget to put a timeout value for msgbox. MOD Function MsgBox ( flag, "title", "text" [, timeout = 0 [, hwnd]] ) Share this post Link to post Share on other sites
Nine 931 Posted November 23, 2020 (edited) I see. Then it is quite easy to extract the For loop from the Case statement and integrate a pseudo-loop outside the Switch statement. Something along those lines : expandcollapse popup#include <Array.au3> #include <IE.au3> ;#include "WinHttp.au3" #include <GuiListBox.au3> #include <GUIConstantsEx.au3> #include <DateTimeConstants.au3> #include <File.au3> Local $aBase[15][2] = [["Copenhagen", "CPH"], ["Beijing", "PEK"], ["Boston", "BOS"], ["Chicago", "ORD"], ["Hong Kong", "HKG"], ["Los Angeles", "LAX"] _ , ["Miami", "MIA"], ["Manila", "MNL"], ["New Jersey", "EWR"], ["Oslo", "OSL"], ["San Francisco", "SFO"], ["Shanghai", "PVG"], ["Stockholm", "ARN"] _ , ["Tokyo", "NRK"], ["Washington", "IAD"]], $sFill, $aTmpRejser[0] ;_ArrayDisplay($aTmpRejser) Global $Rejserspath = "Rejser.txt" ; Create GUI GUICreate("MyProject", 400, 296) GUICtrlCreateLabel("Fra:", 10, 10) $idComboFra = GUICtrlCreateCombo("", 10, 25, 106, 25) For $i = 0 To UBound($aBase) - 1 $sFill &= $aBase[$i][0] & "|" ; Note variables added as number datatype here Next $sFill = StringTrimRight($sFill, 1) GUICtrlSetData($idComboFra, $sFill, "Copenhagen") $sFill = "" GUICtrlCreateLabel("Til:", 10, 52) $idComboTil = GUICtrlCreateCombo("", 10, 68, 106, 25) For $i = 0 To UBound($aBase) - 1 $sFill &= $aBase[$i][0] & "|" ; Note variables added as number datatype here Next $sFill = StringTrimRight($sFill, 1) GUICtrlSetData($idComboTil, $sFill, "Copenhagen") GUICtrlCreateLabel("Dato:", 10, 95) Local $idDate = GUICtrlCreateDate("", 10, 110, 106, Default, $DTS_SHORTDATEFORMAT) $idMylist = GUICtrlCreateList("", 122, 10, 270, 170) Local $idButton_AddTrip = GUICtrlCreateButton("Add Trip", 10, 145, 105, 25) Local $idButton_Delete = GUICtrlCreateButton("Delete From List", 140, 180, 105, 25) Local $idButton_Mark = GUICtrlCreateButton("Marker", 270, 180, 105, 25) GUICtrlCreateLabel("Time to rerun", 10, 180) GUICtrlCreateInput("45", 10, 230, 30, 20) Local $idButton_Run = GUICtrlCreateButton("Start", 10, 260, 105, 25) GUISetState(@SW_SHOW) If FileExists($Rejserspath) Then _Fill_List() EndIf Local $state = 0, $indx While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Local $sFill = "" For $i = 0 To _GUICtrlListBox_GetCount($idMylist) - 1 $sFill &= _GUICtrlListBox_GetText($idMylist, $i) & "|" Next $sFill = StringTrimRight($sFill, 1) _ArrayAdd($aTmpRejser, $sFill) _FileWriteFromArray($Rejserspath, $aTmpRejser) ExitLoop Case $idButton_AddTrip $sOrigin = GUICtrlRead($idComboFra) $sOrigin = $aBase[_ArraySearch($aBase, $sOrigin, 0, 0, 0, 1, 1, 0)][1] $sDest = GUICtrlRead($idComboTil) $sDest = $aBase[_ArraySearch($aBase, $sDest, 0, 0, 0, 1, 1, 0)][1] _GUICtrlListBox_AddString($idMylist, "Fra: " & $sOrigin & " Til: " & $sDest & " Antal: 2" & " Afr: " & (GUICtrlRead($idDate) & " Ikke fundet")) ; Case $idButton_Clear ; GUICtrlSetData($idMylist, "") Case $idButton_Run If $state Then $state = 0 GUICtrlSetData($idButton_Run, "Start") ;ExitLoop Else $state = 1 $indx = 0 GUICtrlSetData($idButton_Run, "Stop") EndIf EndSwitch If $state Then ;ConsoleWrite ("started" & @CRLF) If $indx < _GUICtrlListBox_GetCount($idMylist) Then $RDMSleep = Random(5, 9, 1) $RDMSleep = $RDMSleep * 1000 Sleep($RDMSleep) ConsoleWrite(_GUICtrlListBox_GetText($idMylist, $indx) & @CRLF) $indx += 1 Else $state = 0 GUICtrlSetData($idButton_Run, "Start") EndIf EndIf WEnd Func _Fill_List() ; Read the file into an array Local $array _FileReadToArray($Rejserspath, $array) ; Check we read something If IsArray($array) Then ; Convert to a string with delimiters $sList = "" For $i = 1 To $array[0] $sList &= "|" & $array[$i] Next ; And fill the list GUICtrlSetData($idMylist, $sList) EndIf EndFunc ;==>_Fill_List But beware of the Sleep. It will force you to wait till it is completed, unless... Edited November 23, 2020 by Nine Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites
Valnurat 3 Posted November 23, 2020 Thank you, but it does not stop the for..next loop when I press the "stop" button. It just go through all lines in my list and then stop and change the name to "Start" and then I need to press the "Start" button again to do another run. I was hoping it could do a new run after 45 min. for an example, but I would like to press the "stop" button no matter where in the for..next loop or in the next new run, but if it can't break the for..next while it is running, then maybe it could break in the timer. Yours sincerelyKenneth. Share this post Link to post Share on other sites
Nine 931 Posted November 23, 2020 Do you mean my code is not working or have you not try it ? Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites
Valnurat 3 Posted November 23, 2020 Yes, your code does as I described. I can't stop it. If I press the stop button, while it is in progress, it thinks I pressed the start button again and go through the list 1 more time. Yours sincerelyKenneth. Share this post Link to post Share on other sites
Nine 931 Posted November 23, 2020 It is because of the Sleep. If you click when it is on Sleep, the click is not registered. Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites
Nine 931 Posted November 23, 2020 Here one way how to remove the Sleep and make it work : expandcollapse popup#include <Array.au3> #include <IE.au3> ;#include "WinHttp.au3" #include <GuiListBox.au3> #include <GUIConstantsEx.au3> #include <DateTimeConstants.au3> #include <File.au3> Local $aBase[15][2] = [["Copenhagen", "CPH"], ["Beijing", "PEK"], ["Boston", "BOS"], ["Chicago", "ORD"], ["Hong Kong", "HKG"], ["Los Angeles", "LAX"] _ , ["Miami", "MIA"], ["Manila", "MNL"], ["New Jersey", "EWR"], ["Oslo", "OSL"], ["San Francisco", "SFO"], ["Shanghai", "PVG"], ["Stockholm", "ARN"] _ , ["Tokyo", "NRK"], ["Washington", "IAD"]], $sFill, $aTmpRejser[0] ;_ArrayDisplay($aTmpRejser) Global $Rejserspath = "Rejser.txt" ; Create GUI GUICreate("MyProject", 400, 296) GUICtrlCreateLabel("Fra:", 10, 10) $idComboFra = GUICtrlCreateCombo("", 10, 25, 106, 25) For $i = 0 To UBound($aBase) - 1 $sFill &= $aBase[$i][0] & "|" ; Note variables added as number datatype here Next $sFill = StringTrimRight($sFill, 1) GUICtrlSetData($idComboFra, $sFill, "Copenhagen") $sFill = "" GUICtrlCreateLabel("Til:", 10, 52) $idComboTil = GUICtrlCreateCombo("", 10, 68, 106, 25) For $i = 0 To UBound($aBase) - 1 $sFill &= $aBase[$i][0] & "|" ; Note variables added as number datatype here Next $sFill = StringTrimRight($sFill, 1) GUICtrlSetData($idComboTil, $sFill, "Copenhagen") GUICtrlCreateLabel("Dato:", 10, 95) Local $idDate = GUICtrlCreateDate("", 10, 110, 106, Default, $DTS_SHORTDATEFORMAT) $idMylist = GUICtrlCreateList("", 122, 10, 270, 170) Local $idButton_AddTrip = GUICtrlCreateButton("Add Trip", 10, 145, 105, 25) Local $idButton_Delete = GUICtrlCreateButton("Delete From List", 140, 180, 105, 25) Local $idButton_Mark = GUICtrlCreateButton("Marker", 270, 180, 105, 25) GUICtrlCreateLabel("Time to rerun", 10, 180) GUICtrlCreateInput("45", 10, 230, 30, 20) Local $idButton_Run = GUICtrlCreateButton("Start", 10, 260, 105, 25) GUISetState(@SW_SHOW) If FileExists($Rejserspath) Then _Fill_List() EndIf Local $state, $indx, $cal While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Local $sFill = "" For $i = 0 To _GUICtrlListBox_GetCount($idMylist) - 1 $sFill &= _GUICtrlListBox_GetText($idMylist, $i) & "|" Next $sFill = StringTrimRight($sFill, 1) _ArrayAdd($aTmpRejser, $sFill) _FileWriteFromArray($Rejserspath, $aTmpRejser) ExitLoop Case $idButton_AddTrip $sOrigin = GUICtrlRead($idComboFra) $sOrigin = $aBase[_ArraySearch($aBase, $sOrigin, 0, 0, 0, 1, 1, 0)][1] $sDest = GUICtrlRead($idComboTil) $sDest = $aBase[_ArraySearch($aBase, $sDest, 0, 0, 0, 1, 1, 0)][1] _GUICtrlListBox_AddString($idMylist, "Fra: " & $sOrigin & " Til: " & $sDest & " Antal: 2" & " Afr: " & (GUICtrlRead($idDate) & " Ikke fundet")) ; Case $idButton_Clear ; GUICtrlSetData($idMylist, "") Case $idButton_Run If $state Then $state = 0 GUICtrlSetData($idButton_Run, "Start") Else $state = 1 $indx = 0 $cal = 0 GUICtrlSetData($idButton_Run, "Stop") EndIf EndSwitch If $state Then If $indx < _GUICtrlListBox_GetCount($idMylist) Then If Not $cal Then $RDMSleep = Random(2, 4, 1) * 1000 $hTimer = TimerInit() $cal = 1 ElseIf TimerDiff($hTimer) > $RDMSleep Then ConsoleWrite(_GUICtrlListBox_GetText($idMylist, $indx) & @CRLF) $indx += 1 $cal = 0 EndIf Else $state = 0 GUICtrlSetData($idButton_Run, "Start") EndIf EndIf WEnd Func _Fill_List() ; Read the file into an array Local $array _FileReadToArray($Rejserspath, $array) ; Check we read something If IsArray($array) Then ; Convert to a string with delimiters $sList = "" For $i = 1 To $array[0] $sList &= "|" & $array[$i] Next ; And fill the list GUICtrlSetData($idMylist, $sList) EndIf EndFunc ;==>_Fill_List Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites