Jump to content

Recommended Posts

Posted

Can someone help me with my drop down boxes? Each time I run the program and then pick a data again it adds the whole string again to the drop down? I feel there should be a "end something" function that reset's it each time I run it. I just can't seem to figure it out. Any help would be appreciated. Thanks

Posted

Yes , When I do that it resets it to blank and then you can't choose a number. I just need it to reset to the original format like when the program starts.

Posted

Okay I am hitting a wall with this "Project" I decided to take on during the pandemic. I thought I would try and learn some scripting but IDK if i am cut out for it. My issue now is I want to do a search on only the selected site #'s if they are checked. I think I would need to do the same steps as the normal search but how would I get it to search for only the specific site #'s? I looked at the website code and I do see where there is a "DIV' pertaining to the information I need however, I am stumped on how to get it to look for it and display it as I need. Any help would be great. Also, if you can comment on what you add so maybe I can learn from it for future projects. Thanks!

#include <IE.au3>
#include <InetConstants.au3>
#include <Constants.au3>
#include <Array.au3>
#include <GuiComboBox.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#Include <GuiComboBoxEx.au3>
#include <ProgressConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Camping Reservation Checker V3.0", 695, 629, -1, -1)
$Pic1 = GUICtrlCreatePic("images\Camper.jpg", 16, 16, 230, 157)
$Group1 = GUICtrlCreateGroup("", 272, 16, 329, 153)
$Heading = GUICtrlCreateLabel("Select a Park", 344, 40, 79, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Combo1 = GUICtrlCreateCombo("Smith Point", 456, 40, 145, 25)
GUICtrlSetData(-1, "Cupsogue|Indian+Island|Montauk|Sears+bellows|Shinnecock+East|Southhaven|West+Hills")
$hookups = GUICtrlCreateCombo("Sewer", 456, 72, 145, 25)
GUICtrlSetData(-1, "Basic|Electric|Outer+Beach")
$Label3 = GUICtrlCreateLabel("Select Hookup", 344, 72, 84, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Number_of_Nights = GUICtrlCreateCombo("4", 456, 104, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "5|6|7|8|9|10|11|12|13|14")
$Label2 = GUICtrlCreateLabel("Number of Nights", 344, 104, 101, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Submit = GUICtrlCreateButton("Submit", 382, 274, 105, 31)
$Label1 = GUICtrlCreateLabel("Check All Availability", 352, 187, 186, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Date = GUICtrlCreateLabel("Enter Date:", 265, 235, 70, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Day = GUICtrlCreateCombo("Day", 337, 235, 57, 25)
GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30")
$Month = GUICtrlCreateCombo("Month", 409, 235, 65, 25)
GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|")
$Year = GUICtrlCreateCombo("2021", 489, 235, 65, 25)
GUICtrlSetData(-1, "2021|2022")
$Checkbox1 = GUICtrlCreateCheckbox("Site 230", 304, 424, 64, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Site 232", 304, 448, 62, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Site 234", 400, 424, 64, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Site 236", 304, 472, 61, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Site 238", 400, 448, 63, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Site 240", 304, 496, 61, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Site 242", 400, 472, 64, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Site 244", 304, 520, 66, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Site 246", 400, 496, 62, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Site 248", 304, 544, 62, 17)
$Checkbox11 = GUICtrlCreateCheckbox("Site 250", 400, 520, 62, 17)
$Checkbox12 = GUICtrlCreateCheckbox("Site 245", 536, 416, 97, 17)
$Checkbox13 = GUICtrlCreateCheckbox("Site 247", 536, 440, 97, 17)
$Checkbox14 = GUICtrlCreateCheckbox("Site 249", 536, 464, 97, 17)
$Checkbox15 = GUICtrlCreateCheckbox("Site 251", 536, 488, 97, 17)
$Checkbox16 = GUICtrlCreateCheckbox("Site 253", 536, 512, 97, 17)
$Checkbox17 = GUICtrlCreateCheckbox("Site 255", 536, 536, 97, 17)
$Checkbox18 = GUICtrlCreateCheckbox("Site 257", 536, 560, 97, 17)
$Label4 = GUICtrlCreateLabel("Ocean Side", 352, 392, 71, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label5 = GUICtrlCreateLabel("Inner Side", 536, 392, 64, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label6 = GUICtrlCreateLabel("Smith Point Beach Top Sites", 368, 352, 244, 21)
GUICtrlSetFont(-1, 12, 400, 4, "MV Boli")
GUICtrlSetColor(-1, 0x0000FF)
$Label7 = GUICtrlCreateLabel("These Sites Are For SmithPoint Camping Only", 305, 578, 218, 17)
$MonthCal1 = GUICtrlCreateMonthCal("2021/03/04", 16, 184, 235, 196)
$Pic2 = GUICtrlCreatePic("", 16, 396, 236, 206)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

            Case $Combo1
            If GUICtrlRead($combo1) = ("Smith Point") Then
                GUICtrlSetState ($Checkbox1, $GUI_ENABLE)
                GUICtrlSetState($Checkbox2, $GUI_ENABLE)
                GUICtrlSetState($Checkbox3, $GUI_ENABLE)
                GUICtrlSetState($Checkbox4, $GUI_ENABLE)
                GUICtrlSetState($Checkbox5, $GUI_ENABLE)
                GUICtrlSetState($Checkbox6, $GUI_ENABLE)
                GUICtrlSetState($Checkbox7, $GUI_ENABLE)
                GUICtrlSetState($Checkbox8, $GUI_ENABLE)
                GUICtrlSetState($Checkbox9, $GUI_ENABLE)
                GUICtrlSetState($Checkbox10, $GUI_ENABLE)
                GUICtrlSetState($Checkbox11, $GUI_ENABLE)
                GUICtrlSetState($Checkbox12, $GUI_ENABLE)
                GUICtrlSetState($Checkbox13, $GUI_ENABLE)
                GUICtrlSetState($Checkbox14, $GUI_ENABLE)
                GUICtrlSetState($Checkbox15, $GUI_ENABLE)
                GUICtrlSetState($Checkbox16, $GUI_ENABLE)
                GUICtrlSetState($Checkbox17, $GUI_ENABLE)
                GUICtrlSetState($Checkbox18, $GUI_ENABLE)
                Else
                 GUICtrlSetState($Checkbox1, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox2, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox3, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox4, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox5, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox6, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox7, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox8, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox9, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox10, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox11, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox12, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox13, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox14, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox15, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox16, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox17, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox18, $GUI_DISABLE)
                EndIf

        Case $Submit

            $Date2 = GUICtrlRead ($Day)
            $Date1 = GUICtrlRead ($Month)
            $Date3 = GUICtrlRead ($Year)
            $location = GUICtrlRead ($Combo1)
            $hookup = GUICtrlRead ($hookups)
            $nights = GUICtrlRead ($Number_of_Nights)

If GUICtrlRead($CheckBox1) = $GUI_CHECKED Then

Call ("Checkbox")
Else

Call ("Search")
EndIf

    EndSwitch
WEnd

Search()
Func Search()

  Local $sCompare = 'data-icon-primary="ui-icon-plusthick"'

  ; Get page 1`
  Local $dData = InetRead("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=&gotopagenow=&gotopage=1&module=RN&multiselectlist_value=", $INET_FORCERELOAD)

  Local $sData = BinaryToString($dData)

  ;ConsoleWrite ($sData & @CRLF)
  Local $aPage = StringRegExp($sData, '<option value="(\d+)', 3)
  ;_ArrayDisplay($aPage)
  Local $nPage = $aPage[UBound($aPage)-1]

  StringReplace($sData, $sCompare, $sCompare)
  Local $iTotal = @extended

  ; loop thru all pages using $i as page indicator
  For $i = 2 to $nPage
    $dData = InetRead("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=" & $i & "&gotopagenow=yes&gotopage=&module=RN&multiselectlist_value=", $INET_FORCERELOAD)

    $sData = BinaryToString($dData)
    StringReplace($sData, $sCompare, $sCompare)
    $iTotal += @extended

  Next

  $verify =  MsgBox(4, $itotal & " Sites Available", "There Are " & $iTotal & " Sites Available At " & $location & " With " & $hookup & " Hookups. " & @CRLF & @CRLF & " Do You Want To Continue To The Reservation Page?")
                    Select
                        Case $verify = 6
                            ; YES, proceed with step 1
                         _IECreate("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=&gotopagenow=&gotopage=1&module=RN&multiselectlist_value=", $INET_FORCERELOAD)

                        Case $verify = 7
                            ; NO thanks
                    EndSelect

EndFunc   ;==>Search


Checkbox()
Func Checkbox()
            If GUICtrlRead($CheckBox1) = $GUI_CHECKED Then
                    MsgBox("","Checked","Site 230 Selected")


         Else
            MsgBox("","Checkbox", "Checkbox Not selected")

    EndIf
EndFunc

1

Posted

What I suggest is that you put all open site # in an array and then you can compare the content with whatever you want.

Here what I used for the test :

#include <InetConstants.au3>
#include <Array.au3>

Local $dData = InetRead("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=03%2F07%2F2021&nights=4&category=Cathedral+Pines&subtype=&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=&gotopagenow=&gotopage=1&module=RN&multiselectlist_value=&rnwebsearch_buttonsearch=Search", $INET_FORCERELOAD)
Local $sData = BinaryToString($dData)
ClipPut($sData)

Local $aNum = StringRegExp($sData, '(?s)data-icon-primary="ui-icon-plusthick".*?data-title="Site\/Item #"[^\d]+(\d+)', 3)
_ArrayDisplay($aNum)

It is working fine for this one page.

Now, here your new Search function (untested) :

Func Search()
  ; Get page 1
  Local $dData = InetRead("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=&gotopagenow=&gotopage=1&module=RN&multiselectlist_value=", $INET_FORCERELOAD)
  Local $sData = BinaryToString($dData)
  ;ConsoleWrite ($sData & @CRLF)
  Local $aPage = StringRegExp($sData, '<option value="(\d+)', 3)
  ;_ArrayDisplay($aPage)
  Local $nPage = $aPage[UBound($aPage) - 1]

  Local $aTotal = StringRegExp($sData, '(?s)data-icon-primary="ui-icon-plusthick".*?data-title="Site\/Item #"[^\d]+(\d+)', 3)
  Local $iTotal = UBound($aTotal)
  Local $aPart
  ; loop thru all pages using $i as page indicator
  For $i = 2 To $nPage
    $dData = InetRead("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=" & $i & "&gotopagenow=yes&gotopage=&module=RN&multiselectlist_value=", $INET_FORCERELOAD)
    $sData = BinaryToString($dData)
    $aPart = StringRegExp($sData, '(?s)data-icon-primary="ui-icon-plusthick".*?data-title="Site\/Item #"[^\d]+(\d+)', 3)
    $iTotal += UBound($aPart)
    _ArrayConcatenate($aTotal, $aPart)
  Next
  Return SetExtended($iTotal, $aTotal)
EndFunc   ;==>Search

That would return an array with @extended set to total number available.

Only thing left for you is compare the content of the array with the site # you want to check...

Posted

I couldn't get it to work. ☹️ I swapped out my current function with yours added the Compare but I get  nothing. Program just sits there staring at me.

#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Camping Reservation Checker V3.0", 695, 629, -1, -1)
$Pic1 = GUICtrlCreatePic("images\Camper.jpg", 16, 16, 231, 153)
$Group1 = GUICtrlCreateGroup("", 256, 16, 345, 153)
$Heading = GUICtrlCreateLabel("Select a Park", 328, 40, 79, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Combo1 = GUICtrlCreateCombo("Smith Point", 440, 40, 145, 25)
GUICtrlSetData(-1, "Cupsogue|Indian+Island|Montauk|Sears+bellows|Shinnecock+East|Southaven|West+Hills")
$hookups = GUICtrlCreateCombo("Sewer", 440, 72, 145, 25)
GUICtrlSetData(-1, "Basic|Electric|Outer+Beach")
$Label3 = GUICtrlCreateLabel("Select Hookup", 328, 72, 84, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Number_of_Nights = GUICtrlCreateCombo("4", 440, 104, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "5|6|7|8|9|10|11|12|13|14")
$Label2 = GUICtrlCreateLabel("Number of Nights", 328, 104, 101, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Submit = GUICtrlCreateButton("Click to Seaarch", 354, 558, 149, 46)
GUICtrlSetFont(-1, 8, 400, 0, "MV Boli")
$Label1 = GUICtrlCreateLabel("Check All Availability", 352, 187, 186, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Date = GUICtrlCreateLabel("Enter Date:", 265, 235, 70, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Month = GUICtrlCreateCombo("Month", 337, 235, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Month,"01|02|03|04|05|06|07|08|09|10|11|12|")
$Day = GUICtrlCreateCombo("Day", 409, 235, 57, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Day, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30")
$Year = GUICtrlCreateCombo("2021", 489, 235, 65, 25)
GUICtrlSetData(-1, "2021|2022")
$Checkbox1 = GUICtrlCreateCheckbox("Site 230", 301, 390, 62, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Site 232", 301, 414, 62, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Site 234", 389, 414, 62, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Site 236", 301, 438, 61, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Site 238", 389, 438, 64, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Site 240", 301, 462, 60, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Site 242", 389, 462, 63, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Site 244", 301, 486, 59, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Site 246", 389, 486, 63, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Site 248", 301, 510, 62, 17)
$Checkbox11 = GUICtrlCreateCheckbox("Site 250", 389, 510, 63, 17)
$Checkbox12 = GUICtrlCreateCheckbox("Site 245", 493, 366, 64, 17)
$Checkbox13 = GUICtrlCreateCheckbox("Site 247", 493, 390, 60, 17)
$Checkbox14 = GUICtrlCreateCheckbox("Site 249", 493, 414, 63, 17)
$Checkbox15 = GUICtrlCreateCheckbox("Site 251", 493, 438, 61, 17)
$Checkbox16 = GUICtrlCreateCheckbox("Site 253", 493, 462, 64, 17)
$Checkbox17 = GUICtrlCreateCheckbox("Site 255", 493, 486, 60, 17)
$Checkbox18 = GUICtrlCreateCheckbox("Site 257", 493, 510, 63, 17)
$Label4 = GUICtrlCreateLabel("Ocean Side", 303, 339, 71, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label5 = GUICtrlCreateLabel("Inner Side", 494, 338, 64, 20)
GUICtrlSetFont(-1, 10, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label6 = GUICtrlCreateLabel(" Select Below For Smith Point Beach Top Sites !", 288, 280, 317, 21)
GUICtrlSetFont(-1, 10, 400, 0, "MV Boli")
$Label7 = GUICtrlCreateLabel("These Sites Are For SmithPoint Camping Only", 321, 313, 232, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
$MonthCal1 = GUICtrlCreateMonthCal("2021/03/03", 16, 184, 229, 196)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            If GUICtrlRead($combo1) = ("Smith Point") Then
                GUICtrlSetState ($Checkbox1, $GUI_ENABLE)
                GUICtrlSetState($Checkbox2, $GUI_ENABLE)
                GUICtrlSetState($Checkbox3, $GUI_ENABLE)
                GUICtrlSetState($Checkbox4, $GUI_ENABLE)
                GUICtrlSetState($Checkbox5, $GUI_ENABLE)
                GUICtrlSetState($Checkbox6, $GUI_ENABLE)
                GUICtrlSetState($Checkbox7, $GUI_ENABLE)
                GUICtrlSetState($Checkbox8, $GUI_ENABLE)
                GUICtrlSetState($Checkbox9, $GUI_ENABLE)
                GUICtrlSetState($Checkbox10, $GUI_ENABLE)
                GUICtrlSetState($Checkbox11, $GUI_ENABLE)
                GUICtrlSetState($Checkbox12, $GUI_ENABLE)
                GUICtrlSetState($Checkbox13, $GUI_ENABLE)
                GUICtrlSetState($Checkbox14, $GUI_ENABLE)
                GUICtrlSetState($Checkbox15, $GUI_ENABLE)
                GUICtrlSetState($Checkbox16, $GUI_ENABLE)
                GUICtrlSetState($Checkbox17, $GUI_ENABLE)
                GUICtrlSetState($Checkbox18, $GUI_ENABLE)
                Else
                 GUICtrlSetState($Checkbox1, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox2, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox3, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox4, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox5, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox6, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox7, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox8, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox9, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox10, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox11, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox12, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox13, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox14, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox15, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox16, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox17, $GUI_DISABLE)
                 GUICtrlSetState($Checkbox18, $GUI_DISABLE)
                EndIf


        Case $Submit
            sleep (1000)
            $Date2 = GUICtrlRead ($Day)
            $Date1 = GUICtrlRead ($Month)
            $Date3 = GUICtrlRead ($Year)
            $location = GUICtrlRead ($Combo1)
            $hookup = GUICtrlRead ($hookups)
            $nights = GUICtrlRead ($Number_of_Nights)
            GUICtrlSetData($Day, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30")
            GUICtrlSetData($Month,"01|02|03|04|05|06|07|08|09|10|11|12|")



Call ("Example")

    EndSwitch
WEnd

Example()
Func Example()
  Local $sCompare = 'data-icon-primary="ui-icon-plusthick"'
  ; Get page 1
  Local $dData = InetRead("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=&gotopagenow=&gotopage=1&module=RN&multiselectlist_value=", $INET_FORCERELOAD)
  Local $sData = BinaryToString($dData)
  ;ConsoleWrite ($sData & @CRLF)
  Local $aPage = StringRegExp($sData, '<option value="(\d+)', 3)
  ;_ArrayDisplay($aPage)
  Local $nPage = $aPage[UBound($aPage) - 1]

  Local $aTotal = StringRegExp($sData, '(?s)data-icon-primary="ui-icon-plusthick".*?data-title="Site\/Item #"[^\d]+(\d+)', 3)
  Local $iTotal = UBound($aTotal)
  Local $aPart
  ; loop thru all pages using $i as page indicator
  For $i = 2 To $nPage
    $dData = InetRead("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=" & $i & "&gotopagenow=yes&gotopage=&module=RN&multiselectlist_value=", $INET_FORCERELOAD)
    $sData = BinaryToString($dData)
    $aPart = StringRegExp($sData, '(?s)data-icon-primary="ui-icon-plusthick".*?data-title="Site\/Item #"[^\d]+(\d+)', 3)
    $iTotal += UBound($aPart)
    _ArrayConcatenate($aTotal, $aPart)
Next
  Return SetExtended($iTotal, $aTotal)
    $sData = BinaryToString($dData)
    StringReplace($sData, $sCompare, $sCompare)
    $iTotal += @extended

  $verify =  MsgBox(4, $itotal & " Sites Available", "There Are " & $iTotal & " Sites Available at " & $location & " with " & $hookup & ". " & @CRLF & @CRLF & " Do you want to continue to the reservation page?")
                    Select
                        Case $verify = 6
                            ; YES, proceed with step 1
                         _IECreate("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=&gotopagenow=&gotopage=1&module=RN&multiselectlist_value=", $INET_FORCERELOAD)

                        Case $verify = 7
                            ; NO thanks
                    EndSelect

EndFunc   ;==>Example

I don't see where you have it checking for what checkbox is checked to search for that site?

Posted
58 minutes ago, tedesco said:

you have it checking for what checkbox is checked to search for that site?

I don't.  I have created (like I said) an array containing the site numbers available.  Now you need to make it work.  I won't do your project (payed contract) for you.  I think I have helped you well enough already.  Maybe someone else will continue but for now I am out.

  • 6 months later...
Posted
_IECreate does not seem to be working any longer not sure why maybe because it is being phased out for edge however, I tried using Chrome.exe 
ShellExecute("chrome.exe", "http://rtfm.com --new-window --start-fullscreen")
and for some reason it does not paste the entire string with all the variables? It stops at "Smith". any help would be very much appreciated.
  • 3 months later...
Posted

I am working on a project for my camping friends that will help with reserving a camping site. The program was working fine up until about 3 months ago and for some reason not it will not pass the full URL to the site? Perhaps they made a change on their side that is causing this? I get the error "The 'AR' module is not a valid search module. (VSI: Web-Global-25)" I will paste the code that was working below. Any help would be appreciated. Thank you in advance.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=icons8-trailer-30.ico
#AutoIt3Wrapper_Res_Description=Reserve A-Spot By Jayware
#AutoIt3Wrapper_Res_Fileversion=3.0.0.0
#AutoIt3Wrapper_Res_CompanyName=Jayware
#AutoIt3Wrapper_Res_LegalCopyright=Jayware
#AutoIt3Wrapper_Res_File_Add=icons8-trailer-30.ico
#AutoIt3Wrapper_Res_File_Add=Camper.jpg
#Au3Stripper_Parameters=/sv
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <IE.au3>
#include <InetConstants.au3>
#include <Constants.au3>
#include <Array.au3>
#include <GuiComboBox.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#Include <GuiComboBoxEx.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
Local $sNewDate = _DateAdd('d', 180, _NowCalcDate ())
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\tedescoj\documents\autoit scripts\park_reservation_gui-v2.kxf
$Form1_1 = GUICreate("Reserve A-Spot! V3.2", 698, 477, -1, -1)
GUISetIcon("C:\Users\Tedescoj\Documents\Autoit Scripts\icons8-trailer-30.ico", -1)
GUISetBkColor(0x008080)
$Pic1 = GUICtrlCreatePic("Camper.jpg", 16, 17, 230, 157)
$Group1 = GUICtrlCreateGroup("", 291, 78, 382, 153)
$Heading = GUICtrlCreateLabel("Select a Park:", 341, 102, 101, 19, $SS_SUNKEN)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Combo1 = GUICtrlCreateCombo("Smith Point", 475, 102, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Cupsogue|Indian+Island|Montauk|Sears+bellows|Shinnecock+East|Southaven|West+Hills")
GUICtrlSetBkColor(-1, 0xBFCDDB)
$hookups = GUICtrlCreateCombo("Sewer", 475, 134, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Basic|Electric|Outer+Beach")
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label3 = GUICtrlCreateLabel("Select Hookup:", 341, 134, 106, 19, $SS_SUNKEN)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Number_of_Nights = GUICtrlCreateCombo("4", 475, 167, 145, 25)
GUICtrlSetData(-1, "5|6|7|8|9|10|11|12|13|14")
GUICtrlSetBkColor(-1, 0xD7E4F2)
$Label2 = GUICtrlCreateLabel("Number of Nights:", 340, 166, 115, 19, $SS_SUNKEN)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Search = GUICtrlCreateButton("Search", 416, 370, 174, 44)
GUICtrlSetFont(-1, 15, 800, 2, "@MingLiU-ExtB")
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label1 = GUICtrlCreateLabel("Check Availability", 417, 257, 161, 28)
GUICtrlSetFont(-1, 16, 800, 2, "Calibri")
$Date = GUICtrlCreateLabel("Enter Date:", 320, 313, 85, 20, $SS_SUNKEN)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Month = GUICtrlCreateCombo("Month", 416, 312, 57, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|")
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Day = GUICtrlCreateCombo("Day", 480, 312, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30")
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Year = GUICtrlCreateCombo("2021", 552, 312, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "2021|2022|2023")
GUICtrlSetBkColor(-1, 0xBFCDDB)
$MonthCal1 = GUICtrlCreateMonthCal("2021/04/06", 16, 184, 235, 196)
$Label4 = GUICtrlCreateLabel("Reserve A-Spot !", 373, 27, 198, 36)
GUICtrlSetFont(-1, 18, 800, 2, "Segoe UI Emoji")
GUICtrlSetColor(-1, 0x000000)
$Label5 = GUICtrlCreateLabel("Jayware. 2021", 17, 450, 64, 16)
GUICtrlSetFont(-1, 8, 400, 0, "Script")
$Label6 = GUICtrlCreateLabel("*** Tool Tip ***", 84, 390, 87, 19)
GUICtrlSetFont(-1, 9, 800, 4, "Arial")
$Label7 = GUICtrlCreateLabel($sNewDate, 284, 413, 70, 19)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label8 = GUICtrlCreateLabel("It is best to book 180 days prior wich would be:", 8, 413, 272, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Search
            sleep (1000)
            $Date1 = GUICtrlRead ($Month)
            $Date2 = GUICtrlRead ($Day)
            $Date3 = GUICtrlRead ($Year)
            $location = GUICtrlRead ($Combo1)
            $hookup = GUICtrlRead ($hookups)
            $nights = GUICtrlRead ($Number_of_Nights)


If $Date1 = "Month" Then
    Call ("Valid")
Else

If $Date2 = "Day" Then
    Call ("Valid")
Else
    Call ("Search")
EndIf
EndIf
EndSwitch
WEnd

Valid

Func Valid()
    MsgBox("","Incorrect Date","You Must Select A Correct Date")
EndFunc

Search

Func Search()

     ; Display a progress bar window.
    ProgressOn("Searching", "Searching For Available Sites....", "0%", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE))

    ; Update the progress value of the progress bar window every second.
    For $i = 20 To 100 Step 20
        Sleep(1000)
        ProgressSet($i, $i & "%")
    Next

    ; Set the "subtext" and "maintext" of the progress bar window.
    ProgressSet(100, "Done", "Complete")
    ;Sleep(5000)

    ; Close the progress window.

    Local $sCompare = 'data-icon-primary="ui-icon-plusthick"'

  ; Get page 1`
    Local $dData = InetRead("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=&gotopagenow=&gotopage=1&module=RN&multiselectlist_value=", $INET_FORCERELOAD)

  Local $sData = BinaryToString($dData)

  ;ConsoleWrite ($sData & @CRLF)
  Local $aPage = StringRegExp($sData, '<option value="(\d+)', 3)
  ;_ArrayDisplay($aPage)
  Local $nPage = $aPage[UBound($aPage)-1]

  StringReplace($sData, $sCompare, $sCompare)
  Local $iTotal = @extended

  ; loop thru all pages using $i as page indicator
  For $i = 2 to $nPage
    $dData = InetRead("https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=" & $i & "&gotopagenow=yes&gotopage=&module=RN&multiselectlist_value=", $INET_FORCERELOAD)
ProgressOff()
    $sData = BinaryToString($dData)
    StringReplace($sData, $sCompare, $sCompare)
    $iTotal += @extended
  Next
  Switch msgbox ($MB_CANCELTRYCONTINUE, $itotal & " Sites Available", "There Are " & $iTotal & " Sites Available At " & $location & " With " & $hookup & " Hookups For The Selected Dates. " & @CRLF & @CRLF & " Click " & "Continue" & " To Go To The Reservation Page, Or " & "Try Again " & "To Search For Another Date.")

                        Case $IDContinue
                         ShellExecute("chrome.exe","https://parks.suffolkcountyny.gov/wbwsc/webtrac.wsc/search.html?Action=Start&SubAction=&rnwebsearch_search=Yes&primarycode=&begindate=" & $date1 & "%2F" & $Date2 & "%2F" & $Date3 & "&nights=" & $nights & "&category=" & $location & "&subtype=" & $hookup & "&type=FamilySite&begintime=12%3A00+am&endtime=12%3A00+am&quantity=1&keyword=&display=Listing&search=yes&page=&gotopagenow=&gotopage=1&module=RN&multiselectlist_value=", $INET_FORCERELOAD)

                        Case $IDCancel

                    EndSwitch
    EndFunc

 

Posted
  • Jos locked this topic
  • Jos unlocked this topic

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...