#41840 - 2003-06-19 05:52 PM
Lots O Questions (sorry)
|
Keith W.
Fresh Scripter
Registered: 2003-06-06
Posts: 30
Loc: Brandon, MB
|
Well I regret to say that I am here with more questions =(.... it seems to be all take and no give with me.
Here are some of the things I am trying to do with my scripts:
1. I want to have a sort of countdown to a certain day. something like: "Only XXX days until the annual Corporate Conference" I have looked at a bunch of the UDF's and quite frankly I have no idea what the deal is with Julian and Gregorian dates are.
2. Is there a key in the registry where a users homepage is stored?
3. In my scripts I had some call's... i.e. "call drives.kix". Drives.kix is located on the logonserver. Now with NT and 2K this worked no problem but with XP I have to specify the UNC name of the file, i.e. "\\server\netlogon\drives.kix". Is this normal?
EDIT:
Ok some updates....
1. All I need to know is how to get the current date from the comp preferrably in YYYY/MM/DD format.
2. I think I have found the key so you can disregard this one.
3. Still clueless. [ 19. June 2003, 18:25: Message edited by: Keith W. ]
|
|
Top
|
|
|
|
#41842 - 2003-06-19 07:37 PM
Re: Lots O Questions (sorry)
|
MightyR1
MM club member
   
Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
|
|
|
Top
|
|
|
|
#41843 - 2003-06-19 07:40 PM
Re: Lots O Questions (sorry)
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
wahey, so someone is awake out there actually, think MS GUIDs will wrap before Jooel stops using Linux.
|
|
Top
|
|
|
|
#41844 - 2003-06-19 07:47 PM
Re: Lots O Questions (sorry)
|
Keith W.
Fresh Scripter
Registered: 2003-06-06
Posts: 30
Loc: Brandon, MB
|
What I want to do is exactly this:
The Annual Corporate Conference this year is Sept. 22nd.
I want my script to display a message saying: "Only XX days until the Annual Corporate Conference"
so what I would need to do is get the current date from the computer and subtract the date of the conference to end up with the amount of days until the conference. I am also looking at another way of doing it which would involve simply manually counting the number of days and then making the script just subtract 1 each day.
|
|
Top
|
|
|
|
#41846 - 2003-06-19 07:59 PM
Re: Lots O Questions (sorry)
|
Keith W.
Fresh Scripter
Registered: 2003-06-06
Posts: 30
Loc: Brandon, MB
|
Good god..... I suck at this.... first post I get reemed because there is a UDF for what I want to do.... so this time I search my @ss off for a UDF and now a simple macro may work! Well it wont do exactly what I want but I think I can make my own UDF for it.
|
|
Top
|
|
|
|
#41848 - 2003-06-19 10:14 PM
Re: Lots O Questions (sorry)
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
Keith look for the UDF SerialDate() in the UDF forums. It will do what you want.
code:
? "There are " + (serialdate("2003/09/22") - serialdate(@date)) + " days till 2003/09/22"
as for your calling problem, try the @scriptdir macro.
call "@scriptdir\drives.kix"
|
|
Top
|
|
|
|
#41849 - 2003-06-19 11:11 PM
Re: Lots O Questions (sorry)
|
Keith W.
Fresh Scripter
Registered: 2003-06-06
Posts: 30
Loc: Brandon, MB
|
Thanks bryce but i have already done it a different way. I just found out the number of days from Jan 1 to Sept. 22 (265) and used that to get a formula like so:
$date = 265 - @ydayno
It gets the job done =). I think I'm gonna sit down and read up on all the macros before I ask another question.... although in my defence I am busy working on roaming profiles and other stuff so I havent had much time to look at the documentation.
|
|
Top
|
|
|
|
#41851 - 2003-06-20 04:55 AM
Re: Lots O Questions (sorry)
|
Keith W.
Fresh Scripter
Registered: 2003-06-06
Posts: 30
Loc: Brandon, MB
|
Actually I just did a simple:
if $date > 0 ? "Only " $date "days till......." EndIf
|
|
Top
|
|
|
|
#41852 - 2003-06-20 11:02 AM
Re: Lots O Questions (sorry)
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Keith, If you take a look in the FAQ section on this board about XP you'll find an explanation of why it is your XP systems can not find your drives.kix file. (at least I think this may be your issue) But, then again, maybe Bryce gave you the answer already.
If you do not have any Windows 9x systems then you don't need to use a batch file at all. You can simply run either
KIX32.EXE KIXTART.KIX or WKIX32.EXE KIXTART.KIX
Then there should not be an issue calling the DRIVES.KIX file, but you could also include all the code in a single file and run it that way.
Windows 9x is the one that gets lost and does not know where it is in the environment. NT/2000/XP/2003 do not have this problem, thus there is no need to launch KiXtart with a batch file for these systems.
As for the COUNT DOWN TIMER I think this may be a better solution.
break on
$Date="2003/09/22"
$EventDay=(serialdate($Date) - serialdate(@date))
SELECT
CASE
$EventDay >0
? "There are " + $EventDay + " days till The Annual Corporate Conference this year on Sept. 22nd"
CASE
$EventDay <0
? "The Annual Corporate Conference passed by " + $EventDay + " day/s ago."
CASE
$EventDay =0
? "The Annual Corporate Conference is " BIG "TODAY" SMALL
ENDSELECT
function serialdate($ExpD)
dim $z,$h,$a,$b,$c,$y,$m,$d
if instr($ExpD,'/')
$ExpD=split($ExpD,'/')
$y=val($ExpD[0])
$m=val($ExpD[1])
$d=val($ExpD[2])
if $m<3
$m=$m+12
$y=$y-1
endif
$SerialDate=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306
else
$z=0+$ExpD+306
$h=100*$z-25
$a=$h/3652425
$b=$a-$a/4
$y=(100*$b+$h)/36525
$c=$b+$z-365*$y-$y/4
$m=(5*$c+456)/153
$d=$c-(153*$m-457)/5
if $m>12
$y=$y+1
$m=$m-12
endif
$SerialDate=right('0000'+$y,4)+'/'+right('00'+$m,2)+'/'+right('00'+$d,2)
endif
endfunction
|
[ 20. June 2003, 11:09: Message edited by: NTDOC ]
|
|
Top
|
|
|
|
#41853 - 2003-06-21 04:31 AM
Re: Lots O Questions (sorry)
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Just a minor change to the code. For the days before the event it shows in the DOS box during logon, when the day arrives it POPS UP a MessageBox for more attention. Then when event is passed it goes back to the DOS box until you disable it in the script.
Now that the code is working and readily available, I may have to use it for something myself.
break on
$Date="2003/06/20"
$EventDay=(serialdate($Date) - serialdate(@date))
SELECT
CASE
$EventDay >0
? "There are " + $EventDay + " days till The Annual Corporate Conference this year on Sept. 22nd"
CASE
$EventDay <0
? "The Annual Corporate Conference passed by " + $EventDay + " day/s ago."
CASE
$EventDay =0
$EM=Messagebox('The Annual Corporate Conference is TODAY'+@crlf+@crlf+'
'+@date, 'Corporate Event', 64, 10)
ENDSELECT
function serialdate($ExpD)
dim $z,$h,$a,$b,$c,$y,$m,$d
if instr($ExpD,'/')
$ExpD=split($ExpD,'/')
$y=val($ExpD[0])
$m=val($ExpD[1])
$d=val($ExpD[2])
if $m<3
$m=$m+12
$y=$y-1
endif
$SerialDate=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306
else
$z=0+$ExpD+306
$h=100*$z-25
$a=$h/3652425
$b=$a-$a/4
$y=(100*$b+$h)/36525
$c=$b+$z-365*$y-$y/4
$m=(5*$c+456)/153
$d=$c-(153*$m-457)/5
if $m>12
$y=$y+1
$m=$m-12
endif
$SerialDate=right('0000'+$y,4)+'/'+right('00'+$m,2)+'/'+right('00'+$d,2)
endif
endfunction
|
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 735 anonymous users online.
|
|
|