Page 1 of 1 1
Topic Options
#41010 - 2003-06-04 12:02 AM Using Kixforms
Bob Deerinwater Offline
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
#41011 - 2003-06-04 12:28 AM Re: Using Kixforms
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
progressbar indeed starts from zero.
it indicates a progress and it's execution.

thus, once you start a progress execution you can make it to be say 1%.
and when it's finished it's 100%

it's not about time, it's time about your progress.
if you want to create a progressbar similar to your example, it has no actual meaning, but you can start it automatically by calling it's increase in the doevents-loop or by using .timer-object

what you are actually using this for?
as said earlier, your example prototype does not have any good reallife usage
_________________________
!

download KiXnet

Top
#41012 - 2003-06-04 01:50 AM Re: Using Kixforms
Bob Deerinwater Offline
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 Offline
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 Offline
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 Offline
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 Offline
Getting the hang of it

Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
Gee.. have never seen that.. nice work [Smile]
Top
#41017 - 2003-06-05 12:52 AM Re: Using Kixforms
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
1 second sleep between the functions is unneccessary.
the functions anyway take some time so why delay the processing even more?
_________________________
!

download KiXnet

Top
#41018 - 2003-06-04 02:02 PM Re: Using Kixforms
Grasshopper75 Offline
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
#41019 - 2003-06-04 05:06 PM Re: Using Kixforms
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
That misspelled "controller" thingy is my fault. My KiXforms logonscript sample script has it spelled wrong. I need to correct that.

Me mark: DONE

[ 04. June 2003, 17:11: Message edited by: Chris S. ]

Top
#41020 - 2003-06-04 05:12 PM Re: Using Kixforms
Chris S. Offline
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 Offline
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. [Big Grin]
Top
#41022 - 2003-06-04 05:32 PM Re: Using Kixforms
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I'm glad people are finding it useful. The sample is actually modeled after the loginscript sample written for the defunct(?) KiXGUI object written by Alex H.
Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.067 seconds in which 0.027 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