Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Online / Offline Status ermitteln
#1
Dieses kleine Script zeigt wie man mit Hilfe der Ermittlung der IP feststellen kann, ob man online oder offline ist. Dieses Vorgehen ist besonders für User mit DialUp Connections interessant.

This script shows how to determine the online / offline state by retrieving the current ip from the internet. It should be of interest when a user has a dialup connection.

CODE
#Header
  %DefVar(IP='')
 
  /set default value of timestamp to current time decremented by one year to ensure ip retrieval /
  /also starts when script starts/
  %DefVar(TimeStamp=%Dec(%System.GetDateTime('yyyy'),1)%System.GetDateTime('-mm-dd hh:nnConfuseds:zzz'))
 
  %DefVar(DaysPassed=0)
  %DefVar(MinutesPassed=0)
 
  %Common.SetPriority(1000)
 
  %Graph.SetTextArea(0,0,%Common.Config(LCDWidth),%Common.Config(LCDHeight))
#EndHeader

#TextMode
  /insert textmode script code here/
#EndTextMode

#GfxMode
/determine the number of days between last ip retrieval time and current time/
  %Assign(DaysPassed,%System.DateDiff(%TimeStamp(),%System.GetDateTime('yyyy-mm-dd hh:nnConfuseds:zzz'),'MinutesPassed'))
 
  /calculate fractional days measured in milliseconds to minutes/
  %Assign(MinutesPassed,%Div(%Div(%MinutesPassed(),1000),60))
 
  /when at least one day has passed or 5 minutes have passed/
  %If((%DaysPassed() ! 0) OR (%MinutesPassed() >= 5)) Then
  {
     /retrieve ip/
     %Assign(IP,%System.ReadFile('http://lcdhype.de.vu/stuff/php/getip/getip.php',0))
     
     /store time of ip retrieval/
     %Assign(TimeStamp,%System.GetDateTime('yyyy-mm-dd hh:nnConfuseds:zzz'))
  }
 
  /online status output/
  %If(%IP() ! '') Then
  {
     %IP()
  }
  Else
  {
     'Offline'
  }
#EndGfxMode
Current stable version of LCDHype: 0.7.6
New plugin: Notepad++ Bookmark Manager
New music: Nordwise - Empire transition


Forum Jump:


Users browsing this thread: 1 Guest(s)