Tripoz Posted June 29, 2015 Share Posted June 29, 2015 (edited) Sooo let's get to my question: I made a program which imports Data from a website with a little help from this forum and now it's finally working. BUT the problem is, it only works when the data is available, so if the owner of a property decides not to give the exact adress/data, it will print an error and stop workingFinally my question: Does anyone know how to make the program skip not existing values or bypass the error ? I would be soooo thankful if someone could help me!my GUI Code:expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <Array.au3> #include <IE.au3> #include <String.au3> #Region ### START Koda GUI section ### Form=C:\Users\Marcellino\Downloads\koda_1.7.3.0\Forms\KenoBot.kxf $Form1 = GUICreate("berbah", 498, 521, 194, 150) $Button1 = GUICtrlCreateButton("Start", 8, 488, 75, 25) $Button2 = GUICtrlCreateButton("Exit", 249, 488, 75, 25) $Button3 = GUICtrlCreateButton("Pause", 128, 488, 75, 25) $Label1 = GUICtrlCreateLabel("Fifth", 16, 28, 24, 17) $Label2 = GUICtrlCreateLabel("Fourth", 16, 54, 34, 17) $Label3 = GUICtrlCreateLabel("Third", 16, 80, 28, 17) $Label4 = GUICtrlCreateLabel("Second", 16, 104, 41, 17) $Label5 = GUICtrlCreateLabel("First", 16, 128, 23, 17) $Input1 = GUICtrlCreateInput("5thkan", 72, 24, 81, 21) $Input2 = GUICtrlCreateInput("4th", 72, 49, 81, 21) $Input3 = GUICtrlCreateInput("3rd", 72, 75, 81, 21) $Input4 = GUICtrlCreateInput("2nd", 72, 100, 81, 21) $Input5 = GUICtrlCreateInput("1st", 72, 125, 81, 21) $Group1 = GUICtrlCreateGroup("Kanada", 8, 8, 153, 153) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Slovakia", 172, 8, 153, 153) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label11 = GUICtrlCreateLabel("Fifth", 180, 30, 24, 17) $Label12 = GUICtrlCreateLabel("Fourth", 180, 56, 34, 17) $Label13 = GUICtrlCreateLabel("Third", 180, 82, 28, 17) $Label14 = GUICtrlCreateLabel("Second", 180, 106, 41, 17) $Label15 = GUICtrlCreateLabel("First", 180, 130, 23, 17) $Input11 = GUICtrlCreateInput("5thaus", 236, 26, 81, 21) $Input12 = GUICtrlCreateInput("4th", 236, 51, 81, 21) $Input13 = GUICtrlCreateInput("3rd", 236, 77, 81, 21) $Input14 = GUICtrlCreateInput("2nd", 236, 102, 81, 21) $Input15 = GUICtrlCreateInput("1st", 236, 127, 81, 21) $Group2 = GUICtrlCreateGroup("West Canada", 172, 169, 153, 153) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group4 = GUICtrlCreateGroup("Malta", 8, 169, 153, 153) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label6 = GUICtrlCreateLabel("Fifth", 16, 189, 24, 17) $Label7 = GUICtrlCreateLabel("Fourth", 16, 215, 34, 17) $Label8 = GUICtrlCreateLabel("Third", 16, 241, 28, 17) $Label9 = GUICtrlCreateLabel("Second", 16, 265, 41, 17) $Label10 = GUICtrlCreateLabel("First", 16, 289, 23, 17) $Input6 = GUICtrlCreateInput("5thmal", 72, 185, 81, 21) $Input7 = GUICtrlCreateInput("4thmal", 72, 210, 81, 21) $Input8 = GUICtrlCreateInput("3rdmal", 72, 236, 81, 21) $Input9 = GUICtrlCreateInput("2ndmal", 72, 261, 81, 21) $Input10 = GUICtrlCreateInput("1stmal", 72, 286, 81, 21) $Label16 = GUICtrlCreateLabel("Fifth", 180, 191, 24, 17) $Label17 = GUICtrlCreateLabel("Fourth", 180, 217, 34, 17) $Label18 = GUICtrlCreateLabel("Third", 180, 243, 28, 17) $Label19 = GUICtrlCreateLabel("Second", 180, 267, 41, 17) $Label20 = GUICtrlCreateLabel("First", 180, 291, 23, 17) $Input16 = GUICtrlCreateInput("5thwb", 236, 187, 81, 21) $Input17 = GUICtrlCreateInput("4thwb", 236, 212, 81, 21) $Input18 = GUICtrlCreateInput("3rdwb", 236, 238, 81, 21) $Input19 = GUICtrlCreateInput("2ndwb", 236, 263, 81, 21) $Input20 = GUICtrlCreateInput("1stwb", 236, 288, 81, 21) $Group5 = GUICtrlCreateGroup("Beijing", 8, 326, 153, 153) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group6 = GUICtrlCreateGroup("Australia", 170, 326, 153, 153) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label21 = GUICtrlCreateLabel("Fifth", 14, 346, 24, 17) $Label22 = GUICtrlCreateLabel("Fourth", 14, 372, 34, 17) $Label23 = GUICtrlCreateLabel("Third", 14, 398, 28, 17) $Label24 = GUICtrlCreateLabel("Second", 14, 422, 41, 17) $Label25 = GUICtrlCreateLabel("First", 14, 446, 23, 17) $Input21 = GUICtrlCreateInput("5thbei", 70, 342, 81, 21) $Input22 = GUICtrlCreateInput("4thbei", 70, 367, 81, 21) $Input23 = GUICtrlCreateInput("3rd", 70, 393, 81, 21) $Input24 = GUICtrlCreateInput("2nd", 70, 418, 81, 21) $Input25 = GUICtrlCreateInput("1st", 70, 443, 81, 21) $Label26 = GUICtrlCreateLabel("Fifth", 178, 348, 24, 17) $Label27 = GUICtrlCreateLabel("Fourth", 178, 374, 34, 17) $Label28 = GUICtrlCreateLabel("Third", 178, 400, 28, 17) $Label29 = GUICtrlCreateLabel("Second", 178, 424, 41, 17) $Label30 = GUICtrlCreateLabel("First", 178, 448, 23, 17) $Input26 = GUICtrlCreateInput("5thaaa", 234, 344, 81, 21) $Input27 = GUICtrlCreateInput("4th", 234, 369, 81, 21) $Input28 = GUICtrlCreateInput("3rd", 234, 395, 81, 21) $Input29 = GUICtrlCreateInput("2nd", 234, 420, 81, 21) $Input30 = GUICtrlCreateInput("1st", 234, 445, 81, 21) $Group7 = GUICtrlCreateGroup("STATUS", 336, 8, 153, 169) $Label31 = GUICtrlCreateLabel("Kanada :", 368, 32, 47, 17) $Label32 = GUICtrlCreateLabel("SLovakia :", 360, 51, 55, 17) $Label33 = GUICtrlCreateLabel("Malta :", 379, 70, 36, 17) $Label34 = GUICtrlCreateLabel("West Canada :", 340, 104, 75, 17) $Label35 = GUICtrlCreateLabel("Beijing :", 374, 128, 41, 17) $Label36 = GUICtrlCreateLabel("Australia :", 365, 152, 50, 17) $WIN = GUICtrlCreateInput("WIN", 422, 24, 49, 21 ,BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) GUICtrlSetState(-1, $GUI_DISABLE) $Input33 = GUICtrlCreateInput("WIN", 422, 48, 49, 21,BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) GUICtrlSetState(-1, $GUI_DISABLE) $Input34 = GUICtrlCreateInput("LOSS", 422, 72, 49, 21,BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) GUICtrlSetState(-1, $GUI_DISABLE) $Input35 = GUICtrlCreateInput("LOSS", 422, 96, 49, 21,BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) GUICtrlSetState(-1, $GUI_DISABLE) $Input36 = GUICtrlCreateInput("WIN", 422, 120, 49, 21,BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) GUICtrlSetState(-1, $GUI_DISABLE) $Input37 = GUICtrlCreateInput("WIN", 422, 144, 49, 21,BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label43 = GUICtrlCreateLabel("STAKE AWAL", 328, 316, 73, 17) $Input31 = GUICtrlCreateInput("9999999", 408, 312, 73, 21) $Label37 = GUICtrlCreateLabel("Tempat Top Record", 336, 200, 100, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button2 Exit case $nMsg = $button1 BacaAustralia() EndSelect WEnd Func BacaAustralia() ;local $ii $url = "http://www.9102031.com/en-gb/Private/Results?GameCounterID=3";;AUSI $url1 = "http://www.9102031.com/en-gb/Private/Results?GameCounterID=1";;;BEIJING $url2 = "http://www.9102031.com/en-gb/Private/Results?GameCounterID=5";;;KANADA $url3 = "http://www.9102031.com/en-gb/Private/Results?GameCounterID=2";;;SLOVAKIA $url4 = "http://www.9102031.com/en-gb/Private/Results?GameCounterID=6";;;MALTA $url5 = "http://www.9102031.com/en-gb/Private/Results?GameCounterID=4";;;WEST CANADA $html = BinaryToString(InetRead($url)) $html1 = BinaryToString(InetRead($url1)) $html2 = BinaryToString(InetRead($url2)) $html3 = BinaryToString(InetRead($url3)) $html4 = BinaryToString(InetRead($url4)) $html5 = BinaryToString(InetRead($url5)) $oIE = _IECreate($url) $oIE1 = _IECreate($url1) $oIE2 = _IECreate($url2) $oIE3 = _IECreate($url3) $oIE4 = _IECreate($url4) $oIE5 = _IECreate($url5) sleep(2000) _IEAction($oIE, "refresh") _IEAction($oIE1, "refresh") _IEAction($oIE2, "refresh") _IEAction($oIE3, "refresh") _IEAction($oIE4, "refresh") _IEAction($oIE5, "refresh") $html = _IEDocReadHTML($oIE) $html1 = _IEDocReadHTML($oIE1) $html2 = _IEDocReadHTML($oIE2) $html3 = _IEDocReadHTML($oIE3) $html4 = _IEDocReadHTML($oIE4) $html5 = _IEDocReadHTML($oIE5) sleep(1000) $res = StringRegExp($Html, '(?is)td\h*class="align-c\h*(?:small|big)">([^<]+)', 3) $res1 = StringRegExp($Html1, '(?is)td\h*class="align-c\h*(?:small|big)">([^<]+)', 3) $res2 = StringRegExp($Html2, '(?is)td\h*class="align-c\h*(?:small|big)">([^<]+)', 3) $res3 = StringRegExp($Html3, '(?is)td\h*class="align-c\h*(?:small|big)">([^<]+)', 3) $res4 = StringRegExp($Html4, '(?is)td\h*class="align-c\h*(?:small|big)">([^<]+)', 3) $res5 = StringRegExp($Html5, '(?is)td\h*class="align-c\h*(?:small|big)">([^<]+)', 3) sleep(2000) ;;;ausi IF Not @error Then Guictrlsetdata($Input26,$res[0]) Guictrlsetdata($Input27,$res[1]) Guictrlsetdata($Input28,$res[2]) Guictrlsetdata($Input29,$res[3]) Guictrlsetdata($Input30,$res[4]) EndIf IF Not @error Then ;;;;beijing Guictrlsetdata($Input21,$res1[0]) Guictrlsetdata($Input22,$res1[1]) Guictrlsetdata($Input23,$res1[2]) Guictrlsetdata($Input24,$res1[3]) Guictrlsetdata($Input25,$res1[4]) EndIf ;;;;;CANADA IF Not @error Then Guictrlsetdata($Input1,$res2[0]) Guictrlsetdata($Input2,$res2[1]) Guictrlsetdata($Input3,$res2[2]) Guictrlsetdata($Input4,$res2[3]) Guictrlsetdata($Input5,$res2[4]) EndIf ;;;;;;SLOVAKIA IF Not @error Then Guictrlsetdata($Input11,$res3[0]) Guictrlsetdata($Input12,$res3[1]) Guictrlsetdata($Input13,$res3[2]) Guictrlsetdata($Input14,$res3[3]) Guictrlsetdata($Input15,$res3[4]) EndIf ;;;;;;MALTA IF Not @error Then Guictrlsetdata($Input6,$res4[0]) Guictrlsetdata($Input7,$res4[1]) Guictrlsetdata($Input8,$res4[2]) Guictrlsetdata($Input9,$res4[3]) Guictrlsetdata($Input10,$res4[4]) EndIf ;;;;;;;;WEST CANADA IF Not @error Then Guictrlsetdata($Input16,$res5[0]) Guictrlsetdata($Input17,$res5[1]) Guictrlsetdata($Input18,$res5[2]) Guictrlsetdata($Input19,$res5[3]) Guictrlsetdata($Input20,$res5[4]) EndIf sleep(1000) ;_IEQUIT($oIE) sleep(1000) ;_IEQUIT($oIE1) EndFunc Edited June 29, 2015 by Tripoz Please use the link before judge its game or not.. (its a Option website) Link to comment Share on other sites More sharing options...
water Posted June 29, 2015 Share Posted June 29, 2015 What do you mean by "will print an error"? Which error message do you get? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Tripoz Posted June 29, 2015 Author Share Posted June 29, 2015 (edited) Sorry bro its Solved now.just adding this to my code :If Not IsArray($res) Then Guictrlsetdata($Input26,"ERROR") Guictrlsetdata($Input27,"ERROR") Guictrlsetdata($Input28,"ERROR") Guictrlsetdata($Input29,"ERROR") Guictrlsetdata($Input30,"ERROR") Else Guictrlsetdata($Input26,$res[0]) Guictrlsetdata($Input27,$res[1]) Guictrlsetdata($Input28,$res[2]) Guictrlsetdata($Input29,$res[3]) Guictrlsetdata($Input30,$res[4]) EndIfthx Edited June 30, 2015 by Tripoz Link to comment Share on other sites More sharing options...
MikahS Posted June 29, 2015 Share Posted June 29, 2015 Posting the code that solved your problem could potentially help someone else searching for the same problem. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ 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