#41014 - 2003-06-04 09:54 AM
Re: Using Kixforms
|
Grasshopper75
Getting the hang of it
Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
|
I can't take credit for this as we found it on the web somewhere.. cant remember where now, but have modified it to do what you are want it for. We have the same thing and it works well.
code:
;**************************************************************************
;--------------------------------------------------------------------------- ; Determine if computer is a server or workstation. Assign script functions ; to execute. ;--------------------------------------------------------------------------- If InStr(@PRODUCTTYPE,"Server") OR InStr(@PRODUCTTYPE,"Domain Controler") ; If a server, we only want to map the user's network drives $FuncToExecute=Split("fnScrFunc1,fnScrFunc2",",") Else $FuncToExecute=Split("fnScrFunc1,fnScrFunc2,fnScrFunc3,fnScrFunc4",",") EndIf
;--------------------------------------------------------------------------- ; Instantiate KiXforms. ;--------------------------------------------------------------------------- ; Creating a 'Root' form that is never made visible allows us to hide the ; other forms from the taskbar. $frmRoot = CreateObject("Kixtart.Form") If @ERROR $nul=SetConsole("Show") ? "KiXforms.dll not installed/registered" Exit(1) EndIf
;--------------------------------------------------------------------------- ; Main Form ;--------------------------------------------------------------------------- $frmMain = CreateObject("Kixtart.Form") $frmMain.Size = 320,108 $frmMain.SysMenu = 0 ; Disable the sysmenu. Prevents users from closing forms $frmMain.Text = "@DOMAIN Domain logon script" $frmMain.Top = 605 $frmMain.Left = 680
;--------------------------------------------------------------------------- ; Logon Status and ProgressBar ;--------------------------------------------------------------------------- $fraStatus = $frmMain.Frame $fraStatus.Size = 280,70 $fraStatus.Center $fraStatus.Top = $fraUser.Bottom + 5 $fraStatus.Text = "Logon Progress:" $lblStatus = $fraStatus.Label("Processing logonscript...",10,20,260,20) $prgStatus = $fraStatus.ProgressBar $prgStatus.Size = 260,20 $prgStatus.Center $prgStatus.Top = $lblStatus.Bottom
;--------------------------------------------------------------------------- ; Function Status and ProgressBar Form ;--------------------------------------------------------------------------- $frmFuncStatus = CreateObject("Kixtart.Form") $frmFuncStatus.Size = 300,80 $frmFuncStatus.Center $frmFuncStatus.Top = $frmFuncStatus.Top + ($frmMain.Height/2)+50 $frmFuncStatus.SysMenu = 0 ; Disable the sysmenu. Prevents users from closing forms $frmFuncStatus.Text = "Processing function..." $lblFuncStatus = $frmFuncStatus.Label("Processing function...") $lblFuncStatus.Size = 280,20 $lblFuncStatus.Center $lblFuncStatus.Top = 5 $prgFuncStatus = $frmFuncStatus.ProgressBar $prgFuncStatus.Size = 280,20 $prgFuncStatus.Center $prgFuncStatus.Top = $lblFuncStatus.Bottom
;--------------------------------------------------------------------------- ; Execute Script Functions ;--------------------------------------------------------------------------- $frmLogo.Show $frmMain.Show $prgStatus.Max = Ubound($FuncToExecute)+1 For Each $sFunction In $FuncToExecute $prgStatus.Value = $prgStatus.Value+1 $nul=Execute($sFunction) Sleep 1 Next Exit()
;--------------------------------------------------------------------------- ; Script Functions ;--------------------------------------------------------------------------- Function fnScrFunc1() ; User Logon Greeting $hour = Val(SubStr(@TIME,1,2)) Select Case $hour < 12 $Greeting = "Good Morning" Case $hour < 18 $Greeting = "Good Afternoon" Case 1 $Greeting = "Good Evening" EndSelect $lblStatus.Text = $Greeting + " " + @FULLNAME Sleep 1 ; Sync time with logon server $lblStatus.Text = "Synchronizing time with @LServer..." Sleep 1 SetTime @LServer $lblStatus.Text = "Current time: "+@Time Sleep 1 EndFunction
Just keep adding functions to the end of it. You can specify which functions to run on the servers and which to run on the workstations.
Grasshopper75
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|