All pastes #583663 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-22 13:51 UTC
rendered paste body
; Posten Pakkesøk v1.0
; (C) 2001 Kai Hugo Hustoft Endresen. All Rights Reserved.

alias pakkesok {
  //echo -a starter pakkesøk... $1
  /set %pakkesok $1
  /sockopen -n pakkesok 139.117.8.127 80
}
on 1:sockopen:pakkesok: {
  if ($sockerr > 0) {
    /echo -a ERROR: Connection could not be established.
    return
  }
  /sockwrite -n pakkesok GET /Nettgods/Internett/nettspor_res.asp?sendingsnummer= $+ %pakkesok
}
on 1:sockread:pakkesok: {
  if ($sockerr > 0) {
    /echo -a ERROR: Could Not Read from Host    
    return
  }
  var %tmp
  sockread %tmp
  if ($sockbr == 0) return
  if (!%tmp) %tmp = -
  if ( $left(<td nowrap=true,15) == $left(%tmp,15) ) { /pakketing %tmp }
  if ( %script_debug == yes ) { //echo -t @script_debug PAKKESOK: %tmp }
}
on 1:sockclose:pakkesok: {
  /echo -a stoppet.
}
alias pakketing {
  /pakket $remove($9-,size=1>,</font></td>)
}
alias pakket {
  if ( $remove($1,.) isnum && $len($remove($1,.)) == 6 ) { /set %pakkesok.DATO $1- }
  if ( $remove($1,.) isnum && $len($1) == 5 ) { /set %pakkesok.TID $1- }  
  if ( $1 isalpha ) { /set %pakkesok.STATUS $1- } 
  if ( $1 isnum && $2 != $null ) { //echo -a 4DATO: %pakkesok.DATO 4TID: %pakkesok.TID 4POSTSTED: $1- 4STATUS: %pakkesok.STATUS | unset %pakkesok.* }
  ;  //echo -a DEBUG_OUTPUT: $1-
}

; Alarm on Arrival Posten Pakkesøk v1.0
; (C) 2001 Kai Hugo Hustoft Endresen. All Rights Reserved.
alias pakkealarm {
  //echo -a sjekker posten nettsøk en gang per 5 minutt...
  /timerpakke 0 300 /pakkealarm_1 $1
}

alias pakkealarm_1 {
  ;//echo -a starter pakkealarm... $1
  /set %pakkesok $1
  /sockopen -n pakkealarm 139.117.8.127 80
}
on 1:sockopen:pakkealarm: {
  if ($sockerr > 0) {
    /echo -a ERROR: Connection could not be established.
    return
  }
  /sockwrite -n pakkealarm GET /Nettgods/Internett/nettspor_res.asp?sendingsnummer= $+ %pakkesok
}
on 1:sockread:pakkealarm: {
  if ($sockerr > 0) {
    /echo -a ERROR: Could Not Read from Host    
    return
  }
  var %tmp
  sockread %tmp
  if ($sockbr == 0) return
  if (!%tmp) %tmp = -
  if ( $left(<td nowrap=true,15) == $left(%tmp,15) ) { /pakkealarmting %tmp }
  if ( %script_debug == yes ) { //echo -t @script_debug PAKKEALARM: %tmp }
}
on 1:sockclose:pakkealarm: {
  ;/echo -a stoppet.
}
alias pakkealarmting {
  /pakketalarm $remove($9-,size=1>,</font></td>)
}
alias pakketalarm {
  if ( $1 == ANKOMSTREGISTRERT ) { 
    //echo -a PAKKE ER PÅ POSTKONTORET!
    /splay <insert MP3 file here>
    /timerpakke off
  } 
}