menu menubar { Price Lookup:/dialog -md price price } dialog price { title "Price Lookup" size -1 -1 181 109 option dbu edit "", 1, 3 3 106 10 button "Lookup", 2, 8 15 26 12 button "Clear", 3, 35 15 26 12 list 4, 0 39 181 70, size hsbar vsbar multsel text "Price Lookup by Xxhaloxx4", 5, 3 30 177 8 button "C Lines", 6, 62 15 26 12 button "Save", 7, 92 15 26 12 button "View", 8, 119 15 26 12 button "^", 9, 150 15 9 12 button "v", 10, 160 15 9 12 menu "File", 32 item "On Top", 33, 32 item break, 34, 32 item "Exit", 35, 32 menu "Clear", 11 item "Clear All", 12, 11 item "Clear Selected", 13, 11 menu "Save", 14 item "Save All", 15, 14 item "Save Selected", 16, 14 item break, 17, 14 item "View Saves", 18, 14 menu "Options", 19 menu "Result Display", 20, 19 item "Edit", 21, 20 item "Use Default", 22, 20 item "Compare Prices", 28, 19 menu "Other", 23 item "Lookup", 24, 23 item break, 25, 23 item "Move Up", 26, 23 item "Move Down", 27, 23 item break, 40, 23 menu "Add Separator", 37, 23 item "Line Above", 38, 37 item "Line Below", 39, 37 menu "About", 31 item "View About", 36, 31 } on *:DIALOG:price:init:*:{ did -t price 2 if ($readini(price.ini,-n,S,D)) { did -c price 22 } } on *:DIALOG:price:sclick,menu:2,24:{ if ($sock(price.*)) { if ($input(The price socket is already connected $+ $crlf $+ Number of connections: $sock(price.*,0) $+ $crlf $+ $crlf $+ Close the socket and continue search?,yw,Error)) { sockclose price.* goto end } halt } :end if ($did(1)) { var %x = 1 while ($gettok($did(1),%x,44)) { sockopen $+(price.,%x) www.zybez.net 80 inc %x } did -ra price 5 Looking up $qt($did(1)) $+([,$gettok($did(1),0,44) item $+ $iif($gettok($did(1),0,44) > 1,s),]) } else { did -ra price 5 No item supplied } } on *:DIALOG:price:sclick:3:{ if ($did(4).lines) { did -r price 4 did -z price 4 did -ra price 5 Cleared all results } else { did -ra price 5 No results to clear } } on *:DIALOG:price:sclick:6:{ if ($did(4).sel) { did -ra price 5 Cleared $did(4,0).sel line $+ $iif($did(4,0).sel > 1,s) while ($did(4).sel) { did -d price 4 $ifmatch } } else { did -ra price 5 No line(s) are selected } } on *:DIALOG:price:sclick,menu:7,15,16:{ if ($did(4).seltext) && ($did == 7 || $did == 16) { var %x = 1 while (%x <= $did(4,0).sel) { write Price.txt $did(4,$did(4,%x).sel) inc %x } did -ra price 5 Saved $did(4,0).sel line $+ $iif($did(4,0).sel > 1,s) } elseif ($did(4).lines) && ($did == 7 || $did == 15) { var %x = 1 while (%x <= $did(4).lines) { write Price.txt $did(4,%x) inc %x } did -ra price 5 Saved all lines $+([,$did(4).lines,]) } else { did -ra price 5 Nothing to save } } on *:DIALOG:price:sclick,menu:8,18:{ if ($exists(price.txt)) { dialog -md ps ps } elseif ($input(You currently do not have any saved prices $+ $crlf $+ $crlf $+ To save an item: $+ $crlf $+ $crlf • Press the 'Save' button on the main dialog $+ $crlf • If you have line(s) selected $+ $chr(44) it will only save those line(s) that are selected $+ $crlf • If you do not have any lines selected $+ $chr(44) all lines will be added into the save file $+ $crlf $+ $crlf $+ Open the save dialog?,yw,No saves found)) { dialog -md ps ps } } on *:DIALOG:price:sclick,menu:9,26:{ if ($did(4).sel) { if ($did(4).sel == 1) { did -ra price 5 Cannot move line up } else { var %t = $did(4).seltext, %n = $did(4).sel did -d price 4 %n did -i price 4 $calc(%n -1) %t did -c price 4 $calc(%n -1) did -ra price 5 Moved line %n up } } else { did -ra price 5 No line selected to move up } } on *:DIALOG:price:sclick,menu:10,27:{ if ($did(4).sel) { if ($did(4).sel == $did(4).lines) { did -ra price 5 Cannot move line down } else { var %t = $did(4).seltext, %n = $did(4).sel did -d price 4 %n did -i price 4 $calc(%n +1) %t did -c price 4 $calc(%n +1) did -ra price 5 Moved line %n down } } else { did -ra price 5 No line selected to move down } } on *:DIALOG:price:menu:12:{ if ($did(4).lines) { did -r price 4 did -ra price 5 Cleared all results } else { did -ra price 5 No results to clear } } on *:DIALOG:price:menu:13:{ if ($did(4).sel) { did -ra price 5 Cleared $did(4,0).sel line $+ $iif($did(4,0).sel > 1,s) while ($did(4).sel) { did -d price 4 $ifmatch } } else { did -ra price 5 No line(s) are selected } } on *:DIALOG:price:menu:21:{ dialog -md pr pr } on *:DIALOG:price:menu:22:{ if ($did(22).state) { did -u price 22 writeini -n price.ini S D 0 } else { did -c price 22 writeini -n price.ini S D 1 } } on *:DIALOG:price:menu:28:{ dialog -md pc pc } on *:DIALOG:price:menu:33:{ if ($did(33).state) { did -u price 33 dialog -n price } else { did -c price 33 dialog -o price } } on *:DIALOG:price:menu:35:{ dialog -x price } on *:DIALOG:price:menu:36:{ noop $input(Price Lookup dialog made by Xxhaloxx4 for public release. $+ $crlf $+ $crlf $+ All prices taken from Zybez.net $+ $crlf $+ $crlf $+ Future updates include: but not limited to: $+ $crlf • Ability to select your own socket connections $+ $crlf • Fix any bugs that come to my attention,ow,About) } on *:DIALOG:price:menu:38:{ if ($did(4).sel) { did -ra price 5 Added separator above line $did(4).sel did -i price 4 $did(4).sel $chr(32) } else { did -ra price 5 No line selected } } on *:DIALOG:price:menu:39:{ if ($did(4).sel) { var %n = $calc($did(4).sel +1) did -ra price 5 Added separator below line $did(4).sel did -i price 4 $iif(%n == $calc($did(4).lines +1),$did(4).lines,%n) $chr(32) } else { did -ra price 5 No line selected } } on *:SOCKOPEN:price.*:{ sockwrite -n $sockname GET /priceguide.php?search_terms= $+ $replace($gettok($did(price,1),$gettok($sockname,2,46),44),$chr(32),+) $+ &search_area=1&price_low=0&price_high=0&member=1&all_prices=1&sortby=name&sort=ASC&ppage=200 HTTP/1.1 sockwrite -n $sockname Host: www.zybez.net sockwrite -n $sockname $+($crlf,$crlf) } on *:SOCKREAD:price.*:{ if ($sockerr) { did -a price 5 Socket Error $qt($sockerr) } else { var %read, %id = $gettok($sockname,2,46) sockread %read if (*Viewing * of * Results* iswm %read) { set $+(%,pr.,%id) $gettok($nohtml(%read),2,32) } if (** iswm %read) { set $+(%,p.n.,%id) $nohtml(%read) } if ($regex(%read,/This price has/Si)) { set $+(%,p.c.,%id) $remove($regml(2),[,]) }
    if (*<td class=** iswm %read) { set $+(%,p.ct.,%id) $nohtml(%read) } if (** iswm %read) { if ($readini(price.ini,-n,S,D) || !$readini(price.ini,-n,S,M)) { did -a price 4 $($+(%,p.n.,%id),2) $+ : $nohtml(%read) $iif($($+(%,p.c.,%id),2),$+([,$ifmatch,])) } else { did -a price 4 $replace($readini(price.ini,-n,S,M),*item*,$($+(%,p.n.,%id),2),*price*,$nohtml(%read),*cat*,$iif($($+(%,p.ct.,%id),2),$ifmatch,None),*change*,$iif($($+(%,p.c.,%id),2),$ifmatch,None)) } unset %p.* did -z price 4 } if (** iswm %read) { did -ra price 5 $($+(%,pr.,%id),2) result $+ $iif($($+(%,pr.,%id),2) > 1,s) found $+([,$did(price,4).lines total,]) unset %p.* %pr.* } } } alias -l nohtml { return $remove($regsubex($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null), ,$chr(09)) } dialog ps { title "Saved Prices" size -1 -1 215 109 option dbu list 1, 0 0 215 93, size hsbar vsbar button "Empty", 2, 17 95 26 12 button "C Line", 3, 44 95 26 12 button "Refesh", 4, 74 95 26 12 button "^", 5, 140 95 9 12 button "v", 6, 150 95 9 12 button "Add Sep", 7, 104 95 26 12 } on *:DIALOG:ps:init:*:{ if ($exists(price.txt)) { var %x = 1 while (%x <= $lines(price.txt)) { if (!$read(price.txt,%x)) { did -a ps 1 $chr(32) } else { did -a ps 1 $read(price.txt,%x) } inc %x } did -z ps 1 } } on *:DIALOG:ps:sclick:2:{ if ($input(Are you sure you wish to empty the save file?,yi,Confirm Erase)) { .remove price.txt did -r ps 1 did -z ps 1 noop $input(Saved file was cleared of all data,oi,Erased) } } on *:DIALOG:ps:sclick:3:{ if ($did(1).sel) { while ($did(1).sel) { write -dl $+ $did(1).sel Price.txt did -d ps 1 $did(1).sel } } else { noop $input(Select line(s) to clear from the file,ow,Error) } } on *:DIALOG:ps:sclick:4:{ if ($exists(price.txt)) { did -r ps 1 var %x = 1 while (%x <= $lines(price.txt)) { if (!$read(price.txt,%x)) { did -a ps 1 $chr(32) } else { did -a ps 1 $read(price.txt,%x) } inc %x } did -z ps 1 } else { did -r ps 1 noop $input(The save file was not found,ow,Error) } } on *:DIALOG:ps:sclick:5:{ if ($did(1).sel) { if ($did(1).sel == 1) { noop $input(Cannot move line up $+ $chr(44) it is already the top line,ow,Error) } else { var %n = $did(1).sel, %t = $did(1).seltext write -dl $+ %n Price.txt write -il $+ $calc(%n -1) Price.txt %t did -d ps 1 %n did -i ps 1 $calc(%n -1) %t did -c ps 1 $calc(%n -1) } } else { noop $input(Select a line to move up in the list,ow,Error) } } on *:DIALOG:ps:sclick:6:{ if ($did(1).sel) { if ($did(1).sel == $did(1).lines) { noop $input(Cannot move line down $+ $chr(44) it is already the bottom line,ow,Error) } else { var %n = $did(1).sel, %t = $did(1).seltext write -dl $+ %n Price.txt write -il $+ $calc(%n +1) Price.txt %t did -d ps 1 %n did -i ps 1 $calc(%n +1) %t did -c ps 1 $calc(%n +1) } } else { noop $input(Select a line to move down in the list,ow,Error) } } on *:DIALOG:ps:sclick:7:{ if ($did(1).sel) { did -i ps 1 $did(1).sel $chr(32) write -il $+ $calc($did(1).sel -1) price.txt $chr(32) } else { noop $input(Select a line to add a seperator above it,ow,Error) } } dialog pc { title "Compare Prices" size -1 -1 208 142 option dbu edit "", 1, 3 3 50 10, autohs button "Lookup", 2, 55 2 26 12 edit "", 3, 107 3 50 10 button "Lookup", 4, 159 2 26 12 list 5, 0 16 100 54, size hsbar vsbar list 6, 104 16 100 54, size hsbar vsbar text "Item:", 17, 2 72 13 8 text "", 18, 17 72 82 8 text "Price:", 19, 2 82 13 8 text "", 20, 17 82 85 8 text "Category:", 21, 2 92 24 8 text "", 22, 28 92 74 8 text "Change:", 23, 2 102 21 8 text "", 24, 25 102 76 8 text "", 25, 121 82 85 8 text "Price:", 26, 106 82 13 8 text "Item:", 27, 106 72 13 8 text "", 28, 121 72 82 8 text "", 29, 132 92 74 8 text "Category:", 30, 106 92 24 8 text "Change:", 31, 106 102 21 8 text "", 32, 129 102 76 8 text "Difference in price:", 33, 41 121 46 8 text "", 34, 89 121 85 8 text "Difference in change:", 35, 35 131 52 8 text "", 36, 89 131 85 8 text "--------------------------------------------------------------------------------------------------------", 37, 0 112 209 8 button "C", 41, 84 2 9 12 button "C", 42, 188 2 9 12 menu "File", 7 item "On Top", 8, 7 item break, 9, 7 item "Exit", 10, 7 menu "Search", 11 item "Lookup 1", 12, 11 item "Lookup 2", 15, 11 item "Clear", 13, 11 } on *:DIALOG:pc:close:*:{ .remove Temp } on *:DIALOG:pc:sclick:5:{ if ($did(5).sel) { if ($read(temp,s,$did(5).seltext)) { tokenize 124 $ifmatch did -a pc 18 $did(5).seltext did -a pc 20 $1 did -a pc 22 $2 did -a pc 24 $3 if ($did(18) && $did(28)) { var %p11 = $remove($gettok($did(20),1,45),$chr(44),gp), %p12 = $remove($gettok($did(20),2,45),$chr(44),gp) var %p21 = $remove($gettok($did(25),1,45),$chr(44),gp), %p22 = $remove($gettok($did(25),2,45),$chr(44),gp) if (%p12 && %p22) { if (%p12 > %p22) { did -ra pc 34 < $bytes($remove($calc(%p11 - %p21),-),db) - $bytes($remove($calc(%p12 - %p22),-),db) $+ gp } else { did -ra pc 34 > $bytes($remove($calc(%p21 - %p11),-),db) - $bytes($remove($calc(%p22 - %p12),-),db) $+ gp } } else { if (%p11 > %p12) { did -ra pc 34 < $bytes($remove($calc(%p11 - %p21),-),db) $+ gp } else { did -ra pc 34 > $bytes($remove($calc(%p11 - %p21),-),db) $+ gp } } var %c1 = $remove($replace($did(24),decreased by,-,none,0),increased by,$chr(32),$chr(44),gp), %c2 = $remove($replace($did(32),decreased by,-,none,0),increased by,$chr(32),$chr(44),gp) if (%c1 > %c2) { did -ra pc 36 $bytes($calc(%c1 - %c2),db) $+ gp } else { did -ra pc 36 $bytes($calc(%c2 - %c1),db) $+ gp } } } } } on *:DIALOG:pc:sclick:6:{ if ($did(6).sel) { if ($read(temp,s,$did(6).seltext)) { tokenize 124 $ifmatch did -a pc 28 $did(6).seltext did -a pc 25 $1 did -a pc 29 $2 did -a pc 32 $3 if ($did(18) && $did(28)) { var %p11 = $remove($gettok($did(20),1,45),$chr(44),gp), %p12 = $remove($gettok($did(20),2,45),$chr(44),gp) var %p21 = $remove($gettok($did(25),1,45),$chr(44),gp), %p22 = $remove($gettok($did(25),2,45),$chr(44),gp) if (%p12 && %p22) { if (%p12 > %p22) { did -ra pc 34 < $bytes($calc(%p11 - %p21),db) - $bytes($calc(%p12 - %p22),db) $+ gp } else { did -ra pc 34 > $bytes($calc(%p21 - %p11),db) - $bytes($calc(%p22 - %p12),db) $+ gp } } else { if (%p11 > %p12) { did -ra pc 34 < $bytes($calc(%p11 - %p21),db) $+ gp } else { did -ra pc 34 > $bytes($calc(%p11 - %p21),db) $+ gp } } var %c1 = $remove($replace($did(24),decreased by,-,none,0),increased by,$chr(32),$chr(44),gp), %c2 = $remove($replace($did(32),decreased by,-,none,0),increased by,$chr(32),$chr(44),gp) if (%c1 > %c2) { did -ra pc 36 $bytes($calc(%c1 - %c2),db) $+ gp } else { did -ra pc 36 $bytes($calc(%c2 - %c1),db) $+ gp } } } } } on *:DIALOG:pc:menu:8:{ if ($did(8).state) { did -u pc 8 dialog -n pc } else { did -c pc 8 dialog -o pc } } on *:DIALOG:pc:menu:10:{ .remove Temp dialog -x pc } on *:DIALOG:pc:sclick,menu:2,12:{ if ($did(1)) { if ($sock(price2)) { if ($input(The Compare Price socket is already connected $+ $crlf $+ $crlf $+ Close socket and continue search?,yw,Connection already open)) { sockclose price2 goto end } halt } :end set %pc.num 5 sockopen price2 www.zybez.net 80 } else { noop $input(Supply an item to lookup,ow,Error) } } on *:DIALOG:pc:sclick,menu:4,15:{ if ($did(3)) { if ($sock(price2)) { if ($input(The Compare Price socket is already connected $+ $crlf $+ $crlf $+ Close socket and continue search?,yw,Connection already open)) { sockclose price2 goto end } halt } :end set %pc.num 6 sockopen price2 www.zybez.net 80 } else { noop $input(Supply an item to lookup,ow,Error) } } on *:DIALOG:pc:sclick,menu:13,41,42:{ did -r pc 5,6,18,20,22,24,25,28,29,32,34,36 .remove temp } on *:SOCKOPEN:price2:{ sockwrite -n $sockname GET /priceguide.php?search_terms= $+ $replace($did(pc,$iif(%pc.num == 5,1,3)),$chr(32),+) $+ &search_area=1&price_low=0&price_high=0&member=1&all_prices=1&sortby=name&sort=ASC&ppage=200 HTTP/1.1 sockwrite -n $sockname Host: www.zybez.net sockwrite -n $sockname $+($crlf,$crlf) } on *:SOCKREAD:price2:{ if ($sockerr) { return } else { var %read sockread %read if (** iswm %read) { set %p.n $nohtml(%read) } if ($regex(%read,/This price has/Si)) { set %p.f $remove($regml(2),[,]) }
    if (*<td class=** iswm %read) { set %p.c $nohtml(%read) } if (** iswm %read) { write Temp %p.n $chr(124) $nohtml(%read) $chr(124) $iif(%p.c,$ifmatch,None) $chr(124) $iif(%p.f,$ifmatch,None)) did -a pc %pc.num %p.n unset %p.* did -z pc %pc.num } if (** iswm %read) { unset %p.* %pc.* } } } dialog pr { title "Results Display" size -1 -1 112 50 option dbu check "Enable", 1, 3 3 25 10 button "Help", 2, 68 36 17 12 text "Display:", 3, 5 15 19 8 edit "", 4, 2 23 108 10, autohs button "Ok", 5, 8 36 24 12, ok button "Cancel", 6, 36 36 24 12, cancel } on *:DIALOG:pr:init:*:{ if (!$readini(price.ini,-n,S,D)) { did -c pr 1 } if ($readini(price.ini,-n,S,M)) { did -ra pr 4 $ifmatch } } on *:DIALOG:pr:sclick:2:{ dialog -ma prh prh } on *:DIALOG:pr:sclick:5:{ writeini -n price.ini S D $iif($did(1).state,0,1) if ($did(1).state) { did -u price 22 } if ($did(4)) { writeini -n price.ini S M $strip($did(4)) } else { noop $input(No text was entered for the custom display $+ $crlf $+ $crlf $+ Saving of result display cancelled,ow,Error) } } dialog prh { title "RD Help" size -1 -1 153 65 option dbu text "Result Replacers:", 1, 2 2 42 8 text "*item* = item name", 2, 2 14 48 8 text "*price* = price of item", 3, 2 24 54 8 text "*cat* = category", 4, 2 34 42 8 text "*change* = change of price", 5, 2 44 68 8 text "| | | | | | | | | |", 6, 72 1 2 62 text "Color is not allowed and will be stripped when it is saved", 7, 77 3 73 13 text "Result Replacers can be touching items other than itself", 8, 77 19 73 20 text "When a category/change does not exist, the returning text will be 'None'", 9, 77 42 73 20 }