#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=Reader.ico #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; AutoIt Version: 3.3.0.0 ;; ;; ;; ;; Template AutoIt script. ;; ;; ;; ;; AUTHOR: TheSaint ;; ;; ;; ;; SCRIPT FUNCTION: Program to query an Amazon ebook page and return current price ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; GUI FUNCTIONS ; ImageDataGUI(), SettingsGUI() ; FUNCTIONS ; DetermineComment(), GetAllChanges(), GetBookDescription, GetDetailReport(), GetImageData() ; GetPriceDifferenceResult(), GetSelectedIndex($for), GetSetCurrentStateAfterChanges() ; GetTagSettings(), GetTheAuthor(), GetTheISBN(), GetValueForPrice($value), GetValueSettings() ; QueryCurrentPrice(), SetTheColumnWidths(), SortByColumnNumber(), StopCheck() ; Script generated by AutoBuilder 0.8 Prototype #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include _Singleton("kindebook-price-query-thsaint") Global $Button_add, $Button_i, $Button_ontop, $Button_query, $Button_rem, $Button_save, $Button_x Global $Checkbox_quall, $Checkbox_qufav, $Combo_tag, $Combo_val, $Group_comm, $Group_list, $Input_comm ;~ Global $Item_copy, $Item_data, $Item_entry, $Item_favorite, $Item_history, $Item_image, $Item_notes ;~ Global $Item_opts, $Item_paid, $Item_price, $Item_query, $Item_summary, $Item_web Global $Listview_ebooks ;, $Menu_list Global $context Global Enum $Item_web, $Item_summary, $Item_query, $Item_price, $Item_paid, $Item_opts, $Item_notes, $Item_image, $Item_history, $Item_favorite, $Item_entry, $Item_data, $Item_copy Global $allchars, $alltags, $ans, $author, $basic, $bigid, $bought, $c, $catfle, $changed, $changes Global $char, $chars, $check, $chosen, $chrcnt, $clip, $colnum, $comment, $comments, $csign, $curr Global $current, $currval, $data, $date, $defchars, $deftags, $e, $ebooktxt, $end, $endpos, $entry Global $ents, $excoms, $favorite, $favorites, $first, $for, $getcnt, $high, $higher, $highval, $html Global $htmfle, $icofle, $icoI, $icoN, $icoX, $image, $imgfld, $imgfle, $ind, $inifle, $IP, $ISBN Global $last, $lasturl, $loop, $low, $lower, $lowid, $lowval, $msg, $multi, $now, $num, $nums Global $ontop, $other, $paid, $pos, $previous, $price, $PriceQueryGUI, $pth, $query, $querytxt, $rec Global $record, $relax, $remain, $rep, $replace, $report, $restof, $result, $s, $savpth, $shell Global $show, $slots, $splash, $start, $startpos, $starval, $stop, $summary, $t, $tag, $tagreps Global $tags, $test, $time, $title, $updated, $URL, $user, $v, $val, $valreps, $value $catfle = @ScriptDir & "\Catalog.ini" $ebooktxt = @ScriptDir & "\Html.txt" $htmfle = @ScriptDir & "\Blank.html" $imgfld = @ScriptDir & "\Image Data" $inifle = @ScriptDir & "\Settings.ini" $querytxt = @ScriptDir & "\Query.txt" If Not FileExists($ebooktxt) Then _FileCreate($ebooktxt) If Not FileExists($htmfle) Then _FileCreate($htmfle) $basic = "" & @CRLF & "" & @CRLF & "Blank Page" & @CRLF & "" & @CRLF & _ @CRLF & "" & @CRLF & "" & @CRLF & @CRLF & "" _FileWriteToLine($htmfle, 1, $basic) EndIf If Not FileExists($imgfld) Then DirCreate($imgfld) $PriceQueryGUI = GuiCreate("KindEbook Price Query v2.0", 800, 530, -1, -1, $WS_OVERLAPPED + $WS_CAPTION _ + $WS_SYSMENU + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_MINIMIZEBOX, $WS_EX_TOPMOST) ; CONTROLS $Group_list = GuiCtrlCreateGroup("List Of Kindle Ebooks", 10, 10, 780, 440) $Listview_ebooks = GUICtrlCreateListView("No.|Title|ISBN|Author|Start|Low|High|Current", 20, 30, 760, 410, _ $GUI_SS_DEFAULT_LISTVIEW, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES) ;$GUI_SS_DEFAULT_LISTVIEW + $LVS_SORTASCENDING, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES) SetTheColumnWidths() GUICtrlSetBkColor($Listview_ebooks, 0xE0F0E0) ; $Group_comm = GuiCtrlCreateGroup("Comments", 10, 460, 375, 55) $Input_comm = GUICtrlCreateInput("", 20, 480, 355, 20) ; $Button_add = GuiCtrlCreateButton("ADD", 395, 465, 50, 50) GUICtrlSetFont($Button_add, 7, 600, 0, "Small Fonts") GUICtrlSetTip($Button_add, "Add another ebook!") ; $Button_rem = GuiCtrlCreateButton("Remove", 455, 465, 65, 25) GUICtrlSetFont($Button_rem, 7, 600, 0, "Small Fonts") GUICtrlSetTip($Button_rem, "Remove selected ebook!") ; $Button_ontop = GUICtrlCreateCheckbox("ON TOP", 455, 495, 65, 20, $BS_PUSHLIKE) GUICtrlSetFont($Button_ontop, 6, 600, 0, "Small Fonts") GUICtrlSetTip($Button_ontop, "Toggle the On Top setting!") ; $Button_query = GuiCtrlCreateButton("QUERY", 530, 465, 60, 50) GUICtrlSetFont($Button_query, 7, 600, 0, "Small Fonts") GUICtrlSetTip($Button_query, "Query selected ebook!") ; $Checkbox_quall = GUICtrlCreateCheckbox("", 595, 470, 20, 20) GUICtrlSetTip($Checkbox_quall, "Query all ebooks!") $Checkbox_qufav = GUICtrlCreateCheckbox("", 595, 490, 20, 20) GUICtrlSetTip($Checkbox_qufav, "Query favorite ebooks!") ; $Button_save = GuiCtrlCreateButton("SAVE" & @LF & "LIST", 620, 465, 50, 50, $BS_MULTILINE) GUICtrlSetFont($Button_save, 7, 600, 0, "Small Fonts") GUICtrlSetTip($Button_save, "Save the ebook list to text file!") ; ; $Button_i = GuiCtrlCreateButton("Info", 680, 465, 50, 50, $BS_ICON) GUICtrlSetTip($Button_i, "Program Information!") $Button_x = GuiCtrlCreateButton("EXIT", 740, 465, 50, 50, $BS_ICON) GUICtrlSetTip($Button_x, "Quit, Close or Exit program!") ; ;~ ; CONTEXT_MENU ;~ $Menu_list = GUICtrlCreateContextMenu($Listview_ebooks) ;~ $Item_web = GUICtrlCreateMenuItem("Go to web page", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_copy = GUICtrlCreateMenuItem("Copy URL to clipboard", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_entry = GUICtrlCreateMenuItem("Selected Entry Detail (text only)", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_image = GUICtrlCreateMenuItem("Selected Entry Detail (image + text)", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_history = GUICtrlCreateMenuItem("Price History", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_price = GUICtrlCreateMenuItem("View price results", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_query = GUICtrlCreateMenuItem("Query results", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_notes = GUICtrlCreateMenuItem("Add a comment", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_paid = GUICtrlCreateMenuItem("Bought this ebook", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_favorite = GUICtrlCreateMenuItem("Set ebook as a favorite", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_summary = GUICtrlCreateMenuItem("Get missing summary", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_data = GUICtrlCreateMenuItem("Get missing image data", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ GUICtrlCreateMenuItem("", $Menu_list) ;~ $Item_opts = GUICtrlCreateMenuItem("SETTINGS", $Menu_list) ;~ ; ;~ $lowid = $Item_opts $lowid = $Button_x ; ; OS SETTINGS $shell = @SystemDir & "\shell32.dll" $user = @SystemDir & "\user32.dll" $icoI = -5 If StringLeft(@OSVersion, 5) <> "WIN_9" And @OSVersion <> "WIN_ME" Then ; WIN_NT4, WIN_2000, WIN_XP, WIN_2003 $icofle = $shell $icoN = -70 $icoX = -28 Else $icofle = $user $icoN = -67 $icoX = -4 EndIf ; ; SETTINGS GUICtrlSetImage($Button_i, $user, $icoI, 1) GUICtrlSetImage($Button_x, $shell, $icoX, 1) ; $show = IniRead($inifle, "Indexes", "show", "") If $show = "" Then $show = 4 IniWrite($inifle, "Indexes", "show", $show) EndIf ; $test = IniRead($inifle, "Read Html Page", "test", "") If $test = "" Then $test = 4 IniWrite($inifle, "Read Html Page", "test", $test) EndIf ; $csign = IniRead($inifle, "Currency", "sign", "") If $csign = "" Then $csign = "£" IniWrite($inifle, "Currency", "sign", $csign) EndIf ; $time = IniRead($inifle, "Now Date Format", "time", "") If $time = "" Then $time = 4 IniWrite($inifle, "Now Date Format", "time", $time) EndIf ; $record = IniRead($inifle, "All Price Changes", "record", "") If $record = "" Then $record = 1 IniWrite($inifle, "All Price Changes", "record", $record) EndIf If $record <> 1 Then GUICtrlSetState($Item_history, $GUI_DISABLE) ; $updated = IniRead($inifle, "Program", "updated", '') ; If FileExists($catfle) Then SplashTextOn("", "Please Wait!", 200, 120, -1, -1, 33) $ents = IniReadSectionNames($catfle) If Not @error Then $nums = $ents[0] For $e = 1 To $nums $num = StringRight("00" & $e, 3) $ISBN = $ents[$e] $title = IniRead($catfle, $ISBN, "title", "") $author = IniRead($catfle, $ISBN, "author", "") $start = IniRead($catfle, $ISBN, "start", "") $low = IniRead($catfle, $ISBN, "low", "") $high = IniRead($catfle, $ISBN, "high", "") $current = IniRead($catfle, $ISBN, "current", "") If $current <> $start Then $num = $num & "*" ;$URL = IniRead($catfle, $ISBN, "url", "") $paid = IniRead($catfle, $ISBN, "bought", "") If $paid <> "" Then $ISBN = "Bought - " & $ISBN $favorite = IniRead($catfle, $ISBN, "favorite", "") If $favorite = 1 Then $ISBN = "Favorite - " & $ISBN GUICtrlCreateListViewItem($num & "|" & $title & "|" & $ISBN & "|" & $author & "|" & $start & "|" & $low & "|" & $high & "|" & $current, $Listview_ebooks) If $updated = "" And $record = 1 Then ; Once only update (v1.6 or later) to store a changes value where appropriate. SplashTextOn("", "Updating!", 200, 120, -1, -1, 33) $changes = IniRead($catfle, $ISBN, "changes", "") If $changes = "" Then If $low <> $start Or $high <> $start Then $query = IniRead($catfle, $ISBN, "query", $date) If $time = 1 Then $now = $query Else $now = StringSplit($query, " ", 1) $now = $now[1] EndIf $curr = StringLeft($start, 1) $starval = GetValueForPrice($start) If $low <> $start Then $lowval = GetValueForPrice($low) $result = $starval - $lowval GetPriceDifferenceResult() $changes = $low & " (" & $curr & $result & " lower) " & $now EndIf If $high <> $start Then $highval = GetValueForPrice($high) $result = $highval - $starval GetPriceDifferenceResult() $result = $high & " (" & $curr & $result & " higher) " & $now If $changes = "" Then $changes = $result Else $changes = $changes & "|" & $result EndIf EndIf IniWrite($catfle, $ISBN, "changes", $changes) EndIf EndIf EndIf Next If $updated = "" Then $updated = 1 IniWrite($inifle, "Program", "updated", $updated) EndIf $ind = 0 GetSetCurrentStateAfterChanges() EndIf SplashOff() EndIf ; $ontop = IniRead($inifle, "Program Window", "on_top", "") If $ontop = "" Then $ontop = 1 IniWrite($inifle, "Program Window", "on_top", $ontop) EndIf GUICtrlSetState($Button_ontop, $ontop) If $ontop = 4 Then WinSetOnTop($PriceQueryGUI, "", 0) ; $getcnt = IniRead($inifle, "Html Read", "increase", "") If $getcnt == "" Then $getcnt = 0 IniWrite($inifle, "Html Read", "increase", $getcnt) EndIf ; $multi = "" ; $relax = IniRead($inifle, "URL Format", "relax", "") If $relax = "" Then $relax = 1 IniWrite($inifle, "URL Format", "relax", $relax) EndIf ; $data = IniRead($inifle, "Image Data", "store", "") If $data = "" Then $data = 1 IniWrite($inifle, "Image Data", "store", $data) EndIf If $data = 4 Then GUICtrlSetState($Item_image, $GUI_DISABLE) EndIf ; $deftags = "
:pipe|
:pipe|||||

:pipe|

" $tags = IniRead($inifle, "Html Replace", "tags", "") If $tags = "" Then $tags = $deftags IniWrite($inifle, "Html Replace", "tags", $tags) EndIf ; $defchars = " : |–:-|—: - |‘:'|’:'| |�:e|�:e|" & '“:"|”:"|“:"|”:"|' _ & "–:-|—: - |‘:'|’:'|…:...|ê:e" $chars = IniRead($inifle, "Html Replace", "characters", "") If $chars = "" Then $chars = $defchars IniWrite($inifle, "Html Replace", "characters", $chars) EndIf ; $excoms = IniRead($inifle, "Selected Entry Detail", "changes", "") If $excoms = "" Then $excoms = 1 IniWrite($inifle, "Selected Entry Detail", "changes", $excoms) EndIf ; $savpth = IniRead($inifle, "Last Saved List File", "path", "") ; $splash = IniRead($inifle, "Query Splash Screen", "show", "") If $splash = "" Then $splash = 4 IniWrite($inifle, "Query Splash Screen", "show", $splash) EndIf ; $loop = IniRead($inifle, "ADD URL Input", "loop", "") If $loop = "" Then $loop = 4 IniWrite($inifle, "ADD URL Input", "loop", $loop) EndIf ; $slots = IniRead($inifle, "Save Query Results", "slots", "") If $slots = "" Then $slots = 5 IniWrite($inifle, "Save Query Results", "slots", $slots) EndIf ; $stop = IniRead($inifle, "Stop For Query", "enable", "") If $stop = "" Then $stop = 1 IniWrite($inifle, "Stop For Query", "enable", $stop) EndIf ; $favorites = "" GUICtrlSetState($Checkbox_qufav, $GUI_DISABLE) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") $context = "" GuiSetState() While 1 $msg = GuiGetMsg() Select ;~ Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_x ;~ ; Quit, Close or Exit program ;~ GUIDelete($PriceQueryGUI) ;~ ExitLoop Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_x ; Quit, Close or Exit program If $context = "" Then GUIDelete($PriceQueryGUI) ExitLoop Else $context = "" EndIf Case $msg = $Button_save ; Save the ebook list to text file If _IsPressed("10") Then If FileExists($savpth) Then Run(@WindowsDir & "\Notepad.exe " & $savpth) ElseIf _IsPressed("11") Then If FileExists($catfle) Then Run(@WindowsDir & "\Notepad.exe " & $catfle) Else $report = "No. , Title , ISBN , Author , Start , Low , High , Current" & @CRLF $nums = _GUICtrlListView_GetItemCount($Listview_ebooks) For $e = 0 To $nums - 1 $report &= _GUICtrlListView_GetItemText($Listview_ebooks, $e, 0) & " , " $report &= _GUICtrlListView_GetItemText($Listview_ebooks, $e, 1) & " , " $report &= _GUICtrlListView_GetItemText($Listview_ebooks, $e, 2) & " , " $report &= _GUICtrlListView_GetItemText($Listview_ebooks, $e, 3) & " , " $report &= _GUICtrlListView_GetItemText($Listview_ebooks, $e, 4) & " , " $report &= _GUICtrlListView_GetItemText($Listview_ebooks, $e, 5) & " , " $report &= _GUICtrlListView_GetItemText($Listview_ebooks, $e, 6) & " , " $report &= _GUICtrlListView_GetItemText($Listview_ebooks, $e, 7) & @CRLF Next If $report <> "" Then If $savpth = "" Then $savpth = "Kindle Price Query.csv" $pth = FileSaveDialog("Save List To File", "", "Text files (*.csv;*.log;*.nfo;*.rtf;*.txt;*.wri)", 18, $savpth, $PriceQueryGUI) If Not @error Then $savpth = $pth _FileCreate($savpth) _FileWriteToLine($savpth, 1, $report, 1) IniWrite($inifle, "Last Saved List File", "path", $savpth) If FileExists($savpth) Then Run(@WindowsDir & "\Notepad.exe " & $savpth) EndIf EndIf EndIf Case $msg = $Button_rem ; Remove selected ebook GUICtrlSetState($Button_rem, $GUI_DISABLE) If _GUICtrlListView_GetItemSelected($Listview_ebooks, $ind) = True Then $ans = MsgBox(262177, "Removal Query", _ "Are you sure you wish to delete the currently selected list entry?" & @LF & @LF & _ $title, 0, $PriceQueryGUI) If $ans = 1 Then _GUICtrlListView_DeleteItem($Listview_ebooks, $ind) GUICtrlSetData($Input_comm, "") IniDelete($catfle, $ISBN) $nums = _GUICtrlListView_GetItemCount($Listview_ebooks) If $nums > 0 Then For $e = 1 To $nums $ind = $e - 1 $num = StringRight("00" & $e, 3) $start = _GUICtrlListView_GetItemText($Listview_ebooks, $ind, 4) $current = _GUICtrlListView_GetItemText($Listview_ebooks, $ind, 7) If $current <> $start Then $num = $num & "*" _GUICtrlListView_SetItemText($Listview_ebooks, $ind, $num, 0) Next $ind = 0 Else $ind = -1 EndIf GetSetCurrentStateAfterChanges() EndIf Else MsgBox(262192, "Remove Error", "No list entry is selected!", 0, $PriceQueryGUI) EndIf GUICtrlSetState($Button_rem, $GUI_ENABLE) Case $msg = $Button_query And GUICtrlRead($Button_query) = "QUERY" ; Query selected ebook SplashTextOn("", "Please Wait!", 200, 120, -1, -1, 33) GUICtrlSetState($Button_query, $GUI_DISABLE) $IP = _GetIP() If (Not @error And $IP <> -1) Or $test = 1 Then If GUICtrlRead($Checkbox_quall) = $GUI_CHECKED Then If $stop = 1 Then GUICtrlSetState($Button_query, $GUI_ENABLE) GUICtrlSetData($Button_query, "STOP") $end = "" $msg = "" AdlibEnable("StopCheck") EndIf ; $multi = 1 $report = "" GUICtrlSetState($Listview_ebooks, $GUI_FOCUS) If $ind <> 0 Then Send("{HOME}") _GUICtrlListView_SetItemSelected($Listview_ebooks, 0, True, True) EndIf $nums = _GUICtrlListView_GetItemCount($Listview_ebooks) For $e = 1 To $nums $ind = $e - 1 If $e = $nums Then $multi = "" _GUICtrlListView_ClickItem($Listview_ebooks, $ind, "left", False, 1, 1) Else _GUICtrlListView_SetItemSelected($Listview_ebooks, $ind, True, True) ;If $e > 5 Then _GUICtrlListView_Scroll($Listview_ebooks, 0, 12) _GUICtrlListView_EnsureVisible($Listview_ebooks, $ind, False) EndIf If $test = 1 Then GetTheISBN() If $favorites = 1 Then $favorite = IniRead($catfle, $ISBN, "favorite", "") If $favorite = 1 Then $check = 1 Else $check = "" EndIf Else $check = 1 EndIf If $check = 1 And $favorites = 1 Then $title = IniRead($catfle, $ISBN, "title", "") IniWrite($inifle, "Query Title", $e, $title) Sleep(1500) Else Sleep(500) EndIf Else QueryCurrentPrice() EndIf If $stop = 1 And $end = 1 Then ExitLoop Next ; If $stop = 1 Then AdlibDisable() GUICtrlSetState($Button_query, $GUI_DISABLE) GUICtrlSetData($Button_query, "QUERY") EndIf ; If $report <> "" Then ; Create or Update one of a specified number of records If $slots > 0 Then While 1 If IniRead($inifle, "Last Query Result", 1, "") = "" Then IniWrite($inifle, "Last Query Result", 1, "(" & _Now() & ")|" & StringReplace($report, @LF, "|")) ExitLoop Else ; This will initially create blank entries until specified number of queries have occurred and all slots filled. $rec = $slots While 1 IniWrite($inifle, "Last Query Result", $rec, IniRead($inifle, "Last Query Result", $rec - 1, "")) $rec = $rec - 1 If $rec = 0 Then ExitLoop WEnd EndIf WEnd EndIf ; $ans = MsgBox(262465, "Query Report", _ "Some prices have changed since being added to the database." & @LF & @LF & _ $report & @LF & _ "OK = Copy result to the clipboard.", 0, $PriceQueryGUI) If $ans = 1 Then $report = StringReplace($report, @LF, @CRLF) ClipPut($report) EndIf ElseIf $splash = 1 Then Local $mpos, $xpos, $ypos SplashTextOn("", '"Query Report"' & @LF & @LF & _ "(moved mouse closes this splash)" & @LF & @LF & _ "No price changes detected!", 270, 200, -1, -1, 33) $mpos = MouseGetPos() $xpos = $mpos[0] $ypos = $mpos[1] Sleep(1500) While 1 $mpos = MouseGetPos() If $xpos <> $mpos[0] Or $ypos <> $mpos[1] Then SplashOff() ExitLoop EndIf Sleep(500) WEnd EndIf ElseIf _GUICtrlListView_GetItemSelected($Listview_ebooks, $ind) = True Then QueryCurrentPrice() Else MsgBox(262192, "Query Error", "No list entry is selected!", 0, $PriceQueryGUI) EndIf Else MsgBox(262192, "Query Error", "No connection detected!", 0, $PriceQueryGUI) EndIf GUICtrlSetState($Button_query, $GUI_ENABLE) SplashOff() ;MsgBox(262192, "$IP", $IP, 0, $PriceQueryGUI) Case $msg = $Button_ontop ; Toggle the On Top setting If GUICtrlRead($Button_ontop) = $GUI_CHECKED Then $ontop = 1 WinSetOnTop($PriceQueryGUI, "", 1) Else $ontop = 4 WinSetOnTop($PriceQueryGUI, "", 0) EndIf IniWrite($inifle, "Program Window", "on_top", $ontop) Case $msg = $Button_i ; Program Information $ans = MsgBox(262209, "Program Information", _ "This program is in no way, shape or form etc, affiliated with or" & @LF & _ "supported or even recommended by Amazon &/or partners." & @LF & @LF & _ "Amazon Kindle Ebooks can have a price that varies over time," & @LF & _ "so it can pay to keep tabs on ones you are interested in, just" & @LF & _ "in case one becomes low enough for you to purchase." & @LF & @LF & _ "This program aims to simplify the process of doing that." & @LF & @LF & _ "Basically, you get the URL web address of an ebook you are" & @LF & _ "interested in. You could already have this URL (link) in your" & @LF & _ "Amazon Wishlist. Copy this to your clipboard, then click the" & @LF & _ "ADD button. The clipboard entry should appear in the input" & @LF & _ "field presented, or you can just paste it there. The field may" & @LF & _ "be blank, because you are repeating the last item. After a" & @LF & _ "few moments, all the List fields for a new entry should get" & @LF & _ "populated. If they don't, it will be due to an unrecognized" & @LF & _ "situation in the linked to web page for the URL (the only" & @LF & _ "fix for that ebook page is an update of this program)." & @LF & @LF & _ "Once you have added an ebook to the list, you can check it" & @LF & _ "again, by selecting it and clicking on the QUERY button. You" & @LF & _ "can also check any others, all at once (one after the other)" & @LF & _ "by enabling the ALL checkbox. The 'Current' price field will" & @LF & _ "be updated each time, but the 'Low' or 'High' fields won't be" & @LF & _ "unless the current price is less or more. The 'Start' price will" & @LF & _ "never change from what it was when book was first added." & @LF & @LF & _ "If an error occurs, but the web page was successfully read," & @LF & _ "the text should be in the Html.txt or Query.txt file, until it is" & @LF & _ "overwritten by the next error (which helps with diagnosing)." & @LF & @LF & _ "Click OK to read more information." & @LF & @LF & _ "© January 2015 - program created by TheSaint.", 0, $PriceQueryGUI) If $ans = 1 Then MsgBox(262208, "Program Information (cont.)", _ "Sorting can be done, by clicking on the column headers, with" & @LF & _ "Column 1 (by Add order), Column 2 (by Titles alphabetically)," & @LF & _ "Column 3 (by Titles alphabetically, All the Bought items first)," & @LF & _ "Column 4 (by Authors alphabetically, with Editors first)," & @LF & _ "Column 6 (by Price changes, decrease first, increase last)," & @LF & _ "Column 8 (last) (by Current price, lowest to highest)." & @LF & @LF & _ "Selecting a list entry, shows both the added date and last" & @LF & _ "checked date in the Comments field." & @LF & @LF & _ "The SAVE button can be used to save a comma delimited CSV" & @LF & _ "file or view (while CTRL key held down) the 'Catalog.ini' file," & @LF & _ "or view (while SHIFT key held down) the last saved file." & @LF & @LF & _ "THANKS to all those who assisted me in any way - visit the" & @LF & _ "AutoIt Forum pages for this program, to see that detail." & @LF & @LF & _ "Program regularly updated through January & February '15.", 0, $PriceQueryGUI) EndIf Case $msg = $Button_add ; Add another ebook GUICtrlSetState($Button_add, $GUI_DISABLE) $IP = _GetIP() If (Not @error And $IP <> -1) Or $test = 1 Then If $test = 1 Then $URL = "http://www.amazon.com/dp/B00N5E579W/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&colid=2R26DRFTGUUA&coliid=I3LSP96XZ0DQPK" Else $clip = ClipGet() If StringLeft($clip, 7) = "http://" Then $URL = $clip If $lasturl = $URL Then $URL = "" EndIf While 1 $URL = InputBox("ADD an Ebook to the List", "Enter the URL for an ebook (i.e. from a link in your Amazon Wishlist)", $URL, "", 500, 130, -1, -1, 0, $PriceQueryGUI) If @error = 0 And $URL <> "" And ((StringLeft($URL, 22) = "http://www.amazon.com/" And StringInStr($URL, "/dp/") > 0 And $relax = 1) _ Or StringLeft($URL, 25) = "http://www.amazon.com/dp/") Then SplashTextOn("", "Please Wait!", 200, 120, -1, -1, 33) $lasturl = $URL $nums = _GUICtrlListView_GetItemCount($Listview_ebooks) $num = StringRight("00" & $nums + 1, 3) If StringLeft($URL, 25) = "http://www.amazon.com/dp/" Then $ISBN = StringReplace($URL, "http://www.amazon.com/dp/", "") Else $ISBN = StringSplit($URL, "/dp/", 1) $ISBN = $ISBN[2] EndIf $ISBN = StringSplit($ISBN, "/", 1) $ISBN = $ISBN[1] If IniRead($catfle, $ISBN, "title", "") = "" Then $date = _Now() IniWrite($catfle, $ISBN, "date", $date) IniWrite($catfle, $ISBN, "url", $URL) ; $html = _INetGetSource($URL) If @error <> 1 Or $test = 1 Then If $test = 1 Then ; Testing only Local $webfle $webfle = FileOpen(@ScriptDir & "\Ebook.html", 0) ;$webfle = FileOpen(@ScriptDir & "\HTML\WereWoman eBook Piers Anthony.htm", 0) $html = FileRead($webfle) FileClose($webfle) $webfle = "" EndIf $html = StringStripWS($html, 7) _FileWriteToLine($ebooktxt, 1, $html, 1) If $data = 1 Then GetImageData() $chrcnt = Round(StringLen($html) / 4) IniWrite($inifle, "Html Read", "reduction", $chrcnt) $chrcnt = $chrcnt - $getcnt $html = StringTrimLeft($html, $chrcnt) $html = StringTrimRight($html, $chrcnt) ;MsgBox(262208, "$chrcnt", $chrcnt, 0, $PriceQueryGUI) $html = StringSplit($html, "parseasinTitle", 1) ; Line 3564 If $html[0] > 1 Then $html = $html[2] $pos = StringInStr($html, "style=") If $pos > 0 Then $title = StringLeft($html, $pos - 1) $html = StringTrimLeft($html, $pos) $title = StringSplit($title, "id=", 1) $title = $title[2] While StringLeft($title, 1) <> ">" And $title <> "" $title = StringTrimLeft($title, 1) WEnd $title = StringTrimLeft($title, 1) While StringRight($title, 1) <> "<" And $title <> "" $title = StringTrimRight($title, 1) WEnd $title = StringTrimRight($title, 1) $title = StringStripWS($title, 7) IniWrite($catfle, $ISBN, "title", $title) ; $author = "" If StringInStr($html, "(Author)") > 0 Then $remain = StringSplit($html, "(Author)", 1) ; Line 3567 Else $remain = StringSplit($html, "(Editor)", 1) $author = "(Editors) " EndIf If $remain[0] > 1 Then $other = $remain[1] GetTheAuthor() $restof = $remain[2] If $remain[0] > 2 Then ; Appears to be more than one author or editor. $html = StringTrimLeft($html, StringLen($other) + 8) $other = $restof $html = StringTrimLeft($html, StringLen($other) + 8) GetTheAuthor() If $remain[0] > 3 Then ; Appears to be more than two authors or editors. $other = $remain[3] $html = StringTrimLeft($html, StringLen($other) + 8) GetTheAuthor() If $remain[0] > 4 Then ; Appears to be more than three authors or editors. $other = $remain[4] $html = StringTrimLeft($html, StringLen($other) + 8) GetTheAuthor() ; Ignore any more authors or editors. If $remain[0] > 5 Then $author = $author & " (etc)" EndIf EndIf Else $html = $restof EndIf ;MsgBox(262208, "$html", $html, 0, $PriceQueryGUI) IniWrite($catfle, $ISBN, "author", $author) $html = StringSplit($html, "Kindle Price:", 1) ; Line 3679 If $html[0] > 1 Then $html = $html[2] $pos = StringInStr($html, "") $price = StringLeft($html, $pos - 1) $html = StringTrimLeft($html, $pos) $price = StringSplit($price, "priceLarge", 1) $price = $price[2] $price = StringSplit($price, ">", 1) $price = $price[2] $price = StringStripWS($price, 7) $start = $price IniWrite($catfle, $ISBN, "start", $start) $low = $price IniWrite($catfle, $ISBN, "low", $low) $high = $price IniWrite($catfle, $ISBN, "high", $high) $current = $price IniWrite($catfle, $ISBN, "current", $current) ; GetBookDescription() ; GUICtrlCreateListViewItem($num & "|" & $title & "|" & $ISBN & "|" & $author & "|" & $start & "|" & $low & "|" & $high & "|" & $current, $Listview_ebooks) ; $ind = $num - 1 GetSetCurrentStateAfterChanges() ; $URL = "" $title = "" $author = "" Else MsgBox(262192, "Read Error 5", "The 'Price' could not be determined!", 0, $PriceQueryGUI) IniDelete($catfle, $ISBN) EndIf Else MsgBox(262192, "Read Error 4", "The 'Author' could not be determined!", 0, $PriceQueryGUI) IniDelete($catfle, $ISBN) EndIf Else MsgBox(262192, "Read Error 3", "The 'Title' could not be determined!", 0, $PriceQueryGUI) IniDelete($catfle, $ISBN) EndIf Else MsgBox(262192, "Read Error 2", "The 'Title' could not be determined!", 0, $PriceQueryGUI) IniDelete($catfle, $ISBN) EndIf Else MsgBox(262192, "Read Error 1", "The Web Page may no longer exist!", 0, $PriceQueryGUI) IniDelete($catfle, $ISBN) EndIf Else MsgBox(262192, "ADD Error", "This title already exists in the database!", 0, $PriceQueryGUI) EndIf SplashOff() ElseIf @error <> 1 And StringLeft($URL, 25) <> "http://www.amazon.com/dp/" Then MsgBox(262192, "URL Error", _ "Your web address (URL) must start with the following text." & @LF & @LF & _ "http://www.amazon.com/dp/" & @LF & @LF & _ "This is a requirement, and indicates whether you have the" & @LF & _ "correct type of Amazon page for a Kindle Ebook." & @LF & @LF & _ "Each Kindle version of a book, has its own ebook page," & @LF & _ "which is the correct page address to use. Do not use a" & @LF & _ "page that is for Paperback or Hardcover, even if it also" & @LF & _ "lists the Kindle ebook version.", 0, $PriceQueryGUI) ExitLoop EndIf If $loop = 4 Then ExitLoop WEnd Else MsgBox(262192, "Query Error", "No connection detected!", 0, $PriceQueryGUI) EndIf GUICtrlSetState($Button_add, $GUI_ENABLE) Case $msg = $Checkbox_qufav ; Query favorite ebooks If GUICtrlRead($Checkbox_qufav) = $GUI_CHECKED Then $favorites = 1 Else $favorites = "" EndIf Case $msg = $Checkbox_quall ; Query all ebooks If GUICtrlRead($Checkbox_quall) = $GUI_CHECKED Then GUICtrlSetState($Checkbox_qufav, $GUI_ENABLE) Else GUICtrlSetState($Checkbox_qufav, $GUI_UNCHECKED) $favorites = "" GUICtrlSetState($Checkbox_qufav, $GUI_DISABLE) EndIf ;~ Case $msg = $Item_web ;~ ; Go to web page ;~ GetSelectedIndex("") ;~ If $ind <> -1 Then ;~ $URL = IniRead($catfle, $ISBN, "url", "") ;~ ShellExecute($URL) ;~ Else ;~ MsgBox(262192, "Remove Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Case $msg = $Item_summary ;~ ; Get missing summary ;~ SplashTextOn("", "Please Wait!", 200, 120, -1, -1, 33) ;~ GetSelectedIndex("detail") ;~ If $ind <> -1 Then ;~ $IP = _GetIP() ;~ If Not @error And $IP <> -1 Then ;~ ;$ISBN = _GUICtrlListView_GetItemText($Listview_ebooks, $ind, 2) ;~ GetTheISBN() ;~ $URL = IniRead($catfle, $ISBN, "url", "") ;~ $html = _INetGetSource($URL) ;~ If @error <> 1 Then ;~ $html = StringStripWS($html, 7) ;~ GetBookDescription() ;~ Else ;~ MsgBox(262192, "Read Error", "The Web Page may no longer exist!", 0, $PriceQueryGUI) ;~ EndIf ;~ Else ;~ MsgBox(262192, "Summary Error", "No connection detected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Else ;~ MsgBox(262192, "Summary Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ SplashOff() ;~ Case $msg = $Item_query ;~ ; Query results ;~ If $slots > 0 Then ;~ $rec = 1 ;~ While 1 ;~ $report = IniRead($inifle, "Last Query Result", $rec, "") ;~ If $report = "" And $rec = 1 Then ;~ MsgBox(262192, "Query Results", "No record has been created yet!", 0, $PriceQueryGUI) ;~ ExitLoop ;~ Else ;~ If $report = "" Then ;~ $rec = 1 ;~ Else ;~ $report = StringReplace($report, "|", @LF) ;~ $ans = MsgBox(262691, "Query Results", _ ;~ "Prices change record (" & $rec & ") of last " & $slots & " queries." & @LF & _ ;~ "(1) being most recent query, up to (" & $slots & ") being oldest." & @LF & @LF & _ ;~ $report & @LF & _ ;~ "YES = Copy result to the clipboard." & @LF & _ ;~ "NO = Skip to next result." & @LF & _ ;~ "CANCEL = Quit showing Query results.", 0, $PriceQueryGUI) ;~ If $ans = 6 Then ;~ $report = StringReplace($report, @LF, @CRLF) ;~ ClipPut($report) ;~ ElseIf $ans = 7 Then ;~ ; Skip to next result ;~ ElseIf $ans = 2 Then ;~ ExitLoop ;~ EndIf ;~ If $rec = $slots Then ;~ $rec = 1 ;~ Else ;~ $rec = $rec + 1 ;~ EndIf ;~ EndIf ;~ EndIf ;~ WEnd ;~ EndIf ;~ Case $msg = $Item_price ;~ ; View price results ;~ GetSelectedIndex("detail") ;~ If $ind <> -1 Then ;~ $start = IniRead($catfle, $ISBN, "start", "") ;~ $low = IniRead($catfle, $ISBN, "low", "") ;~ $high = IniRead($catfle, $ISBN, "high", "") ;~ $current = IniRead($catfle, $ISBN, "current", "") ;~ $title = IniRead($catfle, $ISBN, "title", "") ;~ ; ;~ $report = $title & @LF ;~ $curr = StringLeft($current, 1) ;~ $lowval = "" ;~ $highval = "" ;~ ; ;~ $starval = GetValueForPrice($start) ;~ If $current <> $start Then ;~ $currval = GetValueForPrice($current) ;~ If $currval < $starval Then ;~ $result = $starval - $currval ;~ GetPriceDifferenceResult() ;~ $report = $report & @LF & "Current price is " & $curr & $result & " lower than start price." & @LF ;~ ElseIf $currval > $starval Then ;~ $result = $currval - $starval ;~ GetPriceDifferenceResult() ;~ $report = $report & @LF & "Current price is " & $curr & $result & " higher than start price." & @LF ;~ EndIf ;~ EndIf ;~ If $low <> $start And $current <> $low Then ;~ $lowval = GetValueForPrice($low) ;~ If $lowval < $starval Then ;~ $result = $starval - $lowval ;~ GetPriceDifferenceResult() ;~ $report = $report & @LF & "Low price is " & $curr & $result & " lower than Start price." & @LF ;~ ElseIf $lowval > $starval Then ;~ ; This should never be the case. ;~ $result = $lowval - $starval ;~ GetPriceDifferenceResult() ;~ $report = $report & @LF & "Low price is " & $curr & $result & " higher than Start price." & @LF ;~ EndIf ;~ ElseIf $low <> $start Then ;~ $report = $report & @LF & "Low price is Current price." & @LF ;~ EndIf ;~ If $high <> $start And $current <> $high Then ;~ $highval = GetValueForPrice($high) ;~ If $highval < $starval Then ;~ ; This should never be the case. ;~ $result = $starval - $highval ;~ GetPriceDifferenceResult() ;~ $report = $report & @LF & "High price is " & $curr & $result & " lower than Start price." & @LF ;~ ElseIf $highval > $starval Then ;~ $result = $highval - $starval ;~ GetPriceDifferenceResult() ;~ $report = $report & @LF & "High price is " & $curr & $result & " higher than Start price." & @LF ;~ EndIf ;~ ElseIf $high <> $start Then ;~ $report = $report & @LF & "High price is Current price." & @LF ;~ EndIf ;~ If $low <> $start And $high <> $start Then ;~ If $lowval = "" Then $lowval = GetValueForPrice($low) ;~ If $highval = "" Then $highval = GetValueForPrice($high) ;~ $result = $highval - $lowval ;~ GetPriceDifferenceResult() ;~ $report = $report & @LF & "Low price is " & $curr & $result & " lower than High price." & @LF ;~ EndIf ;~ If $report = $title & @LF Then $report = $report & @LF & " (no price changes)" & @LF ;~ $ans = MsgBox(262465, "Price Change Report", _ ;~ $report & @LF & _ ;~ "OK = Copy result to the clipboard.", 0, $PriceQueryGUI) ;~ If $ans = 1 Then ;~ $report = StringReplace($report, @LF, @CRLF) ;~ ClipPut($report) ;~ EndIf ;~ Else ;~ MsgBox(262192, "Comment Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Case $msg = $Item_paid ;~ ; Bought this ebook ;~ GetSelectedIndex("") ;~ If $ind <> -1 Then ;~ $paid = IniRead($catfle, $ISBN, "bought", "") ;~ If $paid = "" Then ;~ $current = IniRead($catfle, $ISBN, "current", "") ;~ $paid = "Paid " & $current & " on " & _Now() ;~ EndIf ;~ $report = InputBox("Bought This Ebook", "If needed, edit the values for the following ebook." & @LF & @LF & $title, $paid, "", 300, 150, -1, -1, 0, $PriceQueryGUI) ;~ If @error = 0 Then ;~ $paid = $report ;~ IniWrite($catfle, $ISBN, "bought", $paid) ;~ If $paid = "" Then ;~ _GUICtrlListView_SetItemText($Listview_ebooks, $ind, $ISBN, 2) ;~ Else ;~ _GUICtrlListView_SetItemText($Listview_ebooks, $ind, "Bought - " & $ISBN, 2) ;~ $favorite = IniRead($catfle, $ISBN, "favorite", "") ;~ If $favorite = 1 Then ;~ $favorite = "" ;~ IniWrite($catfle, $ISBN, "favorite", $favorite) ;~ EndIf ;~ EndIf ;~ Else ;~ $paid = "" ;~ EndIf ;~ Else ;~ MsgBox(262192, "Comment Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Case $msg = $Item_opts ;~ ; SETTINGS ;~ SettingsGUI() ;~ Case $msg = $Item_notes ;~ ; Add a comment ;~ GetSelectedIndex("detail") ;~ If $ind <> -1 Then ;~ $comment = IniRead($catfle, $ISBN, "comment", "") ;~ $report = InputBox("ADD A Comment", "ADD a Comment to the selected entry - " & $ISBN, $comment, "", 500, 130, -1, -1, 0, $PriceQueryGUI) ;~ If @error = 0 Then ;~ $comment = $report ;~ IniWrite($catfle, $ISBN, "comment", $comment) ;~ DetermineComment() ;~ EndIf ;~ Else ;~ MsgBox(262192, "Comment Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Case $msg = $Item_image ;~ ; Selected Entry Detail (image + text) ;~ GetSelectedIndex("detail") ;~ If $ind <> -1 Then ;~ ImageDataGUI() ;~ Else ;~ MsgBox(262192, "Detail Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Case $msg = $Item_history ;~ ; Price History ;~ GetSelectedIndex("detail") ;~ If $ind <> -1 Then ;~ If $record = 1 Then ;~ $changes = IniRead($catfle, $ISBN, "changes", "") ;~ If $changes = "" Then ;~ $report = "No changes have been recorded yet!" & @LF ;~ Else ;~ $report = $changes & @LF ;~ $report = StringReplace($report, "|", @LF) ;~ EndIf ;~ $report = "'" & $title & "'" & @LF & "by " & $author & @LF & @LF & $report ;~ $ans = MsgBox(262465, "History Of Price Changes", _ ;~ $report & @LF & _ ;~ "OK = Copy result to the clipboard.", 0, $PriceQueryGUI) ;~ If $ans = 1 Then ;~ $report = StringReplace($report, @LF, @CRLF) ;~ ClipPut($report) ;~ EndIf ;~ EndIf ;~ Else ;~ MsgBox(262192, "History Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Case $msg = $Item_favorite ;~ ; Set ebook as a favorite ;~ GetSelectedIndex("") ;~ If $ind <> -1 Then ;~ $paid = IniRead($catfle, $ISBN, "bought", "") ;~ If $paid <> "" Then ;~ $favorite = "" ;~ GUICtrlSetState($Item_favorite, $GUI_DISABLE) ;~ MsgBox(262192, "Assign Error", "A bought book cannot be set as a favorite!", 0, $PriceQueryGUI) ;~ Else ;~ $favorite = IniRead($catfle, $ISBN, "favorite", "") ;~ If $favorite = "" Then ;~ $favorite = 1 ;~ _GUICtrlListView_SetItemText($Listview_ebooks, $ind, "Favorite - " & $ISBN, 2) ;~ Else ;~ $favorite = "" ;~ _GUICtrlListView_SetItemText($Listview_ebooks, $ind, $ISBN, 2) ;~ EndIf ;~ IniWrite($catfle, $ISBN, "favorite", $favorite) ;~ EndIf ;~ Else ;~ MsgBox(262192, "Comment Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Case $msg = $Item_entry ;~ ; Selected Entry Detail (text) ;~ GetSelectedIndex("detail") ;~ If $ind <> -1 Then ;~ GetDetailReport() ;~ $URL = IniRead($catfle, $ISBN, "url", "") ;~ $report = $report & "URL = " & $URL & @LF & @LF ;~ $comment = IniRead($catfle, $ISBN, "comment", "") ;~ If $comment <> "" Then ;~ $report = $report & "Comments = " & $comment & @LF & @LF ;~ EndIf ;~ $summary = IniRead($catfle, $ISBN, "summary", "") ;~ $summary = StringReplace($summary, "|", @LF) ;~ $report = $report & "Summary = " & $summary & @LF ;~ If $excoms = 1 Then ;~ $changes = IniRead($catfle, $ISBN, "changes", "") ;~ If $changes <> "" Then $report = $report & @LF & $changes & @LF ;~ EndIf ;~ If $report <> "" Then ;~ $ans = MsgBox(262465, "Selected Entry Detail", _ ;~ $report & @LF & _ ;~ "OK = Copy result to the clipboard.", 0, $PriceQueryGUI) ;~ If $ans = 1 Then ;~ $report = StringReplace($report, @LF, @CRLF) ;~ ClipPut($report) ;~ EndIf ;~ EndIf ;~ Else ;~ MsgBox(262192, "Remove Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Case $msg = $Item_data ;~ ; Get missing image data ;~ SplashTextOn("", "Please Wait!", 200, 120, -1, -1, 33) ;~ If $data = 4 Then ;~ $data = 1 ;~ IniWrite($inifle, "Image Data", "store", $data) ;~ GUICtrlSetState($Item_image, $GUI_ENABLE) ;~ EndIf ;~ GetSelectedIndex("detail") ;~ If $ind <> -1 Then ;~ $IP = _GetIP() ;~ If Not @error And $IP <> -1 Then ;~ ;$ISBN = _GUICtrlListView_GetItemText($Listview_ebooks, $ind, 2) ;~ GetTheISBN() ;~ $URL = IniRead($catfle, $ISBN, "url", "") ;~ $html = _INetGetSource($URL) ;~ If @error <> 1 Then ;~ $html = StringStripWS($html, 7) ;~ GetImageData() ;~ Else ;~ MsgBox(262192, "Read Error", "The Web Page may no longer exist!", 0, $PriceQueryGUI) ;~ EndIf ;~ Else ;~ MsgBox(262192, "Image Error", "No connection detected!", 0, $PriceQueryGUI) ;~ EndIf ;~ Else ;~ MsgBox(262192, "Image Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf ;~ SplashOff() ;~ Case $msg = $Item_copy ;~ ; Copy URL to clipboard ;~ GetSelectedIndex("") ;~ If $ind <> -1 Then ;~ $URL = IniRead($catfle, $ISBN, "url", "") ;~ ClipPut($URL) ;~ Else ;~ MsgBox(262192, "Remove Error", "No list entry is selected!", 0, $PriceQueryGUI) ;~ EndIf Case $msg = $Listview_ebooks Or ($msg > $lowid And $msg < $bigid) ; Select a List entry or Sort by column ;MsgBox(262208, $msg, $lowid, 0, $PriceQueryGUI) If $msg = $Listview_ebooks Then $colnum = GUICtrlGetState($Listview_ebooks) ;If $colnum = 0 Or $colnum = 1 Or $colnum = 2 Or $colnum = 3 Or $colnum = 5 Or $colnum = 7 Then If StringInStr("012357", $colnum) > 0 Then _GUICtrlListView_DeleteAllItems($Listview_ebooks) SortByColumnNumber() EndIf Else ; $multi = 1 during a full Query. If $multi = "" Then $ind = $msg - $lowid - 1 ;$ISBN = _GUICtrlListView_GetItemText($Listview_ebooks, $ind, 2) GetTheISBN() $title = IniRead($catfle, $ISBN, "title", "") $author = IniRead($catfle, $ISBN, "author", "") DetermineComment() EndIf EndIf If $show = 1 Then MsgBox(262208, "$msg $lowid $ind", $msg & " : " & $lowid & " : " & $ind, 0, $PriceQueryGUI) Case Else ;;; EndSelect WEnd Exit Func ImageDataGUI() Local $Button_comment, $Button_copy, $Button_visit, $Button_x2, $Edit_rep Local $GUIActiveX, $ImageGUI, $Input_extra, $Input_URL, $oBody, $oIE, $webfle $imgfle = $imgfld & "\" & $ISBN & ".dat" If FileExists($imgfle) Then $webfle = FileOpen($imgfle, 0) $image = FileRead($webfle) FileClose($webfle) $webfle = "" _IEErrorHandlerRegister() ; $oIE = _IECreateEmbedded() $ImageGUI = GUICreate("Selected Entry Detail", 790, 506, (@DesktopWidth - 790) / 2, (@DesktopHeight - 506) / 2, _ $WS_OVERLAPPED + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_MINIMIZEBOX + $WS_SYSMENU, $WS_EX_TOPMOST) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, 350, 360) ; ; CONTROLS $Edit_rep = GUICtrlCreateEdit("", 370, 10, 405, 360, $WS_VSCROLL + $ES_WANTRETURN + $ES_MULTILINE + $ES_AUTOVSCROLL) ; $Input_URL = GUICtrlCreateInput("", 10, 380, 765, 20) ; $Input_extra = GUICtrlCreateInput("", 10, 410, 445, 50, $WS_VSCROLL + $ES_WANTRETURN + $ES_MULTILINE + $ES_AUTOVSCROLL) $Button_comment = GuiCtrlCreateButton("ADD SOME" & @LF & "COMMENTS", 455, 410, 85, 50, $BS_MULTILINE) GUICtrlSetFont($Button_comment, 7, 600, 0, "Small Fonts") GUICtrlSetTip($Button_comment, "Update stored comments for this ebook!") ; $Button_visit = GuiCtrlCreateButton("VISIT THE" & @LF & "WEB PAGE", 550, 410, 80, 50, $BS_MULTILINE) GUICtrlSetFont($Button_visit, 7, 600, 0, "Small Fonts") GUICtrlSetTip($Button_visit, "Visit the web page for this ebook!") ; $Button_copy = GuiCtrlCreateButton("COPY ALL" & @LF & "DETAILS", 640, 410, 75, 50, $BS_MULTILINE) GUICtrlSetFont($Button_copy, 7, 600, 0, "Small Fonts") GUICtrlSetTip($Button_copy, "Copy all details to clipboard!") ; $Button_x2 = GuiCtrlCreateButton("EXIT", 725, 410, 50, 50, $BS_ICON) GUICtrlSetImage($Button_x2, $shell, $icoX, 1) GUICtrlSetTip($Button_x2, "Quit, Close or Exit window!") ; ; SETTINGS GetDetailReport() $summary = IniRead($catfle, $ISBN, "summary", "") $summary = StringReplace($summary, "|", @CRLF) $report = $report & "Summary = " & $summary & @LF If $report <> "" Then $report = StringReplace($report, @LF, @CRLF) GUICtrlSetData($Edit_rep, $report) EndIf ; $URL = IniRead($catfle, $ISBN, "url", "") GUICtrlSetData($Input_URL, $URL) ; $comment = IniRead($catfle, $ISBN, "comment", "") $comment = StringReplace($comment, "|", @CRLF) $changes = IniRead($catfle, $ISBN, "changes", "") If $changes <> "" Then $changes = StringReplace($changes, "|", @CRLF) $changes = "<--------- Changes below this line aren't kept --------->" & @CRLF & $changes $comments = $comment & @CRLF & $changes Else $comments = $comment EndIf ;$comments = StringStripWS($comments, 1) GUICtrlSetData($Input_extra, $comments) ; GUISetState() ; _IENavigate($oIE, $htmfle) $oBody = _IETagNameGetCollection($oIE, "body", 0) _IEDocInsertHTML($oBody, $image, "afterbegin") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_x2 ; Quit, Close or Exit window GUIDelete($ImageGUI) ExitLoop Case $msg = $Button_visit ; Visit the web page for this ebook If $URL <> "" Then ShellExecute($URL) Case $msg = $Button_copy ; Copy all details to clipboard $report = GUICtrlRead($Edit_rep) $report = $report & @CRLF & "URL = " & $URL If $comment <> "" Then $report = $report & @CRLF & "Comment = " & $comment If $changes <> "" Then $report = $report & @CRLF & $changes $report = StringStripWS($report, 1) ClipPut($report) Case $msg = $Button_comment ; Update stored comments for this ebook $comment = GUICtrlRead($Input_extra) $comment = StringSplit($comment, "<-------", 1) $comment = $comment[1] $comment = StringReplace($comment, @CRLF, "|") IniWrite($catfle, $ISBN, "comment", $comment) Case Else ;;; EndSelect WEnd If $comment <> "" Then DetermineComment() Else MsgBox(262192, "File Error", "Image data file is missing!", 0, $PriceQueryGUI) EndIf EndFunc ;=> ImageDataGUI Func SettingsGUI() Local $Button_defs, $Button_i3, $Button_ini, $Button_tag, $Button_val, $Button_x3 Local $Checkbox_loop, $Checkbox_record, $Checkbox_relax, $Checkbox_show, $Checkbox_splash Local $Checkbox_stop, $Checkbox_store, $Checkbox_time, $Group_html, $Group_read Local $Input_add, $Input_reduct, $Input_save, $Input_sign, $Input_tag, $Input_val Local $Label_read, $Label_save, $Label_sign, $Label_tag, $Label_val, $Updown_save Local $idx, $note, $Settings $Settings = GuiCreate("Settings", 320, 360, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU _ + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_MINIMIZEBOX, $WS_EX_TOPMOST) ; CONTROLS $Checkbox_relax = GuiCtrlCreateCheckbox("Relax the URL format for ADD", 10, 10, 170, 20) $Checkbox_show = GuiCtrlCreateCheckbox("Show ALL price changes in the Selected Entry Detail dialog", 10, 35, 300, 20) $Checkbox_record = GuiCtrlCreateCheckbox("Record ALL price changes for each ebook", 10, 60, 220, 20) $Checkbox_time = GuiCtrlCreateCheckbox("Include the Time in Date for price changes", 10, 85, 225, 20) $Checkbox_store = GuiCtrlCreateCheckbox("Store the Image data for each ebook", 10, 110, 195, 20) ; $Label_sign = GUICtrlCreateLabel("Alternate Currency", 195, 10, 95, 20, $SS_CENTER + $SS_CENTERIMAGE) $Input_sign = GUICtrlCreateInput("", 290, 10, 20, 20) ; $Button_ini = GuiCtrlCreateButton("I", 207, 109, 20, 20, $BS_ICON) GUICtrlSetImage($Button_ini, $shell, $icoN, 0) GUICtrlSetTip($Button_ini, "Open the Settings.ini or Catalog.ini file!") ; $Button_defs = GuiCtrlCreateButton("DEFAULTS", 235, 65, 75, 65) GUICtrlSetFont($Button_defs, 6, 600, 0, "Small Fonts") GUICtrlSetTip($Button_defs, "Restore settings to defaults!") ; $Group_html = GuiCtrlCreateGroup("HTML Read Replacements", 10, 140, 240, 80) $Label_tag = GUICtrlCreateLabel("TAG", 20, 160, 35, 21, $SS_CENTER + $SS_CENTERIMAGE) GUICtrlSetBkColor($Label_tag, 0x000000) GUICtrlSetColor($Label_tag, 0xFFFFFF) $Combo_tag = GUICtrlCreateCombo("", 55, 160, 80, 21) $Input_tag = GUICtrlCreateInput("", 140, 160, 35, 21) $Button_tag = GuiCtrlCreateButton("UPDATE", 185, 160, 55, 21) GUICtrlSetFont($Button_tag, 6, 600, 0, "Small Fonts") GUICtrlSetTip($Button_tag, "Add or Update a TAG!") ;;; $Label_val = GUICtrlCreateLabel("VALUE", 20, 190, 45, 21, $SS_CENTER + $SS_CENTERIMAGE) GUICtrlSetBkColor($Label_val, 0x000000) GUICtrlSetColor($Label_val, 0xFFFFFF) $Combo_val = GUICtrlCreateCombo("", 65, 190, 70, 21) $Input_val = GUICtrlCreateInput("", 140, 190, 35, 21) $Button_val = GuiCtrlCreateButton("UPDATE", 185, 190, 55, 21) GUICtrlSetFont($Button_val, 6, 600, 0, "Small Fonts") GUICtrlSetTip($Button_val, "Add or Update a VALUE!") ; $Group_read = GuiCtrlCreateGroup("HTML Read Characters (Removed + Add)", 10, 230, 240, 50) $Label_read = GUICtrlCreateLabel("Last Reduction", 20, 250, 90, 20, $SS_CENTER + $SS_CENTERIMAGE + $SS_NOTIFY) GUICtrlSetBkColor($Label_read, 0x0000F0) GUICtrlSetColor($Label_read, 0xFFFFFF) $Input_reduct = GUICtrlCreateInput("", 110, 250, 60, 20, $ES_READONLY) $Input_add = GUICtrlCreateInput("", 180, 250, 60, 20, $ES_NUMBER) ; $Button_i3 = GuiCtrlCreateButton("Info", 260, 145, 50, 60, $BS_ICON) GUICtrlSetImage($Button_i3, $user, $icoI, 1) GUICtrlSetTip($Button_i3, "Settings Information!") ; $Button_x3 = GuiCtrlCreateButton("EXIT", 260, 220, 50, 60, $BS_ICON) GUICtrlSetImage($Button_x3, $shell, $icoX, 1) GUICtrlSetTip($Button_x3, "Quit, Close or Exit window!") ; $Checkbox_loop = GuiCtrlCreateCheckbox("Keep presenting the URL InputBox until CANCEL is clicked", 10, 290, 300, 20) $Checkbox_splash = GuiCtrlCreateCheckbox("Show splash screen if no price changes detected by Query", 10, 310, 300, 20) $Checkbox_stop = GuiCtrlCreateCheckbox("Enable STOP for a Query", 10, 330, 140, 20) $Label_save = GUICtrlCreateLabel("Save up to", 173, 330, 62, 20, $SS_CENTER + $SS_CENTERIMAGE) $Input_save = GUICtrlCreateInput("", 234, 330, 36, 20, $ES_NUMBER) $Updown_save = GUICtrlCreateUpdown($Input_save) GUICtrlSetLimit($Updown_save, 99, 0) GUICtrlCreateLabel("queries", 273, 330, 40, 20, $SS_CENTERIMAGE) ; ; SETTINGS GUICtrlSetState($Checkbox_relax, $relax) GUICtrlSetState($Checkbox_show, $excoms) GUICtrlSetState($Checkbox_record, $record) GUICtrlSetState($Checkbox_time, $time) GUICtrlSetState($Checkbox_store, $data) ; GUICtrlSetData($Input_sign, $csign) ; GetTagSettings() ; GetValueSettings() ; $chrcnt = IniRead($inifle, "Html Read", "reduction", "") GUICtrlSetData($Input_reduct, $chrcnt) GUICtrlSetData($Input_add, $getcnt) ; GUICtrlSetState($Checkbox_loop, $loop) GUICtrlSetState($Checkbox_splash, $splash) GUICtrlSetState($Checkbox_stop, $stop) ; GUICtrlSetData($Input_save, $slots) ; $note = "" GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_x3 ; Quit, Close or Exit window $csign = GUICtrlRead($Input_sign) If $csign = "" Then $csign = "£" IniWrite($inifle, "Currency", "sign", $csign) ; $getcnt = GUICtrlRead($Input_add) If $getcnt = "" Then $getcnt = 0 IniWrite($inifle, "Html Read", "increase", $getcnt) ; GUIDelete($Settings) ExitLoop Case $msg = $GUI_EVENT_RESTORE If $note = 1 Then $note = "" GUISetState(@SW_SHOW, $PriceQueryGUI) EndIf Case $msg = $Button_val ; Add or Update a VALUE $val = GUICtrlRead($Combo_val) If $val = "" Then $ans = MsgBox(262433, "Restore Default Query", _ "Do you want to restore the default program" & @LF & _ "values for VALUES (characters)?" & @LF & @LF & _ "WARNING - Any user additions will be lost.", 0, $Settings) If $ans = 1 Then $chars = $defchars IniWrite($inifle, "Html Replace", "characters", $chars) GUICtrlSetData($Combo_val, "", "") GetValueSettings() EndIf Else $rep = GUICtrlRead($Input_val) If StringInStr($allchars, $val) < 1 Then $allchars = $allchars & "|" & $val $valreps = $valreps & "|" & $rep GUICtrlSetData($Combo_val, "", "") GUICtrlSetData($Combo_val, $allchars, $val) ; $chars = $chars & "|" & $val & ":" & $rep IniWrite($inifle, "Html Replace", "characters", $chars) Else ; Query removal $ans = MsgBox(262433, "VALUE Removal", _ "Are you sure you wish to remove the selected VALUE" & @LF & @LF & _ $val & @LF & @LF & _ "from the stored checklist?", 0, $Settings) If $ans = 1 Then $allchars = StringReplace($allchars, "|" & $val, "") $idx = _GUICtrlComboBox_GetCurSel($Combo_val) If $idx > -1 Then $valreps = StringSplit($valreps, "|", 1) _ArrayDelete($valreps, $idx + 2) $valreps = _ArrayToString($valreps, "|", 1) EndIf GUICtrlSetData($Combo_val, "", "") GUICtrlSetData($Combo_val, $allchars, "") GUICtrlSetData($Input_val, "") ; $chars = StringReplace("|" & $chars, "|" & $val & ":" & $rep, "") If StringLeft($chars, 1) = "|" Then $chars = StringTrimLeft($chars, 1) IniWrite($inifle, "Html Replace", "characters", $chars) ;MsgBox(262192, "$valreps", $valreps, 0, $Settings) EndIf EndIf EndIf Case $msg = $Button_tag ; Add or Update a TAG $tag = GUICtrlRead($Combo_tag) If $tag = "" Then $ans = MsgBox(262433, "Restore Default Query", _ "Do you want to restore the default program" & @LF & _ "values for TAGS?" & @LF & @LF & _ "WARNING - Any user additions will be lost.", 0, $Settings) If $ans = 1 Then $tags = $deftags IniWrite($inifle, "Html Replace", "tags", $tags) GUICtrlSetData($Combo_tag, "", "") GetTagSettings() EndIf Else $rep = GUICtrlRead($Input_tag) If StringInStr($alltags, $tag) < 1 Then $alltags = $alltags & "|" & $tag If $rep = "|" Then $rep = "pipe" $tagreps = $tagreps & "|" & $rep GUICtrlSetData($Combo_tag, "", "") GUICtrlSetData($Combo_tag, $alltags, $tag) ; $tags = $tags & "|" & $tag & ":" & $rep IniWrite($inifle, "Html Replace", "tags", $tags) Else ; Query removal $ans = MsgBox(262433, "TAG Removal", _ "Are you sure you wish to remove the selected TAG" & @LF & @LF & _ $tag & @LF & @LF & _ "from the stored checklist?", 0, $Settings) If $ans = 1 Then $alltags = StringReplace($alltags, "|" & $tag, "") $idx = _GUICtrlComboBox_GetCurSel($Combo_tag) If $idx > -1 Then $tagreps = StringSplit($tagreps, "|", 1) _ArrayDelete($tagreps, $idx + 2) $tagreps = _ArrayToString($tagreps, "|", 1) EndIf GUICtrlSetData($Combo_tag, "", "") GUICtrlSetData($Combo_tag, $alltags, "") GUICtrlSetData($Input_tag, "") ; If $rep = "|" Then $rep = "pipe" $tags = StringReplace("|" & $tags, "|" & $tag & ":" & $rep, "") If StringLeft($tags, 1) = "|" Then $tags = StringTrimLeft($tags, 1) IniWrite($inifle, "Html Replace", "tags", $tags) ;MsgBox(262192, "$tagreps", $tagreps, 0, $Settings) EndIf EndIf EndIf Case $msg = $Button_ini ; Open the Settings.ini or Catalog.ini file GUISetState(@SW_HIDE, $PriceQueryGUI) GUISetState(@SW_MINIMIZE, $Settings) If _IsPressed("11") Then If FileExists($catfle) Then Run(@WindowsDir & "\Notepad.exe " & $catfle) WinWait("Catalog.ini - Notepad", "", 5) WinSetOnTop("Catalog.ini - Notepad", "", 1) Sleep(3000) WinSetOnTop("Catalog.ini - Notepad", "", 0) EndIf Else If FileExists($inifle) Then Run(@WindowsDir & "\Notepad.exe " & $inifle) WinWait("Settings.ini - Notepad", "", 5) WinSetOnTop("Settings.ini - Notepad", "", 1) Sleep(3000) WinSetOnTop("Settings.ini - Notepad", "", 0) EndIf EndIf $note = 1 Case $msg = $Button_i3 ; Settings Information MsgBox(262208, "Settings Information", _ "Unless you understand the various options in the Settings window," & @LF & _ "I recommend you don't adjust them from the defaults." & @LF & @LF & _ "Clicking the UPDATE buttons for TAG or VALUE, allows you to add" & @LF & _ "other TAGS or VALUES (characters), or get prompted about the" & @LF & _ "removal of the currently selected one, or restore the default." & @LF & @LF & _ "The 'Replacement' fields (inputs) can be left blank if you don't wish" & @LF & _ "to have a replacement. Use a pipe '|' character in the replacement" & @LF & _ "field for TAG, to represent a carriage return." & @LF & @LF & _ "Clicking the Blue 'Last Reduction' label, will return a toggled value" & @LF & _ "('0' etc) to the ADD input field." & @LF & @LF & _ "Any change to Alternate Currency, updates when window closes," & @LF & _ "which likewise applies to ADD input for HTML Read Characters." & @LF & @LF & _ "The INI button can be used to view (open) either the 'Settings.ini'" & @LF & _ "file or (while CTRL key held down) the 'Catalog.ini' file.", 0, $Settings) Case $msg = $Button_defs ; Restore settings to defaults $relax = 1 IniWrite($inifle, "URL Format", "relax", $relax) GUICtrlSetState($Checkbox_relax, $relax) $excoms = 1 IniWrite($inifle, "Selected Entry Detail", "changes", $excoms) GUICtrlSetState($Checkbox_show, $excoms) $record = 1 IniWrite($inifle, "All Price Changes", "record", $record) GUICtrlSetState($Checkbox_record, $record) GUICtrlSetState($Item_history, $GUI_ENABLE) $time = 4 IniWrite($inifle, "Now Date Format", "time", $time) GUICtrlSetState($Checkbox_time, $time) $data = 1 IniWrite($inifle, "Image Data", "store", $data) GUICtrlSetState($Checkbox_store, $data) GUICtrlSetState($Item_image, $GUI_ENABLE) ; If $csign <> "£" Then $ans = MsgBox(262465, "Restore Defaults Query", _ "Do you also want the pound sign" & @LF & _ "restored for Alternate Currency?", 0, $Settings) If $ans = 1 Then $csign = "£" IniWrite($inifle, "Currency", "sign", $csign) GUICtrlSetData($Input_sign, $csign) EndIf EndIf Case $msg = $Checkbox_time ; Include the Time in Date for price changes If GUICtrlRead($Checkbox_time) = $GUI_CHECKED Then $time = 1 Else $time = 4 EndIf IniWrite($inifle, "Now Date Format", "time", $time) Case $msg = $Checkbox_store ; Store the Image data for each ebook If GUICtrlRead($Checkbox_store) = $GUI_CHECKED Then $data = 1 GUICtrlSetState($Item_image, $GUI_ENABLE) Else $data = 4 GUICtrlSetState($Item_image, $GUI_DISABLE) EndIf IniWrite($inifle, "Image Data", "store", $data) Case $msg = $Checkbox_stop ; Enable STOP for a Query If GUICtrlRead($Checkbox_stop) = $GUI_CHECKED Then $stop = 1 Else $stop = 4 EndIf IniWrite($inifle, "Stop For Query", "enable", $stop) Case $msg = $Checkbox_splash ; Show splash screen if no price changes detected with query If GUICtrlRead($Checkbox_splash) = $GUI_CHECKED Then $splash = 1 Else $splash = 4 EndIf IniWrite($inifle, "Query Splash Screen", "show", $splash) Case $msg = $Checkbox_show ; Show ALL price changes in the Selected Entry Detail dialog If GUICtrlRead($Checkbox_show) = $GUI_CHECKED Then $excoms = 1 Else $excoms = 4 EndIf IniWrite($inifle, "Selected Entry Detail", "changes", $excoms) Case $msg = $Checkbox_relax ; Relax the URL format for ADD If GUICtrlRead($Checkbox_relax) = $GUI_CHECKED Then $relax = 1 Else $relax = 4 EndIf IniWrite($inifle, "URL Format", "relax", $relax) Case $msg = $Checkbox_record ; Record ALL price changes for each ebook If GUICtrlRead($Checkbox_record) = $GUI_CHECKED Then $record = 1 GUICtrlSetState($Item_history, $GUI_ENABLE) Else $record = 4 GUICtrlSetState($Item_history, $GUI_DISABLE) EndIf IniWrite($inifle, "All Price Changes", "record", $record) Case $msg = $Checkbox_loop ; Keep presenting the URL InputBox until CANCEL is clicked If GUICtrlRead($Checkbox_loop) = $GUI_CHECKED Then $loop = 1 Else $loop = 4 EndIf IniWrite($inifle, "ADD URL Input", "loop", $loop) Case $msg = $Combo_val ; VALUES - HTML Read Replacements $val = GUICtrlRead($Combo_val) If $val = "" Then GUICtrlSetData($Input_val, "") Else $idx = _GUICtrlComboBox_GetCurSel($Combo_val) If $idx > -1 Then $rep = StringSplit($valreps, "|", 1) $rep = $rep[$idx + 2] ;If $rep = "pipe" Then $rep = "|" GUICtrlSetData($Input_val, $rep) Else GUICtrlSetData($Input_val, "") EndIf EndIf Case $msg = $Combo_tag ; TAGS - HTML Read Replacements $tag = GUICtrlRead($Combo_tag) If $tag = "" Then GUICtrlSetData($Input_tag, "") Else $idx = _GUICtrlComboBox_GetCurSel($Combo_tag) If $idx > -1 Then $rep = StringSplit($tagreps, "|", 1) $rep = $rep[$idx + 2] If $rep = "pipe" Then $rep = "|" GUICtrlSetData($Input_tag, $rep) Else GUICtrlSetData($Input_tag, "") EndIf EndIf Case $msg = $Label_read ; Last Reduction for Add $getcnt = GUICtrlRead($Input_add) If $getcnt <> 0 Then $getcnt = 0 Else $getcnt = GUICtrlRead($Input_reduct) EndIf GUICtrlSetData($Input_add, $getcnt) Case $msg = $Updown_save ; Adjust number of save slots for query results $slots = GUICtrlRead($Input_save) IniWrite($inifle, "Save Query Results", "slots", $slots) Case Else ;;; EndSelect WEnd EndFunc ;=> SettingsGUI Func DetermineComment() $comment = IniRead($catfle, $ISBN, "comment", "") $comment = StringReplace($comment, "|", " ") $date = IniRead($catfle, $ISBN, "date", "") $query = IniRead($catfle, $ISBN, "query", $date) $comments = StringStripWS($comment & " (added = " & $date & ") (checked = " & $query & ")", 1) $changes = IniRead($catfle, $ISBN, "changes", "") If $changes <> "" Then $comments = $comments & "|" & $changes GUICtrlSetData($Input_comm, $comments) GUICtrlSetState($Input_comm, $GUI_FOCUS) Send("{HOME}") GUICtrlSetState($Listview_ebooks, $GUI_FOCUS) _GUICtrlListView_SetItemSelected($Listview_ebooks, $ind, True, True) EndFunc ;=> DetermineComment Func GetAllChanges() If $time = 1 Then $now = _Now() Else $now = _NowDate() EndIf $changes = IniRead($catfle, $ISBN, "changes", "") If $changes <> "" Then $changes = $changes & "|" EndFunc ;=> GetAllChanges Func GetBookDescription() $pos = StringInStr($html, ">Book Description<") ; Line 4341 If $pos > 0 Then $html = StringSplit($html, ">Book Description<", 1) $html = $html[2] $html = StringSplit($html, "", 1) ;MsgBox(262192, "$html[0]", $html[0], 0, $PriceQueryGUI) $check = $html[2] $check = StringStripWS($check, 7) ;MsgBox(262192, "$check", $check, 0, $PriceQueryGUI) If StringRight($check, 5) = "
" Then $html = $html[3] Else $html = $check EndIf $html = StringSplit($html, "
", 1) $html = $html[1] $html = StringReplace($html, @CR, " ") $html = StringReplace($html, @CRLF, " ") $html = StringReplace($html, @LF, " ") $check = StringSplit($tags, "|") For $t = 1 To $check[0] $tag = StringSplit($check[$t], ":") If $tag[0] = 2 Then $replace = $tag[2] If $replace = "pipe" Then $replace = "|" Else $replace = "" EndIf $tag = $tag[1] $html = StringReplace($html, $tag, $replace) Next $html = StringReplace($html, "| |", "||") $html = StringReplace($html, "|||", "||") ; For $pos = 1 To StringLen($html) $summary = StringRight($html, $pos) If StringLeft($summary, 1) = ">" Then $summary = StringTrimLeft($summary, 1) ExitLoop EndIf Next If $summary <> "" Then $check = StringSplit($chars, "|") For $c = 1 To $check[0] $char = StringSplit($check[$c], ":") If $char[0] = 2 Then $replace = $char[2] Else $replace = "" EndIf $char = $char[1] $summary = StringReplace($summary, $char, $replace) Next $summary = StringStripWS($summary, 7) $summary = StringReplace($summary, "| |", "||") $summary = StringReplace($summary, "|||", "||") While StringLeft($summary, 1) = "|" $summary = StringTrimLeft($summary, 1) WEnd While StringRight($summary, 1) = "|" $summary = StringTrimRight($summary, 1) WEnd IniWrite($catfle, $ISBN, "summary", $summary) $summary = "" EndIf Else MsgBox(262192, "Read Error 6", "The 'Book Description' could not be determined!", 0, $PriceQueryGUI) EndIf $html = "" EndFunc ;=> GetBookDescription Func GetDetailReport() $report = "Title = " & $title & @LF ;$author = IniRead($catfle, $ISBN, "author", "") $report = $report & "Author = " & $author & @LF $report = $report & "Added = " & $date & @LF $report = $report & "Last checked = " & $query & @LF $changed = IniRead($catfle, $ISBN, "changed", "") $report = $report & "Last change = " & $changed & @LF $previous = IniRead($catfle, $ISBN, "previous", $changed) $report = $report & "Previous change = " & $previous & @LF $start = IniRead($catfle, $ISBN, "start", "") $report = $report & "Added price = " & $start & @LF $low = IniRead($catfle, $ISBN, "low", "") $report = $report & "Lowest price = " & $low & @LF $high = IniRead($catfle, $ISBN, "high", "") $report = $report & "Highest price = " & $high & @LF $current = IniRead($catfle, $ISBN, "current", "") $report = $report & "Current price = " & $current & @LF $paid = IniRead($catfle, $ISBN, "bought", "") If $paid <> "" Then $report = $report & $paid & @LF $report = $report & "ISBN = " & $ISBN & @LF EndFunc ;=> GetDetailReport Func GetImageData() $startpos = StringInStr($html, '') ; Line 3513 If $startpos > 0 Then $image = StringMid($html, $startpos) $endpos = StringInStr($image, '/table>') If $endpos > 0 Then $image = StringLeft($image, $endpos + 7) $image = StringSplit($image, '
', 1) ; Line 3532 $first = $image[1] If $image[0] > 1 Then $image = $image[2] $endpos = StringInStr($image, '