All pastes #719586 Raw Edit

Miscellany

public text v1 · immutable
#719586 ·published 2007-09-29 12:45 UTC
rendered paste body
dialog away {
  Title "Away"
  option dbu
  size -1 -1 100 90
  icon c:\windows\system\window.ico
  text "Away Prefix", 2000, 3 1 30 6
  edit "", 2001, 34 1 66 10, limit 0, autohs %editprefix
  text "Away Reson", 2002, 3 11 30 6
  edit "", 2003, 34 11 66 10, limit 0, autohs %editreason
  text "On", 2020, 10 19 7 6
  text "Off", 2021, 10 19 8 6
  check "Top", 2022, 1 82 19 6, left
  check "", 2010, 22 19 8 7
  button "Set Away", 2004, 5 28 30 10
  button "Reset", 2005, 40 27 20 10
  button "Set Back", 2006, 65 28 30 10 
  button "OK", 2007, 20 80 30 10, ok, default
  button "Cancel", 2008, 50 80 30 10, cancel
  button "A", 2009, 90 80 10 10, flat
  button "Reset", 2023, 62 68 20 10


  text "Auto Away", 2011, 36 39 30 7
  text "Message", 2012, 3 48 22 7
  edit "", 2013, 26 47 74 10, limit 0, autohs %editautoaway
  text "Time before auto away", 2014, 3 58 57 7
  edit "", 2015, 60 57 25 10, limit 7, autohs %edittime
  check "h", 2016, 85 57 15 6
  check "m", 2017, 85 64 15 6
  check "s", 2018, 85 70 15 6
  check "Auto Away", 2024, 3 67 35 6, left

}

dialog about {
  Title "About Away Script"
  option dbu
  size -1 -1 110 58
  icon c:\windows\system\window.ico
  text "About", 2001, 43 1 15 15
  text "Script made by Rower on Dalnet -05 ", 2002, 1 11 110 7
  text "Please email me for bugs or other horrible things you finds in this script", 2003, 1 19 100 15
  link "Rower@home.se" 2004, 1 50 45 7
  link "www.Rower85.tk" 2005, 67 50 50 7
  text "Regards to everyone in Sweden", 2006, 15 36 100 7
  button "X", 2007, 50 45 10 10, flat, ok
}
;Rower@home.se
on *:dialog:about:sclick:2004: {
  run www.rower85.tk
}
;www.rower85.tk
on *:dialog:about:sclick:2005: {
  run www.rower85.tk
}
;Time Away
alias duration {
  set %duration $calc(%duration + 1)
}

;Set Away
on *:dialog:away:sclick:2004: {
  if (%away == 1) { halt }
  set %prefix $did(away,2001)
  set %awaymess $did(away,2003)
  did -m away 2001
  did -m away 2003
  set %orginalnick $me
  set %away 1
  ame is away: %awaymess
  nick %orginalnick $+ %prefix
  .timer999 0 1 duration
  away %awaymess
  did -cb away 2010
  did -v away 2020
  did -h away 2021
}
;Reset
on *:dialog:away:sclick:2005: {
  if $did {
    did -rn away 2001
    did -rn away 2003
  }
} 
;Set Back
on *:dialog:away:sclick:2006: {
  if $did {
    if (%away != 1) { halt }
    did -n away 2001
    did -n away 2003
    ame is back from, " $+ %awaymess $+ " Duration: $duration(%duration)
    nick %orginalnick
    .timer999 off
    unset %orginalnick
    unset %duration
    unset %away
    unset %awaymess
    away
    did -u away 2010
    did -v away 2021
    did -h away 2020
  }
}
;Reset Auto Away
on *:dialog:away:sclick:2023: {
  if $did {
    did -rn away 2013
    did -rn away 2015
    did -u away 2016
    did -u away 2017
    did -u away 2018
    unset %aatime
  }
} 
;About
on *:dialog:away:sclick:2009: {
  dialog -m about about
}
;Ontop
on *:dialog:away:sclick:2022: {
  if ($did(away,2022).state == 0) { 
    set %ontop n
    dialog -n away
  }
  if ($did(away,2022).state == 1) { 
    set %ontop o
    dialog -o away
  }
}
menu channel {
  -
  Away:{
    dialog -m $+ %ontop away away
    did -b away 2010
    did -a away 2001 %editprefix
    did -a away 2003 %editreason
    did -a away 2013 %editautoaway
    did -a away 2015 %edittime
    %hms
    if (%aaway == 1) {
      did -c away 2024
    }
    if (%ontop == o) { did -c away 2022 }
    if (%ontop == n) { did -u away 2022 }
    if (%away == 1) {
      did -h away 2021
      did -c away 2010
      did -m away 2001
      did -m away 2003
    }
    if (%away != 1) {
      did -h away 2020
    }
  }
}
;Auto Away Box
on *:dialog:away:sclick:2024:{
  if ($did(away,2024).state == 1) { 
    set %autoawaymsg $did(away,2013)
    set %aatime $did(away,2015)
    .timer900 0 1 aaway
    set %aaway 1
  }
  if ($did(away,2024).state == 0) { 
    .timer900 off
    unset %aaway
  }
}
;Auto Away Alias
alias aaway {
  if (%away == 1) { halt }
  set %idle $idle
  if (%idle == %aatime) && ($false == $away) { 
    .away %autoawaymsg
    /ame %autoawaymsg
  }
  if (%idle < %aatime) && ($true == $away) { 
    .away
  }
}
;Timmar
on *:dialog:away:sclick:2016:{
  if ($did(away,2017).state == 1) || ($did(away,2018).state == 1) {
    did -u away 2017
    did -u away 2018
  }
  if ($did(away,2016).state == 0) { 
    unset %hms
    halt 
  }
  set %hms did -c away 2016
  unset %aatime
  set %aatime $did(away,2015)
  set %aatime $calc(%aatime * 3600)
  msg #kajsdgh %aatime
}
;Minuter
on *:dialog:away:sclick:2017:{
  if ($did(away,2016).state == 1) || ($did(away,2018).state == 1) {
    did -u away 2016
    did -u away 2018 
  }
  if ($did(away,2017).state == 0) { 
    unset %hms
    halt 
  }
  set %hms did -c away 2017
  unset %aatime
  set %aatime $did(away,2015)
  set %aatime $calc(%aatime * 60)
  msg #kajsdgh %aatime
}
;Sekunder
on *:dialog:away:sclick:2018:{
  if ($did(away,2016).state == 1) || ($did(away,2017).state == 1) {
    did -u away 2016
    did -u away 2017
  }
  if ($did(away,2018).state == 0) { 
    unset %hms
    halt 
  }
  set %hms did -c away 2018
  unset %aatime
  set %aatime $did(away,2015)
  set %aatime $calc(%aatime * 1)
  msg #kajsdgh %aatime
}
;Auto Away
Alias Idle {
  if (%away == 1) { halt }
  set %idle $idle
  if (%idle == %time) && ($false == $away) { 
    .away %autoawaymsg
    .ame %autoawaymsg
  }
  if (%idle < %time) && ($true == $away) { 
    .away
  }
}