#170155 - 2006-11-08 06:43 PM
Re: Change Text on Dialog
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
ok, i don't think i must have said it very clearly, by now all of those external scripts would have been added to the bottom of this script, when we are done you will not be useing external scripts.
Edited by Benny69 (2006-11-08 06:54 PM)
|
Top
|
|
|
|
#170156 - 2006-11-08 06:44 PM
Re: Change Text on Dialog
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
this is the way your script should look now. Code:
;************************************************************ ;************************************************************ ;** ** ;** NetCare3.2 - D5PS2Z0J Login System ** ;** Netlogon.kix ** ;** D5PS2Z0J NetServices ** ;** ** ;** Dependencies: ** ;** Kixforms.dll Ver 2.46.54.0 ** ;** ** ;************************************************************ ;************************************************************
;************************** ;** Dim some global vars ** ;************************** Dim $frmForm Dim $fraBanner, $fraForm ;Dim $prgProgress Dim $Hour
;************************** ;** Set some global vars ** ;************************** $strVersion = "V.3.2.09" $LSD = @LServer + "\netlogon" $WaitTime = 1 ;** Time to wait after each task $Blanker = " " ;** Blank captions
;****************** ;** START HERE ** ;******************
CheckDLL()
;Create KiXforms Object $System = CreateObject("Kixtart.System") ;Verify KiXforms Object was created If Not $System $nul= MessageBox("KiXforms Not Initiated."+@CRLF+ "Please Verify KiXforms.dll is installed."+@CRLF+ "This Script Will Now Close.","Error...",16) Quit() EndIf
;*************** ;** Main form ** ;*************** $frmForm = $System.Form() $frmForm.Text = "NetCare3.2 - D5PS2Z0J Logon System " $frmForm.SysMenu = 0 $frmForm.Height = 300 $frmForm.Width = 450 $frmForm.FontName = "Verdana" $frmForm.FontSize = 9
;************* ;** Banner ** ;************* $fraBanner = $frmForm.Controls.Add("PictureBox") ;$fraBanner.Image = "C:\my projects\NetCare3\Images\NC32SM.gif" $fraBanner.BackColor = $frmForm.RGB(255,255,255) $fraBanner.Width = $frmForm.Width - 4 $fraBanner.Height = 60 $fraBanner.Left = -2 $fraBanner.Top = -2
;************************ ;** Draw On the banner ** ;************************ $fraBanner.FontSize = 14 $fraBanner.FontName = "verdana" $fraBanner.FontBold = 1 $fraBanner.FontItalic = 1 $fraBanner.ForeColor = $frmForm.RGB(0, 0, 200) $fraBanner.PrintXY (10,0,"Netlogon.kix") $fraBanner.FontItalic = 0 $fraBanner.FontSize = 8 $fraBanner.ForeColor = $frmForm.RGB(0,0,0) $fraBanner.PrintXY (10,24,$strVersion +" Powered by KiXforms (Shamil Nunhuck) ") $fraBanner.FontSize = 9 $fraBanner.PrintXY (10,35,"D5PS2Z0J NetServices") $fraBanner.FontBold = 0 $fraBanner.FontSize = 10
;****************** ;** Progress Bar ** ;****************** $prgProgress = $frmForm.Controls.Add("ProgressBar") $prgProgress.Width = $frmForm.Width - 10 $prgProgress.Left = 2 $prgProgress.Height = 20 $prgProgress.Top = 245;$frmForm.Height - $prgProgress.Height - 5 $prgProgress.Style = 1
;**************** ;** Main Frame ** ;**************** $fraMain = $frmForm.Controls.Add("PictureBox") $fraMain.BackColor = $frmForm.RGB(255,255,255) $fraMain.Width = $frmForm.Width $fraMain.Height = 182 ;$frmForm.Height - $fraBanner.Height - 35 $fraMain.Left = -2 $fraMain.Top = $fraBanner.Height - 5
$lblJob = $fraMain.Controls.Add("label") $lblJob.FontSize = 10 $lblJob.Top = 80 $lblJob.Width = 440 ;fraMain.Width - 20 $lblJob.Left = 10
$lblTask = $fraMain.Controls.Add("label") $lblTask.FontSize = 10 $lblTask.Top = 120 $lblTask.Width = 440 ;fraMain.Width - 20 $lblTask.Left = 50
;*********************** ;** Draw on the frame ** ;** Greeting ** ;*********************** $Hour = Val(Trim(Left(@Time,2))) If $Hour < 12 $Greeting = "Good Morning @userid " Else If $Hour < 17 $Greeting = "Good Afternoon @userid" Else $Greeting = "Good Evening @userid " EndIf EndIf $fraMain.FontSize = 11 $fraMain.FontName = "verdana" $fraMain.FontBold = 1 $fraMain.ForeColor = $frmForm.RGB(0,100,100) $fraMain.PrintXY (10,10,$Greeting) $fraMain.PrintXY (10,40,"Please wait while you logon script executes...") $frmForm.Center $frmForm.Show
Prep() MapDrives() DoAudit() LogUser() DoAntiVirus() Time() Snd()
Sleep 2 $fraMain.ForeColor = $fraMain.BackColor $fraMain.PrintXY (10,40,"Please wait while you logon script executes...") $fraMain.ForeColor = $frmForm.RGB(0,100,100) $fraMain.PrintXY (10,40,"Logon has been successful.") Sleep 2 ExitScript()
While $frmForm.Visible $=Execute($frmForm.DoEvents()) Loop Exit 0
;******************* ;** End Main Form ** ;*******************
Function CheckDLL() ;************************************************* ;** Check that KIXFORMS.DLL is registered and ** ;** copy and register if not ** ;************************************************* ;$ReturnCode = KeyExist("HKEY_CLASSES_ROOT\KixTart.Form\CLSID") $ReturnCode = KeyExist("HKEY_CLASSES_ROOT\Kixtart.System\CLSID") If $ReturnCode = 0 ;** KixForms not registered ;** Copy .DLL $SourceFile = @LServer + "\netlogon\kixforms.dll" $Value = ReadValue("HKLM\System\CurrentControlset\Control\Windows", "SystemDirectory") $Destination = ExpandEnvironmentVars($Value) Copy $SourceFile $Destination ;** Register .DLL silently $CMDLine = "regsvr32 /s " + $Destination + "\kixforms.dll" $ObjShell = CreateObject("WScript.Shell") $ObjShell.run($CMDLine, 1, true) ;** Kill shell object $ObjShell = "" EndIf ;** Wait for registration to take effect Sleep 2 EndFunction
Function DoProgress($Step) $prgProgress.Value = $prgProgress.Value + $Step EndFunction
Function Prep() $lblJob.Text = $Blanker $lblJob.Text = "Preparing for logon" Sleep 1 EndFunction
Function MapDrives() $lblJob.Text = $Blanker $lblJob.Text = "Mapping Network Drives... " Use * /DELETE
;** Common mappings: Everyone gets these **
Sleep $WaitTime DoProgress(5)
$DriveToMap = "\\d5ps2z0j\PUBLIC" $lblTask.Text = $Blanker $lblTask.Text = "Public" Use L: $DriveToMap DoProgress(5)
$DriveToMap = "\\d5ps2z0j\netlogon" $lblTask.Text = $Blanker $lblTask.Text = "netlogon" Use N: $DriveToMap DoProgress(5) $DriveToMap = "\\d5ps2z0j\cache" $lblTask.Text = "SmartCache" Use S: $DriveToMap DoProgress(5) EndFunction
Function DoAudit() $fraMain.fontsize = 10 $lblJob.Text = $Blanker $lblJob.Text = "Running Workstation Audit... " ;AUDIT STUFF IN HERE ; ;Audit what???? ; ; Hardware: (Check for changes?) ; Installed Software (Check for changes?) $lblTask.Text = $Blanker $lblTask.Text = "Hardware" Sleep $WaitTime DoProgress(20) $lblTask.Text = $Blanker $lblTask.Text = "Software" Sleep $WaitTime DoProgress(20) EndFunction
Function LogUser() $lblJob.caption = $Blanker $lblJob.caption = "Collecting Logon Info... " DoProgress(10) ;** Dim some vars $LogFolder = @LServer + "\netlogon\logs\" ;** Path to log dir $FileName = @MONTH + "--" + @WKSTA + ".csv"
;** Get Log File Name $MyFile = $LogFolder + $FileName
;** Set full path to file $CRLF= Chr(13) + Chr(10)
;** Set Carriage Return + Line feed $MyDateTime = @DATE + " : " + @TIME
;** Date and time string DoProgress(10) If Open(1,$MyFile,5) = 0 ;** Open file for write. Create if doesn't exist ;** Date And time $Silent = WriteLine (1, $MyDateTime + $CRLF) $lblTask.Caption = $Blanker $lblTask.Caption = "Time and Date" Sleep $WaitTime DoProgress(10) ;** User Details $Silent = WriteLine (1, "User: " + @USERID + " Full Name: " + @FULLNAME + $CRLF);Write data to file $lblTask.Caption = $Blanker $lblTask.Caption = "User Name" Sleep $WaitTime DoProgress(10) ;** IP 0 $Silent = WriteLine (1, "IP: " + @IPAddress0 + $CRLF) $lblTask.Caption = $Blanker $lblTask.Caption = "IP Address" Sleep $WaitTime DoProgress(10) $Silent = WriteLine (1, $CRLF) $Silent = Close (1) ;Close file EndIf ; Sleep 1 EndFunction
Function DoAntiVirus() $lblJob.Text = $Blanker $lblJob.Text = "Updating Antivirus... " $lblTask.Text = $Blanker $LSD = @LServer + "\Netlogon" If Exist("$LSD\patches.kix") Call "$LSD\patches.kix" EndIf DoProgress(5) EndFunction
Function Time() ;======= Sync Time with Domain Controller $lblJob.Text = $Blanker $lblJob.Text = "Synchronizing time " If Exist ("$LSD\TimeSync.bat") Shell "$COMSPEC /e:1024 /c $LSD\TimeSync.bat" EndIf EndFunction
Function Snd() $lblJob.Text = $Blanker $lblJob.Text = "Logon has been successful" Play @ldrive+"chimes.wav" Sleep 2 DoProgress(5) EndFunction
Function ExitScript() Quit() EndFunction
;***************** ;** End of File ** ;*****************
Edited by Benny69 (2006-11-08 06:48 PM)
|
Top
|
|
|
|
#170157 - 2006-11-08 06:51 PM
Re: Change Text on Dialog
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
in your DoAntiVirus function you referance '$LSD\patches.kix', can you post that script? we want to convert it to a function and add it to the bottom of the main script, just like the others.
|
Top
|
|
|
|
#170158 - 2006-11-08 09:14 PM
Re: Change Text on Dialog
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
Sorry, that reference to patches.kix has been removed, and thanks for the help, it is greatly appreciated.
Once the script has finish loading and when it is meant to say "Logon has been successful", there seems to be a jumble on the screen, look here (.avi file) NetLogon script run
Edited by 04nunhucks (2006-11-08 09:27 PM)
|
Top
|
|
|
|
#170159 - 2006-11-08 09:27 PM
Re: Change Text on Dialog
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
If that is the case you will need to remove these 4 lines from the DoAntiVirus function: Code:
$LSD = @LServer + "\Netlogon" If Exist("$LSD\patches.kix") Call "$LSD\patches.kix" EndIf
after doing that, how does the script run, is it as expected?
|
Top
|
|
|
|
#170160 - 2006-11-08 09:37 PM
Re: Change Text on Dialog
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
Hi,
The jumbled text still occurs, the same seen in the video file I posted which should work now.
|
Top
|
|
|
|
#170161 - 2006-11-08 09:46 PM
Re: Change Text on Dialog
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
I have experienced strange graphics problems on my Vista machine as well, I have been testing your script on WinXP. Do you have a Win2k or WinXP machine you could test it on? Surely you don’t have any Vista machines in your production environment, with Vista not even being released, let alone Microsoft’s track record for bugs in the first 2 years of release. I would not even consider using it for testing a login script. On my WinXP machine the graphics are fine and runs as expected. I believe what you are seeing has to do with Vistas graphics problems.
|
Top
|
|
|
|
#170162 - 2006-11-08 09:53 PM
Re: Change Text on Dialog
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
The script is being run of Windows XP, I could try Win2K but it is a virtual machine. I won't deply it to the network until it has been fully sorted. Did I say anywhere that I was running it on Vista, because I pretty sure I didn't say I did, anyway.
|
Top
|
|
|
|
#170163 - 2006-11-08 10:08 PM
Re: Change Text on Dialog
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
in the .avi, the start button and taskbar clearly appears to be Vista, so i assumed it was being run on Vista. If it is being run on WinXP i apologize.
I have made a small change in the form, try this one to see if it performs as expected: Code:
;************************************************************ ;************************************************************ ;** ** ;** NetCare3.2 - D5PS2Z0J Login System ** ;** Netlogon.kix ** ;** D5PS2Z0J NetServices ** ;** ** ;** Dependencies: ** ;** Kixforms.dll Ver 2.46.54.0 ** ;** ** ;************************************************************ ;************************************************************
;************************** ;** Dim some global vars ** ;************************** Dim $frmForm Dim $fraBanner, $fraForm ;Dim $prgProgress Dim $Hour
;************************** ;** Set some global vars ** ;************************** $strVersion = "V.3.2.09" $LSD = @LServer + "\netlogon" $WaitTime = 1 ;** Time to wait after each task $Blanker = " " ;** Blank captions
;****************** ;** START HERE ** ;******************
CheckDLL()
;Create KiXforms Object $System = CreateObject("Kixtart.System") ;Verify KiXforms Object was created If Not $System $nul= MessageBox("KiXforms Not Initiated."+@CRLF+ "Please Verify KiXforms.dll is installed."+@CRLF+ "This Script Will Now Close.","Error...",16) Quit() EndIf
;*************** ;** Main form ** ;*************** $frmForm = $System.Form() $frmForm.Text = "NetCare3.2 - D5PS2Z0J Logon System " $frmForm.SysMenu = 0 $frmForm.Height = 300 $frmForm.Width = 450 $frmForm.FontName = "Verdana" $frmForm.FontSize = 9
;************* ;** Banner ** ;************* $fraBanner = $frmForm.Controls.Add("PictureBox") ;$fraBanner.Image = "C:\my projects\NetCare3\Images\NC32SM.gif" $fraBanner.BackColor = $frmForm.RGB(255,255,255) $fraBanner.Width = $frmForm.Width - 4 $fraBanner.Height = 60 $fraBanner.Left = -2 $fraBanner.Top = -2
;************************ ;** Draw On the banner ** ;************************ $fraBanner.FontSize = 14 $fraBanner.FontName = "verdana" $fraBanner.FontBold = 1 $fraBanner.FontItalic = 1 $fraBanner.ForeColor = $frmForm.RGB(0, 0, 200) $fraBanner.PrintXY (10,0,"Netlogon.kix") $fraBanner.FontItalic = 0 $fraBanner.FontSize = 8 $fraBanner.ForeColor = $frmForm.RGB(0,0,0) $fraBanner.PrintXY (10,24,$strVersion +" Powered by KiXforms (Shamil Nunhuck) ") $fraBanner.FontSize = 9 $fraBanner.PrintXY (10,35,"D5PS2Z0J NetServices") $fraBanner.FontBold = 0 $fraBanner.FontSize = 10
;****************** ;** Progress Bar ** ;****************** $prgProgress = $frmForm.Controls.Add("ProgressBar") $prgProgress.Width = $frmForm.Width - 10 $prgProgress.Left = 2 $prgProgress.Height = 20 $prgProgress.Top = 245;$frmForm.Height - $prgProgress.Height - 5 $prgProgress.Style = 1
;**************** ;** Main Frame ** ;**************** $fraMain = $frmForm.Controls.Add("PictureBox") $fraMain.BackColor = $frmForm.RGB(255,255,255) $fraMain.Width = $frmForm.Width $fraMain.Height = 182 ;$frmForm.Height - $fraBanner.Height - 35 $fraMain.Left = -2 $fraMain.Top = $fraBanner.Height - 5
$lblJob = $fraMain.Controls.Add("label") $lblJob.FontSize = 10 $lblJob.Top = 80 $lblJob.Width = 440 ;fraMain.Width - 20 $lblJob.Left = 10
$lblTask = $fraMain.Controls.Add("label") $lblTask.FontSize = 10 $lblTask.Top = 120 $lblTask.Width = 440 ;fraMain.Width - 20 $lblTask.Left = 50
;*********************** ;** Draw on the frame ** ;** Greeting ** ;*********************** $Hour = Val(Trim(Left(@Time,2))) If $Hour < 12 $Greeting = "Good Morning @userid " Else If $Hour < 17 $Greeting = "Good Afternoon @userid" Else $Greeting = "Good Evening @userid " EndIf EndIf $fraMain.FontSize = 11 $fraMain.FontName = "verdana" $fraMain.FontBold = 1 $fraMain.ForeColor = $frmForm.RGB(0,100,100) $fraMain.PrintXY (10,10,$Greeting)
$fraMainLabel = $fraMain.Controls.Add("Label") $fraMainLabel.BackColor = $frmForm.RGB(255,255,255) $fraMainLabel.FontSize = 11 $fraMainLabel.FontBold = 1 $fraMainLabel.ForeColor = $frmForm.RGB(0,100,100) $fraMainLabel.Left = 10 $fraMainLabel.Text = "Please wait while you logon script executes..." $fraMainLabel.Top = 40 $fraMainLabel.Width = $frmForm.Width
$frmForm.Center $frmForm.Show
Prep() MapDrives() DoAudit() LogUser() DoAntiVirus() Time() Snd()
Sleep 2 $fraMainLabel.Text = "Logon has been successful." Sleep 2 ExitScript()
While $frmForm.Visible $=Execute($frmForm.DoEvents()) Loop Exit 0
;******************* ;** End Main Form ** ;*******************
Function CheckDLL() ;************************************************* ;** Check that KIXFORMS.DLL is registered and ** ;** copy and register if not ** ;************************************************* ;$ReturnCode = KeyExist("HKEY_CLASSES_ROOT\KixTart.Form\CLSID") $ReturnCode = KeyExist("HKEY_CLASSES_ROOT\Kixtart.System\CLSID") If $ReturnCode = 0 ;** KixForms not registered ;** Copy .DLL $SourceFile = @LServer + "\netlogon\kixforms.dll" $Value = ReadValue("HKLM\System\CurrentControlset\Control\Windows", "SystemDirectory") $Destination = ExpandEnvironmentVars($Value) Copy $SourceFile $Destination ;** Register .DLL silently $CMDLine = "regsvr32 /s " + $Destination + "\kixforms.dll" $ObjShell = CreateObject("WScript.Shell") $ObjShell.run($CMDLine, 1, true) ;** Kill shell object $ObjShell = "" EndIf ;** Wait for registration to take effect Sleep 2 EndFunction
Function DoProgress($Step) $prgProgress.Value = $prgProgress.Value + $Step EndFunction
Function Prep() $lblJob.Text = $Blanker $lblJob.Text = "Preparing for logon" Sleep 1 EndFunction
Function MapDrives() $lblJob.Text = $Blanker $lblJob.Text = "Mapping Network Drives... " Use * /DELETE
;** Common mappings: Everyone gets these **
Sleep $WaitTime DoProgress(5)
$DriveToMap = "\\d5ps2z0j\PUBLIC" $lblTask.Text = $Blanker $lblTask.Text = "Public" Use L: $DriveToMap DoProgress(5)
$DriveToMap = "\\d5ps2z0j\netlogon" $lblTask.Text = $Blanker $lblTask.Text = "netlogon" Use N: $DriveToMap DoProgress(5) $DriveToMap = "\\d5ps2z0j\cache" $lblTask.Text = "SmartCache" Use S: $DriveToMap DoProgress(5) EndFunction
Function DoAudit() $fraMain.fontsize = 10 $lblJob.Text = $Blanker $lblJob.Text = "Running Workstation Audit... " ;AUDIT STUFF IN HERE ; ;Audit what???? ; ; Hardware: (Check for changes?) ; Installed Software (Check for changes?) $lblTask.Text = $Blanker $lblTask.Text = "Hardware" Sleep $WaitTime DoProgress(20) $lblTask.Text = $Blanker $lblTask.Text = "Software" Sleep $WaitTime DoProgress(20) EndFunction
Function LogUser() $lblJob.caption = $Blanker $lblJob.caption = "Collecting Logon Info... " DoProgress(10) ;** Dim some vars $LogFolder = @LServer + "\netlogon\logs\" ;** Path to log dir $FileName = @MONTH + "--" + @WKSTA + ".csv"
;** Get Log File Name $MyFile = $LogFolder + $FileName
;** Set full path to file $CRLF= Chr(13) + Chr(10)
;** Set Carriage Return + Line feed $MyDateTime = @DATE + " : " + @TIME
;** Date and time string DoProgress(10) If Open(1,$MyFile,5) = 0 ;** Open file for write. Create if doesn't exist ;** Date And time $Silent = WriteLine (1, $MyDateTime + $CRLF) $lblTask.Caption = $Blanker $lblTask.Caption = "Time and Date" Sleep $WaitTime DoProgress(10) ;** User Details $Silent = WriteLine (1, "User: " + @USERID + " Full Name: " + @FULLNAME + $CRLF);Write data to file $lblTask.Caption = $Blanker $lblTask.Caption = "User Name" Sleep $WaitTime DoProgress(10) ;** IP 0 $Silent = WriteLine (1, "IP: " + @IPAddress0 + $CRLF) $lblTask.Caption = $Blanker $lblTask.Caption = "IP Address" Sleep $WaitTime DoProgress(10) $Silent = WriteLine (1, $CRLF) $Silent = Close (1) ;Close file EndIf ; Sleep 1 EndFunction
Function DoAntiVirus() $lblJob.Text = $Blanker $lblJob.Text = "Updating Antivirus... " $lblTask.Text = $Blanker DoProgress(5) EndFunction
Function Time() ;======= Sync Time with Domain Controller $lblJob.Text = $Blanker $lblJob.Text = "Synchronizing time " If Exist ("$LSD\TimeSync.bat") Shell "$COMSPEC /e:1024 /c $LSD\TimeSync.bat" EndIf EndFunction
Function Snd() $lblJob.Text = $Blanker $lblJob.Text = "Logon has been successful" Play @ldrive+"chimes.wav" Sleep 2 DoProgress(5) EndFunction
Function ExitScript() Quit() EndFunction
;***************** ;** End of File ** ;*****************
Edited by Benny69 (2006-11-08 10:11 PM)
|
Top
|
|
|
|
#170164 - 2006-11-09 06:10 PM
Re: Change Text on Dialog
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
It works exactly fine now. Thak you so much, you help and assistance in this matter is greatly appreciated. I am sorry for the inconvenience caused and about the Vista theme on the computer, I recently changed it. Is there any method of reward for you benny69?
|
Top
|
|
|
|
#170165 - 2006-11-09 06:18 PM
Re: Change Text on Dialog
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
04nunhucks, Glad I could help. You learning KiXtart and KiXforms scripting is reward enough.
|
Top
|
|
|
|
#170166 - 2006-11-09 07:59 PM
Re: Change Text on Dialog
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
Thank you
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 507 anonymous users online.
|
|
|