04nunhucks
(Getting the hang of it)
2006-09-08 11:16 PM
Login Scripts

Hi, I am very new to Kix scripting; and I need a lot of help with a login system I will be using on a network. Everytime I run the script I recieve:

Script Error: unknown command !
$fromForm.Caption = " (System) Login"

system is the name of the network

Here is the whole sript in full:
Code:
   
;***************************************************************
;***************************************************************
;**
;** Network Login
;** Netlogon.kix
;**
;** Dependencies:
;**
;** Kixforms.dll
;**
;** V.3.2.01 28/12/2004
;** V.3.2.02 13/01/2005 Check for and register .DLL
;** V.3.2.03 14/01/2005 Map network drives
;** V.3.2.04 15/01/2005 Log user/station details
;** V.3.2.05 26/02/2005 Fixed problem with incorrect drive mapping displayed
;** V.3.2.06 26/02/2005 Removed display name from greeting
;** V.3.2.07 20/03/2005 Added AV call for Somerset sites
;** V.3.2.08 07/04/2005 Added RegFixes section. Checkfor and install KB888254
;** V.3.2.09 24/05/2005 Split into seperate scripts
;**
$strVersion = "V.3.2.09(b)"
;**
;***************************************************************
;***************************************************************

;** Dim some global vars.

Dim $frmForm
Dim $fraBanner, $fraForm
;Dim $prgProgress
Dim $Hour

;** Set some global vars.

$LSD = @LServer + "\netlogon"
$WaitTime = 1 ;** Time to wait after each task
$DoProgressCalls = 25 ;** Maximum times DoProgress is called
$Step = 100/$DoProgressCalls ;** Increment progress bar
$Blanker = " " ;** Blank captions

;****************
;** START HERE **
;***************

Gosub "CheckDLL"
Gosub "DOFORM"

$frmForm.Show

Call "$LSD\MapDrives.kix"

EXIT 1

;*************
;**END HERE **
;*************


;*************************************************************
;** SUBS BELOW **
;*************************************************************


:CheckDLL

;*****************************************
;** Check that KIXFORMS.DLL is registered and **
;** copy and register if not **
;*****************************************

$ReturnCode = KEYEXIST("HKEY_CLASSES_ROOT\KixTart.Form\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 = nothing
ENDIF
;** Wait for registration to take effect
sleep 2
RETURN

:DoProgress

$prgProgress.value = $prgProgress.value + $Step

Return

:DOFORM

;***************
;** Main form **
;***************
$frmForm = CREATEOBJECT("Kixtart.FORM")
$frmForm.Caption = " system Login"
$frmForm.sysMenu = 0
$frmForm.Height = 300
$frmForm.Width = 450
$frmForm.FontName = "Verdana"
$frmForm.FontSize = 9
$frmForm.center


;*************
;** Banner **
;*************
$fraBanner = $frmForm.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, 192)
$fraBanner.PrintXY (10,0,"NetLogon 3.2 : Netlogon.kix")
$fraBanner.FontItalic = 0
$fraBanner.FONTSIZE = 8
$fraBanner.ForeColor = $frmForm.RGB(0,100,100)
$fraBanner.PrintXY (10,20,$strVersion + " Powered by Kixforms ")
$fraBanner.FONTSIZE = 9
$fraBanner.PrintXY (10,35,"D5PS2Z0J Systems")
$fraBanner.FONTBOLD = 0
$fraBanner.FONTSIZE = 10

;******************
;** Progress Bar **
;******************
$prgProgress = $frmForm.ProgressBar
$prgProgress.width = $frmForm.width - 10
$prgProgress.left = 2
$prgProgress.height = 20
$prgProgress.top = 245;$frmForm.height - $prgProgress.height - 5
$prgProgress.style = 0

;****************
;** Main Frame **
;****************
$fraMain = $frmForm.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.label
$lblJob.FONTSIZE = 10
$lblJob.top = 80
$lblJob.width = 440 ;fraMain.width - 20
$lblJob.left = 10

$lblTask = $fraMain.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 "
else
if $Hour < 17
$Greeting = "Good Afternoon "
else
$Greeting = "Good Evening "
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 your logon script executes...")



Return


;*******************************
;*******************************
;** END OF FILE **
;*******************************
;*******************************


Sorry if my reply may be slow; my moden suffered a power surge and I am back on dial-up for the time!



04nunhucks@gmail.com


LonkeroAdministrator
(KiX Master Guru)
2006-09-08 11:30 PM
Re: Login Scripts

well, with above code the error you gave just ain't possible as there is no such line in the script.

may I ask, why do you shell with wscript and not directly with kixtart shell?


Sealeopard
(KiX Master)
2006-09-09 06:33 AM
Re: Login Scripts

You realize the the KiXforms install requires local admin rights? Thus your suers would all have to be local admins.

Benny69
(MM club member)
2006-09-09 07:22 AM
Re: Login Scripts

Hi 04nunhucks and Welcome to KiXtart.org and KiXforms,

Just a few small suggestions;

It is better to create separate Functions rather then using ‘Goto/Return’ statements.

"Kixtart.Form" has been replaced with "Kixtart.System".

Once the ‘$System’ object has been created it is a good idea to verify that it was actually created, so that if it was not created then you will know that there is a problem with the install and or functionality of KiXforms.

For the form to function you must have a loop for the doevents() of the form.

Also what ver of KiXforms are you using?
You can get the most current ver over at KiXforms.org

This is your script/form with the modifications:

Code:

;***************************************************************
;***************************************************************
;**
;** Network Login
;** Netlogon.kix
;**
;** Dependencies:
;**
;** Kixforms.dll
;**
;** V.3.2.01 28/12/2004
;** V.3.2.02 13/01/2005 Check for and register .DLL
;** V.3.2.03 14/01/2005 Map network drives
;** V.3.2.04 15/01/2005 Log user/station details
;** V.3.2.05 26/02/2005 Fixed problem with incorrect drive mapping displayed
;** V.3.2.06 26/02/2005 Removed display name from greeting
;** V.3.2.07 20/03/2005 Added AV call for Somerset sites
;** V.3.2.08 07/04/2005 Added RegFixes section. Checkfor and install KB888254
;** V.3.2.09 24/05/2005 Split into seperate scripts
;**
$strVersion = "V.3.2.09(b)"
;**
;***************************************************************
;***************************************************************

;** Dim some global vars.

Dim $frmForm
Dim $fraBanner, $fraForm
;Dim $prgProgress
Dim $Hour

;** Set some global vars.

$LSD = @LServer + "\netlogon"
$WaitTime = 1 ;** Time to wait after each task
$DoProgressCalls = 25 ;** Maximum times DoProgress is called
$Step = 100/$DoProgressCalls ;** Increment progress bar
$Blanker = " " ;** Blank captions

;******************
;** START HERE **
;******************

CheckDLL()
DOFORM()

Call "$LSD\MapDrives.kix"

Exit 1

;**************
;**END HERE **
;**************


;*************************************************************
;** SUBS BELOW **
;*************************************************************


Function CheckDLL()

;*************************************************
;** Check that KIXFORMS.DLL is registered and **
;** copy and register if not **
;*************************************************

$ReturnCode = KeyExist("HKEY_CLASSES_ROOT\KixTart.Form\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 = nothing
EndIf
;** Wait for registration to take effect
Sleep 2

EndFunction

Function DoProgress()

$prgProgress.value = $prgProgress.value + $Step

EndFunction

Function DOFORM()

;***************
;** Main form **
;***************

Break On
$System = CreateObject("Kixtart.System")
If Not $System
$nul= MessageBox("KiXforms Not Initiated. This Script Will Now Close.","Error",16)
Quit()
EndIf

$frmForm = $System.Form()
$frmForm.Text = " system Login"
$frmForm.sysMenu = 0
$frmForm.Height = 300
$frmForm.Width = 450
$frmForm.FontName = "Verdana"
$frmForm.FontSize = 9

;*************
;** Banner **
;*************
$fraBanner = $frmForm.Controls.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, 192)
$fraBanner.PrintXY (10,0,"NetLogon 3.2 : Netlogon.kix")
$fraBanner.FontItalic = 0
$fraBanner.FONTSIZE = 8
$fraBanner.ForeColor = $frmForm.RGB(0,100,100)
$fraBanner.PrintXY (10,20,$strVersion + " Powered by Kixforms ")
$fraBanner.FONTSIZE = 9
$fraBanner.PrintXY (10,35,"D5PS2Z0J Systems")
$fraBanner.FONTBOLD = 0
$fraBanner.FONTSIZE = 10

;******************
;** Progress Bar **
;******************
$prgProgress = $frmForm.Controls.ProgressBar()
$prgProgress.width = $frmForm.width - 10
$prgProgress.left = 2
$prgProgress.height = 20
$prgProgress.top = 245;$frmForm.height - $prgProgress.height - 5
$prgProgress.style = 0

;****************
;** Main Frame **
;****************
$fraMain = $frmForm.Controls.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.label()
$lblJob.FONTSIZE = 10
$lblJob.top = 80
$lblJob.width = 440 ;fraMain.width - 20
$lblJob.left = 10

$lblTask = $fraMain.Controls.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 "
Else
If $Hour < 17
$Greeting = "Good Afternoon "
Else
$Greeting = "Good Evening "
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 your logon script executes...")

$frmForm.center
$frmForm.Show

While $frmForm.visible
$= Execute($frmForm.doevents())
Loop

EndFunction

;*******************************
;*******************************
;** END OF FILE **
;*******************************
;*******************************



Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)


04nunhucks
(Getting the hang of it)
2006-09-10 08:02 PM
Re: Login Scripts

Hi, my users are local admins and thank you for the welcomes. The version of Kixforms I am using is 4.53.0.0 RC1. When I use the modification above I recieve the error message "KiXforms Not Initiated. This Script Will Now Close."
Is system meant to be the NetBIOS?- I guess not, either way I get the message way (substituting system for NetBIOS name)


Gargoyle
(MM club member)
2006-09-10 08:10 PM
Re: Login Scripts

The error that you are getting is telling you that KixForms is not installed on that machine.

Code:

Function CheckDLL()

;*************************************************
;** Check that KIXFORMS.DLL is registered and **
;** copy and register if not **
;*************************************************

$ReturnCode = KeyExist("HKEY_CLASSES_ROOT\KixTart.Form\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 = nothing
EndIf
;** Wait for registration to take effect
Sleep 2

EndFunction


This will try to install the KiXForms DLL for you, but if you do not have it located in this specified locations
Quote:

$SourceFile = @LServer + "\netlogon\kixforms.dll"


It will not be able to install it for you.


04nunhucks
(Getting the hang of it)
2006-09-10 08:12 PM
Re: Login Scripts

Jooel:may I ask, why do you shell with wscript and not directly with kixtart shell?

I dont have a definate reason for that question.


04nunhucks
(Getting the hang of it)
2006-09-10 08:18 PM
Re: Login Scripts

Hi gargoyle, this is the error

Expected ")"

Line 122


Gargoyle
(MM club member)
2006-09-10 08:25 PM
Re: Login Scripts

And what is Line 122?

04nunhucks
(Getting the hang of it)
2006-09-10 08:32 PM
Re: Login Scripts

There is this line:$fraBanner.WIDTH = $frmForm.width - 4 in the banner section. there is a line in grey at the top:
" system Login0300450Verdana9"


Benny69
(MM club member)
2006-09-10 08:54 PM
Re: Login Scripts

04nunhucks,
Quote:


The version of Kixforms I am using is 4.53.0.0 RC1




This is the ver of KiXtart not the ver of KiXforms.

What is the line just above ‘$fraBanner.WIDTH = $frmForm.width - 4’


04nunhucks
(Getting the hang of it)
2006-09-10 09:03 PM
Re: Login Scripts

version is 4.3.0.45
Line abover is:$fraBanner.BACKCOLOR = $frmForm.RGB(255,255,255)

Code:
 ;***************************************************************
;***************************************************************
;**
;** Network Login
;** Netlogon.kix
;**
;** Dependencies:
;**
;** Kixforms.dll
;**
;** V.3.2.01 28/12/2004
;** V.3.2.02 13/01/2005 Check for and register .DLL
;** V.3.2.03 14/01/2005 Map network drives
;** V.3.2.04 15/01/2005 Log user/station details
;** V.3.2.05 26/02/2005 Fixed problem with incorrect drive mapping displayed
;** V.3.2.06 26/02/2005 Removed display name from greeting
;** V.3.2.07 20/03/2005 Added AV call for Somerset sites
;** V.3.2.08 07/04/2005 Added RegFixes section. Checkfor and install KB888254
;** V.3.2.09 24/05/2005 Split into seperate scripts
;**
$strVersion = "V.3.2.09(b)"
;**
;***************************************************************
;***************************************************************

;** Dim some global vars.

Dim $frmForm
Dim $fraBanner, $fraForm
;Dim $prgProgress
Dim $Hour

;** Set some global vars.

$LSD = @LServer + "\netlogon"
$WaitTime = 1 ;** Time to wait after each task
$DoProgressCalls = 25 ;** Maximum times DoProgress is called
$Step = 100/$DoProgressCalls ;** Increment progress bar
$Blanker = " " ;** Blank captions

;******************
;** START HERE **
;******************

CheckDLL()
DOFORM()

Call "$LSD\MapDrives.kix"

Exit 1

;**************
;**END HERE **
;**************


;*************************************************************
;** SUBS BELOW **
;*************************************************************


Function CheckDLL()

;*************************************************
;** Check that KIXFORMS.DLL is registered and **
;** copy and register if not **
;*************************************************

$ReturnCode = KeyExist("HKEY_CLASSES_ROOT\KixTart.Form\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 = nothing
EndIf
;** Wait for registration to take effect
Sleep 2

EndFunction

Function DoProgress()

$prgProgress.value = $prgProgress.value + $Step

EndFunction

Function DOFORM()

;***************
;** Main form **
;***************

Break On
$system = CreateObject("Kixtart.System")
If Not $system
$nul= MessageBox("KiXforms Not Initiated. This Script Will Now Close.","Error",16)
Quit()
EndIf

$frmForm = $System.Form()
$frmForm.Text = " system Login"
$frmForm.sysMenu = 0
$frmForm.Height = 300
$frmForm.Width = 450
$frmForm.FontName = "Verdana"
$frmForm.FontSize = 9

;*************
;** Banner **
;*************
$fraBanner = $frmForm.Controls.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, 192)
$fraBanner.PrintXY (10,0,"NetLogon 3.2 : Netlogon.kix")
$fraBanner.FontItalic = 0
$fraBanner.FONTSIZE = 8
$fraBanner.ForeColor = $frmForm.RGB(0,100,100)
$fraBanner.PrintXY (10,20,$strVersion + " Powered by Kixforms ")
$fraBanner.FONTSIZE = 9
$fraBanner.PrintXY (10,35,"D5PS2Z0J Systems")
$fraBanner.FONTBOLD = 0
$fraBanner.FONTSIZE = 10

;******************
;** Progress Bar **
;******************
$prgProgress = $frmForm.Controls.ProgressBar()
$prgProgress.width = $frmForm.width - 10
$prgProgress.left = 2
$prgProgress.height = 20
$prgProgress.top = 245;$frmForm.height - $prgProgress.height - 5
$prgProgress.style = 0

;****************
;** Main Frame **
;****************
$fraMain = $frmForm.Controls.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.label()
$lblJob.FONTSIZE = 10
$lblJob.top = 80
$lblJob.width = 440 ;fraMain.width - 20
$lblJob.left = 10

$lblTask = $fraMain.Controls.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 "
Else
If $Hour < 17
$Greeting = "Good Afternoon "
Else
$Greeting = "Good Evening "
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 your logon script executes...")

$frmForm.center
$frmForm.Show

While $frmForm.visible
$= Execute($frmForm.doevents())
Loop

EndFunction

;*******************************
;*******************************
;** END OF FILE **
;*******************************
;*******************************



Benny69
(MM club member)
2006-09-10 09:22 PM
Re: Login Scripts

[Quote]
version is 4.3.0.45




This is unlikely since the newest ver is ‘2.46.55.0’ of KiXforms.classic

Use these two lines to tell what ver of KiXforms you have installed.

Code:

$system = CreateObject("Kixtart.System")
? $system.Version



And do not get this error when I run the form, the code is good.


04nunhucks
(Getting the hang of it)
2006-09-11 10:18 PM
Re: Login Scripts

Hi,
I resolved the problem with the Expected ")" at line 122, but now when I run the script,The dialog stays as it is not doing anything. could there be an error in the MaptoDrive scipt.:
Code:
;************************************************
;** MapDrives.kix D5PS2Z0J Systems **
;** **
;** 25/05/2005 V1.00 **
;** **
;************************************************

$lblJob.caption = $Blanker
$lblJob.caption = "Mapping Network Drives... "

USE * /DELETE

;** Common mappings: Everyone gets these **

Sleep $WaitTime
$prgProgress.value = $prgProgress.value + 5

$DriveToMap = "\\d5ps2z0j\resources"
$lblTask.Caption = $Blanker
$lblTask.Caption = $DriveToMap
USE L: $DriveToMap
$prgProgress.value = $prgProgress.value + 5



; RETURN



It is 2.3.0.45


LonkeroAdministrator
(KiX Master Guru)
2006-09-11 10:21 PM
Re: Login Scripts

nope.
no such problem there.


04nunhucks
(Getting the hang of it)
2006-09-11 10:24 PM
Re: Login Scripts

I have just downloaded and installed KixForms 2.46.55.0 (development build) this may help.

04nunhucks
(Getting the hang of it)
2006-09-12 05:30 PM
Re: Login Scripts

Hi,
I have tried everything, but the script won't work. This is what I get. It stays like this and does not continue [image]http://www.freewebs.com/inetwise/netlogon2.bmp[/image]


LonkeroAdministrator
(KiX Master Guru)
2006-09-12 06:03 PM
Re: Login Scripts

yes...
because doevents() does hold your script until the form is closed.
instead of using that, you could use either doevents(1) (not sure that's the correct number anymore) or add timer code.


04nunhucks
(Getting the hang of it)
2006-09-12 10:41 PM
Re: Login Scripts

But what about it not doing anything? Thanks jooel

LonkeroAdministrator
(KiX Master Guru)
2006-09-12 11:07 PM
Re: Login Scripts

I may have not said it clearly enough.
your code is doing something all the time:
Code:

While $frmForm.visible
$= Execute($frmForm.doevents())
Loop


this part of code above makes your script loop inside the while-loop as long as the form is visible.
so, it does do something, it loops. just as you asked it to, with the code.


04nunhucks
(Getting the hang of it)
2006-10-03 02:01 PM
Re: Login Scripts

Hi, sorry about not replying for a while, the psu died. I will keep new events posted with the script and notify should anything develop.

04nunhucks
(Getting the hang of it)
2006-11-06 10:17 PM
Re: Login Scripts

Hi,

I have solved it by using the original and editing it from there, it now looks like this:

Code:
;***************************************************************
;***************************************************************
;**
;** NetCare3.2 - D5PS2Z0J Login System
;** Netlogon.kix
;** D5PS2Z0J NetServices
;**
;** Dependencies:
;**
;** Kixforms.dll
;**
;**
$strVersion = "V.3.2.09"
;**
;***************************************************************
;***************************************************************

;** Dim some global vars.

Dim $frmForm
Dim $fraBanner, $fraForm
;Dim $prgProgress
Dim $Hour

;** Set some global vars.

$LSD = @LServer + "\netlogon"
$WaitTime = 1 ;** Time to wait after each task
$DoProgressCalls = 25 ;** Maximum times DoProgress is called
$Step = 100/$DoProgressCalls ;** Increment progress bar
$Blanker = " " ;** Blank captions

;****************
;** START HERE **
;***************

Gosub "CheckDLL"
Gosub "DOFORM"

$frmForm.Show
Call "$LSD\prep.kix"
Call "$LSD\MapDrives.kix"
Call "$LSD\DoAudit.kix"
Call "$LSD\LogUser.kix"
Call "$LSD\DoAntiVirus.kix"
Call "$LSD\time.kix"
Call "$LSD\snd.kix"
Exit 1

;*************
;**END HERE **
;*************


;*************************************************************
;** SUBS BELOW **
;*************************************************************


:CheckDLL

;*****************************************
;** Check that KIXFORMS.DLL is registered and **
;** copy and register if not **
;*****************************************

$ReturnCode = KEYEXIST("HKEY_CLASSES_ROOT\KixTart.Form\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 = nothing
ENDIF
;** Wait for registration to take effect
sleep 2
RETURN

:DoProgress

$prgProgress.value = $prgProgress.value + $Step

Return

:DOFORM

;***************
;** Main form **
;***************
$frmForm = CREATEOBJECT("Kixtart.FORM")
$frmForm.Caption = ("NetCare3.2 - D5PS2Z0J Logon System ")
$frmForm.sysMenu = 0
$frmForm.Height = 300
$frmForm.Width = 450
$frmForm.FontName = "Verdana"
$frmForm.FontSize = 9
$frmForm.center


;*************
;** Banner **
;*************
$fraBanner = $frmForm.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.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.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.label
$lblJob.FONTSIZE = 10
$lblJob.top = 80
$lblJob.width = 440 ;fraMain.width - 20
$lblJob.left = 10

$lblTask = $fraMain.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 your logon script executes...")



Return



;*******************************
;*******************************
;** END OF FILE **
;*******************************
;*******************************