Page 1 of 1 1
Topic Options
#204013 - 2012-01-06 01:23 PM Wallpaper daily counter down
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi folks, and happy new year.

I wonder if any of you out there could give me some pointers, the Head at the School where I work has asked if we could have a count down message appear on pupil desktops to tell them the number of days to go before a certain date (the Exams). I have used BGinfo in the past to display messages to users, is there a way we can do this with KIX/BGinfo?

Regards,
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#204015 - 2012-01-06 02:57 PM Re: Wallpaper daily counter down [Re: Stephen Wintle]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
It's been like forever and a day since the last time I used BGInfo, so I had to look up its options ( http://technet.microsoft.com/en-us/sysinternals/bb897557 )It seems like to me you would just need to add a custom field that was would be used for a kix calulation. Assuming that the import file is text, open the file in kix, add the custom field with the calculated date, and save the changes. Then you would rerun the bginfo either by task scheduler or admin script to re-import the settings file.

I use serialdate for this type of thing... something like

$daystoevent=serialdate($eventdate)-serialdate(@date)

SerialDate -
http://www.kixtart.org/forums/ubbthreads...=true#Post82573


How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1

Top
#204016 - 2012-01-06 03:05 PM Re: Wallpaper daily counter down [Re: Stephen Wintle]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Greetings!

BGInfo allows you to create a custom attribute. This can be the contents of a file or an environment var, among other options. Kix can easily create either - just make sure bginfo is called after Kix updates the value.

You can use one of the timediff() UDF to easily return the number of days between dates.. for example, if the exams start on Feb 15, 2010, you would run
 Code:
$Days = TimeDiff('2/15/2012', 'Today', 'D')
Save the result, along with any other message, to a file or environment var
 Code:
$ = RedirectOutput('C:\Temp\countdown.txt')
Int($Days) ' days before start of exams!'
$ = RedirectOutput('')
I tested this with BGInfo and the custom File attribute. The Int() is required because the TimeDiff will return the fractional day part.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#204017 - 2012-01-06 03:53 PM Re: Wallpaper daily counter down [Re: Glenn Barnas]
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Many thanks ill get to work on this now, I shall let you know how I get on!
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#204018 - 2012-01-06 03:55 PM Re: Wallpaper daily counter down [Re: Stephen Wintle]
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Of course it doesn't have to use BGinfo if Kix can be used to do it all. Cheers.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#204019 - 2012-01-06 05:02 PM Re: Wallpaper daily counter down [Re: Stephen Wintle]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
 Originally Posted By: Stephen Wintle
Of course it doesn't have to use BGinfo if Kix can be used to do it all. Cheers.


Kix cannot display text on the user’s desktop without it being some kind of window like a command window, a custom made window using kixforms, etc... If you want it as text over the user’s desktop background then bginfo works fine. Been using it for some time and I do not have any complains yet.

A custom value like Glenn suggested should do the trick. It is not dynamic but it refreshes the value with whatever is in the text file every time the background is applied by BGInfo. If you want something dynamic then I suggest using a desktop gadget.


Edited by Mart (2012-01-06 05:02 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#204020 - 2012-01-06 05:32 PM Re: Wallpaper daily counter down [Re: Mart]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
with a bitmap background kixtart might be able to do the trick too.
_________________________
!

download KiXnet

Top
#204029 - 2012-01-09 09:10 AM Re: Wallpaper daily counter down [Re: Lonkero]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
 Originally Posted By: Lonkero
hmm...
with a bitmap background kixtart might be able to do the trick too.


Really?
Can you post an example?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#204035 - 2012-01-09 09:29 PM Re: Wallpaper daily counter down [Re: Mart]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nope. I did read on it a bit...
kixtart just can't handle the char(0) that is required to do any kind of real "work" on "real files"
_________________________
!

download KiXnet

Top
#204037 - 2012-01-10 03:46 AM Re: Wallpaper daily counter down [Re: Lonkero]
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
Actually you can if you use Adodb.Stream and a reference binary file.
Top
#204057 - 2012-01-11 05:26 PM Re: Wallpaper daily counter down [Re: It_took_my_meds]
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi Guys and thanks for the replies, it seems the solution is going to be a bit more complex than first thought, I have got BGinfo working and displaying a message etc. But I need to chop off weekends, holidays etc to calculate the actual working (school) days...

Ouch.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#204058 - 2012-01-11 05:54 PM Re: Wallpaper daily counter down [Re: It_took_my_meds]
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi, I need to calculate number of working days between to dates, (so miss weekends and holidays) looking at the Datecalc UDF is this possible? Then can I use a custom field in BGinfo to somehow automatically reduce the number by one?

The goal posts have moved.. \:\(
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#204059 - 2012-01-11 05:59 PM Re: Wallpaper daily counter down [Re: Stephen Wintle]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Using serialdate...
I am sure this could be golfed to death, but this should be very direct

break on
 
$excludeddates="2012/01/01,2012/01/07,2012/01/08,2012/01/14,2012/01/15,2012/01/21,2012/01/22,2012/01/28,2012/01/29" $eventdate="2012/01/31" $today=@date
$days=serialdate($eventdate)-serialdate($today) ? "Total Days: " + $days
for each $date in split($excludeddates,",") if serialdate($date)>serialdate($today) $days=$days-1 endif next ? "Days, excluding Holidays and Weekends: " + $days

Top
#204060 - 2012-01-11 06:09 PM Re: Wallpaper daily counter down [Re: Allen]
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Excellent I shall have a play, many thanks.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#204065 - 2012-01-12 07:40 AM Re: Wallpaper daily counter down [Re: Stephen Wintle]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
I got way to interested in this... See what you think.



break on


$excludeddates=GetUSHolidays("Federal")
$eventdate="2012/01/31"
$today=@date


$days=serialdate($eventdate)-serialdate($today)
? "Total Days: " + $days


for $i= serialdate($today) to serialdate($eventdate)
if $i mod 7 = 6 or $i mod 7 = 0 or ascan($excludeddates,serialdate($i))>-1
$days=$days-1
endif
next
? "Days, excluding Holidays and Weekends: " + $days




You can get GetUSHolidays() here:
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=204064#Post204064

Top
Page 1 of 1 1


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

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.067 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

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