YellowPages National Business Search — File Browser

YellowPagesNationalBusinessSearchv1.0 / YellowPagesNationalBusinessSearchv1.0 / yellowpages.mrc

yellowpages.mrc — 5.22 KB — Download this file

on *:load:if $version < 6 { echo -a Upgrade mirc to 6+, Unloading... | unload -rs $script } | else echo -a Run -YellowPages Search- with /yp or from any menu.
on *:unload:yp_clr
menu * {
  -
  -YellowPages Search-:yp
  -
}
dialog yp {
  title "[- YellowPages National Business Search -]"
  size -1 -1 214 107
  option dbu
  box "", 1, 0 -2 214 109
  icon 2, 9 6 62 20,  $scriptdiryp.jpg, 0, noborder
  text "Business Name:", 3, 3 29 38 8, center
  edit "", 4, 6 38 73 10, autohs
  box "", 5, 81 0 131 105
  text "City:", 7, 3 50 15 8
  edit "", 6, 6 59 73 10
  text "State:", 16, 3 71 18 8
  text "", 11, 84 95 93 8, center
  link "www.yellowpages.com", 12, 2 95 56 8
  combo 8, 7 81 40 75, size drop
  edit "", 9, 51 81 27 10
  button "&Start", 10, 59 94 21 9, default
  button "New Search", 14, 177 95 33 8
  edit "", 13, 83 5 127 89, read multi return vsbar
  text "ZipCode (optional):", 15, 34 71 46 8
}
alias yp { dialog $iif($dialog(yp),-v,-m) yp yp }
alias yp_clr { if $dialog(yp) { did -r yp 6,13,4,8,9 | yp_d | did -o yp 8 $chr(160) | did -ra yp 11 Ready... | did -f yp 4 } | unset %yp* | if $sock(yp) { .sockclose yp } }
alias yp_d { didtok yp 8 32 AL AK AS AZ AR CA CO CT DE FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WI WY }
alias yp_s { if $sock(yp) { .sockclose yp } | unset %yp_f | did -ra yp 11 $+([,%yp_r,]) Results Found. | unset %yp_r | did -c yp 13 1 }
on *:dialog:yp:*:*: {
  if $devent == init {
    yp_d
    did -ra yp 11 Ready...
    did -a yp 13 $str($chr(160),19) -YellowPages Search- $+ $crlf | did -a yp 13 $str($chr(160),19) $str(-,25) $+ $crlf
    did -f yp 4
  }
  if $devent == edit {
    if $did == 9 {
      if $did(9) !isnum { did -r yp 9 }
    }
  }
  if $devent == sclick { 
    if $did == 8 { set %yp_state $did(8) }
    if $did == 14 { yp_clr }
    if $did == 10 { 
      did -r yp 13
      if $did(4) { set %yp_name $ifmatch } | elseif !$did(4) { did -ra yp 11 Must enter a name. }
      if $did(6) { set %yp_city $ifmatch } | elseif !$did(6) { did -ra yp 11 Must enter a city. }
      if $did(9) { 
        set %yp_zip $ifmatch 
        set %yp_zs zip
      }
      elseif !$did(9) { unset %yp_zip | set %yp_zs reg } 
      if !%yp_state { did -ra yp 11 Must specify a state. | halt }
      elseif %yp_state && %yp_name && %yp_city {
        if !$sock(yp) { .sockopen yp yellowpages.com 80 } | else { .sockclose yp | .sockopen yp yellowpages.com 80 }
      }
    }
  }
  if $devent == dclick { if $did == 12 { run www.yellowpages.com } }
  if $devent == close { if $sock(yp) { .sockclose yp } | unset %yp* }
}
on *:sockopen:yp: {
  if !sockerr {
    did -a yp 11 -Connected- Searching...
    if $sock(yp) { .timeryp 1 1 sockwrite -n yp GET $+(/SearchResult.aspx?page=,$iif(%yp_zs == zip,adv,home),&searchform=,$iif(%yp_zs == zip,zipsearch,homesearch),&typeorname=name&search=,$replace(%yp_name,$chr(32),$chr(43)),&searchfor=,$replace(%yp_name,$chr(32),$chr(43)),&method=and&,$iif(%yp_zs == zip,zipcode,city),=,$iif(%yp_zs == zip,%yp_zip,$+($replace(%yp_city,$chr(32),$chr(43)),&state=,%yp_state))) HTTP/1.0 }
    if $sock(yp) { .timeryp2 1 1 sockwrite -n yp Host: yellowpages.com $+ $crlf $+ $crlf }
  }
  else did -ra yp 11 -Error- Conecting. 
}
on *:sockread:yp: {
  var %:
  :nyp
  sockread %:
  if $sockbr == 0 { did -f yp 13 | did -f yp 4 | return }
  ;echo -s $$hf(%:)
  if $dialog(yp) {
    if $len(%:) >= 940 { goto nyp }
    var %yp_hf $$hf(%:)
    if (could not be found in the State isin %yp_hf) { .sockclose yp | did -ra yp 13 The City $+(',%yp_city,') could not be found in the State $+(',%yp_state,',.) Check the city spelling. Use standardized names for cities. ie: New York instead of Mahattan, Las Vegas instead of Vegas | unset %yp_f | did -ra yp 11 $+([,0,]) Results Found. | unset %yp_r | halt }
    if (SCROLL DOWN for more listings isin %yp_hf) { goto nyp }
    if (COURTESY DIRECTORY LISTINGS isin %yp_hf) {
      did -a yp 13 -YellowPages Results- $+ $crlf | did -a yp 13 $str(-,18) $+ $crlf
      set %yp_f on
      goto nyp
    }
    if %yp_f == on {
      if %yp_hf {
        if (*ABC* iswm %yp_hf) { yp_s | halt }
        if (*Category* iswm %yp_hf) { yp_s | halt }
        var %h $replace($remove(%yp_hf,-->,Map,Next &gt;),Miles,Miles Away)
        did -a yp 13 %h $+ $crlf
        if (*Phone* iswm %yp_hf) { inc %yp_r | did -ra yp 11 $iif(%yp_r,$+([,%yp_r,]),$+([,0,])) Results Found. | did -a yp 13 $str(-,18) }
      }
    }
    if (We could not find the isin %yp_hf) { set %yp_ph 1 }
    if (Business Name isin %yp_hf) { if (%yp_ph == 1) { unset %yp_ph | .sockclose yp | did -ra yp 13 $+(',%yp_name,') could not be found in $+(',%yp_zip,',.) | did -ra yp 11 $+([,0,]) Results Found. | halt } }
    if (We're struggling to find the Business Name isin %yp_hf) { .sockclose yp | did -ra yp 13 $+(',%yp_name,') $+ $crlf could not be found in $+ $crlf $+(',%yp_city,$chr(44),%yp_state,',.) $+ $crlf $+ $crlf Try redefining your search. | did -ra yp 11 $+([,0,]) Results Found. | halt }
  }
  goto nyp
}
; Jagfire's $htmlfree
alias hf { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,$chr(9),$chr(10),$chr(13),$chr(160),$cr,$null,$lf,$crlf)
  return %x
}