#41010 - 2003-06-04 12:02 AM
Using Kixforms
|
Bob Deerinwater
Starting to like KiXtart
Registered: 2002-05-05
Posts: 101
Loc: Covina California
|
I am trying to have a progress bar start in one of my scripts. The thing is that i do not want to have to use a button to start it.I would like it to start automatically. I have search the kixforms forums and other places and i still do not understand this. Here is the Code code:
Break On
$frmForm = CreateObject("Kixtart.Form") $frmForm.Width = 320 $frmForm.Height = 100 $frmForm.Caption = "Backup In Progress" $frmForm.Center
$prgProgressBar1 = $frmForm.ProgressBar("",10,10,294,20)
$frmForm.Show
While $frmForm.Visible $=Execute($frmForm.DoEvents()) Loop
Exit 1
Function fnCommandButton1_Click() $cmdCommandButton1.Enabled = False For $lProgress = 0 to 100 $prgProgressBar1.Value = $lProgress Sleep 0.1 Next $cmdCommandButton1.Enabled = True EndFunction
|
|
Top
|
|
|
|
#41012 - 2003-06-04 01:50 AM
Re: Using Kixforms
|
Bob Deerinwater
Starting to like KiXtart
Registered: 2002-05-05
Posts: 101
Loc: Covina California
|
Your right therei s no real life reason for this progress bar. But my boss would like something on the screen moving so the user thinks something is happening. i het this to work with a command button. but i would like no user input just to start the progress bar. and then when the script ends it wil close automatically
|
|
Top
|
|
|
|
#41013 - 2003-06-04 06:59 AM
Re: Using Kixforms
|
Bob Deerinwater
Starting to like KiXtart
Registered: 2002-05-05
Posts: 101
Loc: Covina California
|
Never Mind i uses the AT command and to set text on screen for what the script was doing seems to be easier than figuring out kixforms Thanks Anyways
|
|
Top
|
|
|
|
#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
|
|
|
|
#41015 - 2003-06-04 09:59 AM
Re: Using Kixforms
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Grasshopper...
Did not debug or test your script, but I did see right off the bat at least one issue.
You spelled CONTROLLER wrong.
quote: If InStr(@PRODUCTTYPE,"Server") OR InStr(@PRODUCTTYPE,"Domain Controler")
There are 2 LL in CONTROLLER
"Windows NT Domain Controller" "Windows 2000 Domain Controller" "Windows Server 2003 Domain Controller"
ETC...
|
|
Top
|
|
|
|
#41016 - 2003-06-04 10:08 AM
Re: Using Kixforms
|
Grasshopper75
Getting the hang of it
Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
|
Gee.. have never seen that.. nice work
|
|
Top
|
|
|
|
#41018 - 2003-06-04 02:02 PM
Re: Using Kixforms
|
Grasshopper75
Getting the hang of it
Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
|
Its just so that the name and time is displayed for a short period so you can actually read it. Its all cosmetic, it does not have to be there.
|
|
Top
|
|
|
|
#41020 - 2003-06-04 05:12 PM
Re: Using Kixforms
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Done.
See KiXforms Logonscript Sample for the ammended sample.
|
|
Top
|
|
|
|
#41021 - 2003-06-04 05:23 PM
Re: Using Kixforms
|
Grasshopper75
Getting the hang of it
Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
|
Chris, I found your website long ago and could never find it again. Mate, I can now give you the credit for the script. Thanks mate.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1452 anonymous users online.
|
|
|