Page 1 of 1 1
Topic Options
#71079 - 2002-10-24 01:41 AM script to display a message once a day
cigaweed74 Offline
Fresh Scripter

Registered: 2002-04-08
Posts: 20
Hi,

I need some ideas on how to write a script that only displays the message box if it is the user's first loggon on the day, until the next day...

thanks...

Top
#71080 - 2002-10-24 02:23 AM Re: script to display a message once a day
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
use a check file on users home share.
logon.ini or log or txt.

reading from there shouldn't be a problem and when used as ini, all you need to have there is the logon day.
if the file does not exist, assume not ever logged in.
_________________________
!

download KiXnet

Top
#71081 - 2002-10-24 02:47 AM Re: script to display a message once a day
cigaweed74 Offline
Fresh Scripter

Registered: 2002-04-08
Posts: 20
Lonkero,

Can you please post a sample script for me....

thanks,

Top
#71082 - 2002-10-24 02:53 AM Re: script to display a message once a day
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, let's pull something from head:
code:
$time=readprofilestring(@homedir+"\logon.log","Logon Info","LastLogon")
if @date<>$time
;first logon today
$nul=writeprofilestring(@homedir+"\logon.log","Logon Info","LastLogon",@date)
;do here what you want to do.
endif

_________________________
!

download KiXnet

Top
#71083 - 2002-10-24 03:43 AM Re: script to display a message once a day
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Or use the registry:
code:
$key='HKEY_CURRENT_USER\SOFTWARE\KiXtart'
if readvalue($key,'QOTD')<>@DATE
$rc=writevalue($key,'QOTD',@DATE,'REG_SZ')
; display quote of the day
endif



[ 24. October 2002, 03:44: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#71084 - 2002-10-24 03:58 AM Re: script to display a message once a day
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, updated thoughts...

you should every time clear the file before writing.
del it and so on.
as user can be so wise that they put the read only flag on.

then, what jens suggested, thought myself too but it requires that user logs on same machine every time.
that's why I skipped it as option.
_________________________
!

download KiXnet

Top
#71085 - 2002-10-24 04:07 AM Re: script to display a message once a day
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
...or readline() a 'syslogon.log' for the @userid @date etc...{Edit}Lonkero...This assumes (I know, never assume)that domain logons are recorded in a file (eg syslogon.log) which could be read to determine a user's logon activity...{/Edit}

[ 24. October 2002, 15:36: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#71086 - 2002-10-24 04:32 AM Re: script to display a message once a day
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
syslogon.log?
_________________________
!

download KiXnet

Top
#71087 - 2002-10-24 04:39 AM Re: script to display a message once a day
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
To me, @YDayNo would seem to be the easiest to piece of info to build this one message a day code around. I would use the registry to store the @YDayNo of the last message viewed. The key\value HKCU\software\Local\messagenumber for NT and higher and use HKLM on Win9x computer.

Basically, if the value store in the registry is less than the current @YDayNo then show the message and then update the registry.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#71088 - 2002-10-24 04:43 AM Re: script to display a message once a day
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hoby, assuming again that user uses only one wksta?

ydayno is goodie ok, just like is date.
there is no need to check if day is lower or creater, as probably the user hasn't logged on in the future, so simple string comparison (if different) will do...

I quess.
_________________________
!

download KiXnet

Top
#71089 - 2002-10-24 03:26 PM Re: script to display a message once a day
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Lonkero: If the user has roaming profiles, then the registry key will stick with the user and the user will only get the message once a day. Exemption: User logs into multiple machines before logging off other machines.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.084 seconds in which 0.049 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org