Page 1 of 2 12>
Topic Options
#135102 - 2005-03-09 01:27 AM help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
Hi,

CAn someone help me with the code. This code was suggested to me by NTDOC and Howard Bullock so the level of KiXtart is way way to high for me.The idea is to desplay meesags on the screen using logon scripts every 45 days. I have windows 2000 server and clients running on windows XP SP1 and Windows 2000 SP3. Thank you all in advance

Code:

Dim $OS, $Msg, $Answer, $RC

$OS=setOption('Explicit','off')
$OS=setOption('NoVarsInString','On')
$OS=setOption('WrapAtEOL','On')

Dim $SetCounter, $Key, $KeyValue, $Delay,$KiXtartSchedule

$Delay=3888000
$SetCounter=FileTime(@Date,@Time)
$KiXtartSchedule="HKEY_CURRENT_USER\Software\LogOnScripts\Schedule\45"
$Key=KeyExist($KiXtartSchedule)

If $Key
$KeyValue=Val(ReadValue($KiXtartScheduale,'time'))
If SetCounter > ($KeyValue+$Delay)
$Answer=MessageBox("what ever need to be said","Reminder",4180) If $Answer <>6
$Msg=MessageBox("what ever need to be said",4112)
$RC=LogOff(1)
Else
$Msg=MessageBox(What ever need to be said",64,5)
EndIf
KeyValue=WriteValue$KiXtartSchedule,'time',$SetCounter,REG_SZ) If $Answer <>6
$Msg=MessageBox("what ever need to be said",4112)
$RC=LogOff(1)
Else
$Msg=MessageBox(What ever need to be said",64,5)
EndIf
Endif
If InGroup("Domain Users")
MapDrive("F:", "jmmes", "Vol1")
MapDrive("G:", "jmmes", "mCalas")
MapDrive("H:", "jmmes", "caldata")
MapDrive("I:", "jmmes", "s6system")
MapDrive("J:", "jmmes", "winapp")
; K: Drive Mapped by OS as Home Share
MapDrive("L:", "j :Jmmes", "abas")
MapDrive("M:", "jmmes", "vol1")
MapDrive("N:", "jmmes", "netapps")
MapDrive("O:", "jmmes", "JMME-FPlan")
MapDrive("P:", "jmmes", "apps")
MapDrive("Q:", "jmmes" ,"NotesMME")
MapDrive("S:", "jmmes", "vol2")
MapDrive("T:", "jmmes", "templates")
MapDrive("Y:", "jmmes", "PWCDll")
Endif

Function MapDrive($Drive, $Server, $Share)
Dim $Drive, $Server, $Share, $shell
Color c+/n

If $Drive<>"" and $Server<>"" and $Share<>""
$LogText="Connecting $Drive to \\$Server\$Share"
? $LogText
USE $Drive /Delete /Persistent
USE $Drive "\\" + $Server + "\" + $Share
If @error=0
color g+/n
$x = " - Success"
$x
If val($DOS) >= 5
$shell=createobject("shell.application")
$shell.namespace($Drive+"\").self.name=$Share + " on '" + $Server + "'"
$shell = 0
Endif
Else
color r+/n
$x = " - Failed: Error " + @error
$x
$ErrorState=1
Endif
; Commented out logging
;WriteLog ($LogText + $x)
;WriteLog2("%temp%\MapDrive.log",$LogText + $x,1)
Color w+/n
Else
? "Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'"
; Commented out logging
;WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'")
Endif
Endfunction

Else
keyValue=WriteValue$KiXtartSchedule,'time',SetCounter,REG_SZ)

Function FlipcTime($date,$time,optional $tz)
Dim $y,$m,$d

$date = split($date,"/")

If
ubound($date) <> 2 exit(1)
Endif

$y=val($date[0]) $m=val($date[1]) $d=val($date[2])

If $m<3
$m=$m+12
$y=$y-1
Endif

$Date=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306
$time = split($time,":")

Select
case ubound($time)=1
redim preserve $time[2]
$time[2]=0
case ubound($time)=2
case 1
exit(1)
Endselect

$time = (val($time[0])*3600)+(val($time[1])*60)+val($time[2])
flipctime=IIF($tz,(($date-719163)*86400+$time)-($tz*3600),($date-719163)*86400 + $time)
endfunction


Top
#135103 - 2005-03-09 02:03 AM Re: help with the code
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
OzRaelized.
Your code is kinda messed up yeah.
Do you have the original NTDOC and Howard suggestion?
There is even a function in your code 'FileTime()' I cannot find to make it work.
_________________________
Life is fine.

Top
#135104 - 2005-03-09 02:14 AM Re: help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
HI Jose,

The Code suggested by NTDOC is in :
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=130347&page=0&view=collapsed&sb=5&o=&fpart=1

if it easer you can find it in the starters forum, at the moment is n the first page.

Again thank you for your help
Avi

Top
#135105 - 2005-03-09 02:36 AM Re: help with the code
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
I see NTDOCīs code looks accurate at that link.
You just follow the ';' commented line where he marks you where to place the messagebox in order to be triggered every 45 days.
Here:

Code:

; Shell 'application you want to run every 45 days'



Either you have not followed his tip or you dont know what the comment ment.

Can you see it?
_________________________
Life is fine.

Top
#135106 - 2005-03-09 04:09 AM Re: help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
Hi Jose,

Ok; thanks for that - I am going to have a go.I will let you know how did I go.

Again thank you for your help

Top
#135107 - 2005-03-09 06:14 AM Re: help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
Hi Jose,

I am in a bit of a situation. the script is working but then I am unable to get my mapdrives, or the other way I get my mapdrives but the messagebox will not work.

I have a batch file that call the scripts for the server but for some reasons it will only call the first script on the list. Also if I combinde the two scripts into one it will only do one thing and that is depending on which of the codes is on the top of the page.
HAve you got any idea on how I can add an extra script to NTDOC script.

Again thank you for your help

Top
#135108 - 2005-03-09 08:30 AM Re: help with the code
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Okay Oz... not sure but I think this is closer to what you're wanting it to do. If the Key does not exist it will create it and display the message box for the first time and won't display it again for 45 days. If the user does not click on OK it will log him/her off. If they click OK it will continue on to the DriveMap checking routine.

I HAVE NOT TESTED THIS - IT IS ONLY PROOF OF CONCEPT CODE

Break Off
Dim $SO,$Pause
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')

Dim $SetCounter,$Key,$KeyValue,$Delay,$RC,$Answer,$Msg
$Delay=3888000
$SetCounter=FlipcTime(@DATE,@TIME)
$Key=KeyExist('HKCU\Software\LogOnScripts\Schedule\45')
If $Key
$KeyValue=Val(ReadValue('HKCU\Software\LogOnScripts\Schedule\45','time'))
If $SetCounter > ($KeyValue+$Delay)
; Reset the counter to current time so you can check properly next time
$KeyValue=WriteValue('HKCU\Software\LogOnScripts\Schedule\45','time',$SetCounter,REG_SZ)
$Answer=MessageBox('You must agree that Ozz is the man or you will be logged off','Reminder',4164)
If $Answer=7
$Msg=MessageBox('Since you chose NO you must be logged off now','Goodbye now 1st',4144)
$RC=LogOff(1)
Else
$Msg=MessageBox('Thank you for agreeing with me. You may continue now..1st.','Ozz is the man',4160,5)
EndIf
EndIf
Else
$KeyValue=WriteValue('HKCU\Software\LogOnScripts\Schedule\45','time',$SetCounter,REG_SZ)
$Answer=MessageBox('You must agree that Ozz is the man or you will be logged off 2nd','Reminder',4164)
If $Answer=7
$Msg=MessageBox('Since you chose NO you must be logged off now','Goodbye now 2nd',4144)
$RC=LogOff(1)
Else
$Msg=MessageBox('Thank you for agreeing with me. You may continue now..2nd.','Ozz is the man',4160)
EndIf
Endif

If InGroup('Domain Users')
MapDrive('F:', 'jmmes', 'Vol1')
MapDrive('G:', 'jmmes', 'mCalas')
MapDrive('H:', 'jmmes', 'caldata')
MapDrive('I:', 'jmmes', 's6system')
MapDrive('J:', 'jmmes', 'winapp')
; K: Drive Mapped by OS as Home Share
MapDrive('L:', 'j :Jmmes', 'abas')
MapDrive('M:', 'jmmes', 'vol1')
MapDrive('N:', 'jmmes', 'netapps')
MapDrive('O:', 'jmmes', 'JMME-FPlan')
MapDrive('P:', 'jmmes', 'apps')
MapDrive('Q:', 'jmmes' ,'NotesMME')
MapDrive('S:', 'jmmes', 'vol2')
MapDrive('T:', 'jmmes', 'templates')
MapDrive('Y:', 'jmmes', 'PWCDll')
Endif

Quit 1

Function FlipcTime($date,$time,optional $tz)
Dim $y,$m,$d
$date = Split($date,"/")
If UBound($date) <> 2 Exit(1) EndIf
$y=Val($date[0]) $m=Val($date[1]) $d=Val($date[2])
If $m<3
$m=$m+12
$y=$y-1
EndIf
$Date=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306
$time = Split($time,":")
Select
Case UBound($time)=1
ReDim PreServe $time[2]
$time[2]=0
Case UBound($time)=2
Case 1
Exit(1)
EndSelect
$time = (Val($time[0])*3600)+(Val($time[1])*60)+Val($time[2])
$flipctime = IIF($tz,(($date-719163)*86400 + $time)-($tz*3600),($date-719163)*86400 + $time)
EndFunction

Function MapDrive($Drive, $Server, $Share)
Dim $Drive, $Server, $Share, $shell
Color c+/n
If $Drive<>"" And $Server<>"" And $Share<>""
$LogText="Connecting " + $Drive + " to \\" + $Server + "\" + $Share
? $LogText
USE $Drive /Delete /Persistent
USE $Drive "\\"+$Server+"\"+$Share
If @ERROR=0
Color g+/n
$x=" - Success"
$x
If Val($DOS) >= 5
$shell=CreateObject("shell.application")
$shell.NameSpace($Drive+"\").Self.Name=$Share + " on '" + $Server + "'"
$shell = 0
EndIf
Else
Color r+/n
$x=" - Failed: Error " + @ERROR
$x
$ErrorState=1
EndIf
Color w+/n
Else
Endif
Endfunction

Top
#135109 - 2005-03-09 09:18 AM Re: help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
HI NTDOC,

Again thank you for all your help, I am going to test the script. I just want to let all you guys to know that I also try and undersdand the script not just copy it. I have time issues and users that are a pain in the backside.
So thank you for your time and understanding I think you guys doing an excellet job.

Top
#135110 - 2005-03-09 09:31 AM Re: help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
HI NTDOC,

I runnthe script and I get the error:

    ERROR : expected expression!
    Script: C:\KiXtart\finalscript.KIX
    Line : 9


Now I looked at the other scripts and it is the same.
At this point I am not sure why or what is causing the error.
Please see if you can understand why the error is coming up?

Thanks


Top
#135111 - 2005-03-09 11:00 AM Re: help with the code
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Ozz, Did you copy it exactly as shown above?

Copy it, then paste into Wordpad, then select all and copy from Wordpad and paste into notepad or other ASCII editor and paste it. Then save it.

What version of KiXtart are you using?


I just re-copied it exactly as shown above and ran it without error using KiXtart 4.22

Or, is there another main script your copying this code into?

Need some more details as to what is really going on guy in order to be able to help you.

Top
#135112 - 2005-03-09 11:42 AM Re: help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
HI NTDOC,

I use version 4.22 .
I did as you suggeted and got a diff' erro on line 79:


    ERROR : duplicated definition of variable [$Drive]
    Script: c:\KiXtart\Logonscript.KIX
    Line : 79


I am going to print yu script and type in again and see what is the go.
Again I would like to thank you for taking the time with me.

Thanks

Top
#135113 - 2005-03-09 03:17 PM Re: help with the code
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
In your code, where you have:
Code:

Function MapDrive($Drive, $Server, $Share)
Dim $Drive, $Server, $Share, $shell



You need to change it to:
Code:

Function MapDrive($Drive, $Server, $Share)
Dim $Server, $Share, $shell



The problem is that the Function uses $Drive as a variable being passed to the Function and it does not need to be re-dimmed.

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#135114 - 2005-03-09 08:12 PM Re: help with the code
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Sort of a nice catch there Kent but the others are parameters as well and should not be declared.

I didn't even notice it. I think that is some on the fly or OLD code from Howard B. that is not a NoVarsInStrings or Explicit compliant UDF.

I was not able to find this exact UDF in the UDF forum so I assume this is/was something Howard whipped up a while back.

Howard, if you can please update your code example to be compliant with the above options.

Ozz, for now until Howard looks at his code. You can remove the $Drive, $Server, $Share from the DIM statement in the MapDrive UDF.

Then run it from a DOS console and you should be prompted by KiXtart that some vars are not declared. Add those to the DIM line where needed.

Top
#135115 - 2005-03-09 11:43 PM Re: help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
HI NTDOC,

Thanks for the information I am going to have a look.
I am not sure if it will help but at present I am running this script just on two machines for testing one is XP the other is win 2000.

The code for the DriveMap seems to be the same as the one you have and it is working fine. So I am in a state of confussion. I am goiong to do a search to find all KIX32 files on my server, do you think that the version in the NETLOGON can be diff'. is there away to unregister KIX32?
What is the best way to confirm what verion of KIX32 I am using to run the scripts? At the moment I take it is the KIX32 that is in the same folder that the scripts are stored in. I point to this folder when I am going to DOS.

Again thank you and all the other guys

Code:

Dim $0S, $Msg, $Answer, $RC
$OS=SetOption('Explicit','off')
$OS=SetOption('NoVarsInStrings','On')
$OS=SetOption('WrapAtEOL','On')

$Answer = MessageBox ("Please confirm that you have read and understood the firm's IT policy. If you have any questions relative to this please contact Gary or Rae", "Reminder", 4180)
If $Answer <> 6
$Msg=MessageBox ( "You are unable to log to the network", "call your IT Administrator", 4112)
$RC=Logoff(1)
Else
;$ = shutdown("","you are being logged off",45,1,1)
$Msg=MessageBox ("You are now being connected to the network","Welcome to Johnsons MME",64,5)
Endif

If InGroup("Domain Users")
MapDrive("F:", "jmmes", "Vol1")
MapDrive("G:", "jmmes", "mCalas")
MapDrive("H:", "jmmes", "caldata")
MapDrive("I:", "jmmes", "s6system")
MapDrive("J:", "jmmes", "winapp")
; K: Drive Mapped by OS as Home Share
MapDrive("L:", "jmmes", "abas")
MapDrive("M:", "jmmes", "vol1")
MapDrive("N:", "jmmes", "netapps")
MapDrive("O:", "jmmes", "JMME-FPlan")
MapDrive("P:", "jmmes", "apps")
MapDrive("Q:", "jmmes" ,"NotesMME")
MapDrive("S:", "jmmes", "vol2")
MapDrive("T:", "jmmes", "templates")
MapDrive("Y:", "jmmes", "PWCDll")

Endif

Function MapDrive($Drive, $Server, $Share)
Dim $Drive, $Server, $Share, $shell
Color c+/n

If $Drive<>"" and $Server<>"" and $Share<>""
$LogText="Connecting $Drive to \\$Server\$Share"
? $LogText
USE $Drive /Delete /Persistent
USE $Drive "\\" + $Server + "\" + $Share
If @error=0
color g+/n
$x = " - Success"
$x
If val($DOS) >= 5
$shell=createobject("shell.application")
$shell.namespace($Drive+"\").self.name=$Share + " on '" + $Server + "'"
$shell = 0
Endif
Else
color r+/n
$x = " - Failed: Error " + @error
$x
$ErrorState=1
Endif
; Commented out logging
;WriteLog ($LogText + $x)
;WriteLog2("%temp%\MapDrive.log",$LogText + $x,1)
Color w+/n
Else
? "Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'"
; Commented out logging
;WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'")
Endif
Endfunction


Top
#135116 - 2005-03-10 02:51 AM Re: help with the code
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Please remove the LONG LINES in your post so that readers don't have to scroll the window. You can edit your post.

You have turned off Explicit so that might be why you're getting by, but your code and mine are not the same.


$OS=SetOption('Explicit','off')


Though even with Explicit off I would think that Dimming a parameter would still cause KiX to complain, but can't say for certain as I've not actually tested that theory.


Top
#135117 - 2005-03-10 05:19 AM Re: help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
Hi NTDOC,

Ok Ok Ok it is working
I removed the veriable and add the one that needed and it is working.

This is funtastic. Thank you very much for the help and the time and the energy you took into helping me. And again not just me and alot of other people will get a good script, but alot of us will learn form that.

So thank you
This is the code as it worked on my machince.
I removed the words from the MessageBox.
Again thank you very much.

Code:

Break Off
Dim $SO, $Pause
$SO=SetOption('Explicit','off')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')

Dim $SetCounter, $Key, $KeyValue, $Delay, $RC, $Answer, $Msg
$Delay=3888000
$SetCounter=FlipcTime(@DATE,@TIME)
$Key=KeyExist('HKCU\Software\LogOnScripts\Schedule\45')
If $Key
$KeyValue=Val(ReadValue('HKCU\Software\LogOnScripts\Schedule\45','time'))
If $SetCounter > ($KeyValue+$Delay)
; Reset the counter to current time so you can check properly next time
$KeyValue=WriteValue('HKCU\Software\LogOnScripts\Schedule\45','time',$SetCounter,REG_SZ)
$Answer=MessageBox('what ever','Reminder',4164)
If $Answer=7
$Msg=MessageBox('What ever',4144)
$RC=LogOff(1)
Else
$Msg=MessageBox('what ever',4160,5)
EndIf
EndIf
Else
$KeyValue=WriteValue('HKCU\Software\LogOnScripts\Schedule\45','time',$SetCounter,REG_SZ)
$Answer=MessageBox('what ever','Reminder',4164)
If $Answer=7
$Msg=MessageBox('what ever',4144)
$RC=LogOff(1)
Else
$Msg=MessageBox('what ever',4160)
EndIf
Endif

If InGroup ('Domain Users')
MapDrive ('R:', 'jmmes', 'Vol1')
MapDrive ('G:', 'jmmes', 'mCalas')
MapDrive ('H:', 'jmmes', 'caldata')
MapDrive ('I:', 'jmmes', 's6system')
MapDrive ('J:', 'jmmes', 'winapp')
; K: Drive Mapped by OS as Home Share
MapDrive ('L:', 'jmmes', 'abas')
MapDrive ('M:', 'jmmes', 'vol1')
MapDrive ('N:', 'jmmes', 'netapps')
MapDrive ('O:', 'jmmes', 'JMME-FPlan')
MapDrive ('P:', 'jmmes', 'apps')
MapDrive ('Q:', 'jmmes', 'NotesMME')
MapDrive ('S:', 'jmmes', 'vol2')
MapDrive ('T:', 'jmmes', 'templates')
MapDrive ('Y:', 'jmmes', 'PWCDll')
Endif

Quit 1

Function FlipcTime($date,$time,optional $tz)
Dim $y,$m,$d
$date = Split($date,"/")
If UBound($date) <> 2 Exit(1) EndIf
$y=Val($date[0]) $m=Val($date[1]) $d=Val($date[2])
If $m<3
$m=$m+12
$y=$y-1
EndIf
$Date=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306
$time = Split($time,":")
Select
Case UBound($time)=1
ReDim PreServe $time[2]
$time[2]=0
Case UBound($time)=2
Case 1
Exit(1)
EndSelect
$time = (Val($time[0])*3600)+(Val($time[1])*60)+Val($time[2])
$flipctime = IIF($tz,(($date-719163)*86400 + $time)-($tz*3600),($date-719163)*86400 + $time)
EndFunction

Function MapDrive($Drive,$Server,$Share)
Dim $LogText, $x, $ErrorState, $Dos, $Shell
Color c+/n
If $Drive<>"" And $Server<>"" And $Share<>""
$LogText="Connecting " + $Drive + " to \\" + $Server + "\" + $Share
? $LogText
USE $Drive /Delete /Persistent
USE $Drive "\\"+$Server+"\"+$Share
If @ERROR=0
Color g+/n
$x=" - Success"
$x
If Val($DOS) >= 5
$shell=CreateObject("shell.application")
$shell.NameSpace($Drive+"\").Self.Name=$Share + " on '" + $Server + "'"
$shell = 0
EndIf
Else
Color r+/n
$x=" - Failed: Error " + @ERROR
$x
$ErrorState=1
EndIf
Color w+/n
Else
Endif
Endfunction


Top
#135118 - 2005-04-22 01:09 PM Re: help with the code
jechilt Offline
Starting to like KiXtart

Registered: 2000-12-01
Posts: 102
Loc: Denver Colorado
I know this thread is a little old but can somebody tell me what the $DOS variable is supposed to be doing?
I see that it is declared and then being used as an input variable for VAL, but that appears to be it....makes no sense to me.
_________________________
John
LM Contractor
One of the 2 dads

Top
#135119 - 2005-04-22 02:10 PM Re: help with the code
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
It's not doing anything - probably a typo in the original UDF which has now been fixed.

Replace "$DOS" with "@DOS" and it'll make more sense.

Top
#135120 - 2005-04-22 06:42 PM Re: help with the code
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Thanks for noticing. I missed that in my original reply. @DOS tells you the version of Windows

like 5.0 or 5.1 etc...

Top
#135121 - 2005-04-26 01:54 AM Re: help with the code
ozraelised Offline
Getting the hang of it

Registered: 2002-12-02
Posts: 59
Loc: Albury
Hi Guys

45 days gone since I run the Script
and this morning I got it again. Excellent.
The only problem is that the mapdrive didn't
come up only the K drive and the Z drive.
The K drive is mapped from the user profile,
I don't understand why a script that worked
before and with no changes will not work.
this is the code:
Break Off
Dim $SO, $Pause
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')

Dim $SetCounter, $Key, $KeyValue, $Delay, $RC, $Answer, $Msg
$Delay=3888000
$SetCounter=FlipcTime(@DATE,@TIME)
$Key=KeyExist('HKCU\Software\LogOnScripts\Schedule\45')
If $Key
$KeyValue=Val(ReadValue('HKCU\Software\LogOnScripts\Schedule\45','time'))
If $SetCounter > ($KeyValue+$Delay)
; Reset the counter to current time so you can check properly next time
$KeyValue=WriteValue('HKCU\Software\LogOnScripts\Schedule\45','time',$SetCounter,REG_SZ)
$Answer=MessageBox('You must agree that Ozz is the man or you will be logged off','Reminder',4164)
If $Answer=7
$Msg=MessageBox('Since you chose NO you must be logged off now','Goodbye now 1st',4144)
$RC=LogOff(1)
Else
$Msg=MessageBox('Thank you for agreeing with me. You may continue now..1st.','Ozz is the man',4160,5)
EndIf
EndIf
Else
$KeyValue=WriteValue('HKCU\Software\LogOnScripts\Schedule\45','time',$SetCounter,REG_SZ)
$Answer=MessageBox('You must agree that Ozz is the man or you will be logged off 2nd','Reminder',4164)
If $Answer=7
$Msg=MessageBox('Since you chose NO you must be logged off now','Goodbye now 2nd',4144)
$RC=LogOff(1)
Else
$Msg=MessageBox('Thank you for agreeing with me. You may continue now..2nd.','Ozz is the man',4160)
EndIf
Endif

If InGroup ('Domain Users')
MapDrive ('F:','jmmes', 'Vol1')
MapDrive ('G:', 'jmmes', 'mCalas')
MapDrive ('H:', 'jmmes', 'caldata')
MapDrive ('I:', 'jmmes', 's6system')
MapDrive ('J:', 'jmmes', 'winapp')
; K: Drive Mapped by OS as Home Share
MapDrive ('L:', 'jmmes', 'abas')
MapDrive ('M:', 'jmmes', 'vol1')
MapDrive ('N:', 'jmmes', 'netapps')
MapDrive ('O:', 'jmmes', 'JMME-FPlan')
MapDrive ('P:', 'jmmes', 'apps')
MapDrive ('Q:', 'jmmes', 'NotesMME')
MapDrive ('S:', 'jmmes', 'vol2')
MapDrive ('T:', 'jmmes', 'templates')
MapDrive ('Y:', 'jmmes', 'PWCDll')
Endif

Quit 1

Function FlipcTime($date,$time,optional $tz)
Dim $y,$m,$d
$date = Split($date,"/")
If UBound($date) <> 2 Exit(1) EndIf
$y=Val($date[0]) $m=Val($date[1]) $d=Val($date[2])
If $m<3
$m=$m+12
$y=$y-1
EndIf
$Date=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306
$time = Split($time,":")
Select
Case UBound($time)=1
ReDim PreServe $time[2]
$time[2]=0
Case UBound($time)=2
Case 1
Exit(1)
EndSelect
$time = (Val($time[0])*3600)+(Val($time[1])*60)+Val($time[2])
$flipctime = IIF($tz,(($date-719163)*86400 + $time)-($tz*3600),($date-719163)*86400 + $time)
EndFunction

Function MapDrive($Drive,$Server,$Share)
Dim $Drive, $Server, $Share, $Shell
Color c+/n
If $Drive<>"" And $Server<>"" And $Share<>""
$LogText="Connecting " + $Drive + " to \\" + $Server + "\" + $Share
? $LogText
USE $Drive /Delete /Persistent
USE $Drive "\\"+$Server+"\"+$Share
If @ERROR=0
Color g+/n
$x=" - Success"
$x
If Val($DOS) >= 5
$shell=CreateObject("shell.application")
$shell.NameSpace($Drive+"\").Self.Name=$Share + " on '" + $Server + "'"
$shell = 0
EndIf
Else
Color r+/n
$x=" - Failed: Error " + @ERROR
$x
$ErrorState=1
EndIf
Color w+/n
Else
Endif
Endfunction

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 407 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.124 seconds in which 0.088 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