Page 1 of 1 1
Topic Options
#152639 - 2005-12-01 12:01 PM Loginscript with progressbar
JoosTy Offline
Fresh Scripter

Registered: 2005-11-21
Posts: 11
Hi All..

I want to add a Progressbar to my Loginscript.

Can You explane it in this exemple:

Code:

Break On Cls ;- Remove CLS if using WKIX32
$nul=SetConsole("Hide") ;- Hide console when script is done



;------------------------Function
$FuncToExecute=Split("fnScrFunc1,fnScrFunc2,fnScrFunc3,fnScrFunc4,fnScrFunc5,fnScrFunc6",",")




;-------------------------Installing Kixform
$frmRoot = CreateObject("Kixtart.Form")
If @ERROR
$nul=SetConsole("Show")
"KiXforms.dll not installed/registered" ?
Exit(1)
EndIf




;-------------------------Making Form
$frmMain = CreateObject("Kixtart.Form")
$frmMain.Size = 560,410
$frmMain.SysMenu = 0
$frmMain.Text = "YooowWW"
$frmMain.BackColor = 114, 125, 157
$frmMain.Center

$picture = $frmMain.controls.Picturebox ("", 25, 25, 499, 340)
$picture.picture = "esj.bmp"
$picture.BorderStyle = 0


;----------------------------Tekst functie
$ProgressTextBox = $picture.Label
$ProgressTextBox.BackColor = 187, 192, 213
$ProgressTextBox.bounds = 10, 220, 480, 20
$ProgressTextBox.forecolor = 255, 255, 255
$ProgressTextBox.fontsize = 12
$ProgressTextBox.fontbold = true
$ProgressTextBox.FontName = Tahoma
$ProgressTextBox.TextAlign = MiddleCenter



;-------------------------Script functies uitvoeren
$frmMain.Show
;$prgStatus.Max = Ubound($FuncToExecute)+1
For Each $sFunction in $FuncToExecute
;$prgStatus.Value = $prgStatus.Value+1
$nul=Execute($sFunction)
Sleep 1
Next
Exit()

;-------------------------Functies





Function fnScrFunc1()
$ProgressTextBox.text = "Mapping Network Drives"
SLEEP 1
EndFunction

Function fnScrFunc2()
$ProgressTextBox.text = "Change This Computer Name"
SLEEP 1
EndFunction

Function fnScrFunc3()
$ProgressTextBox.text = "Change Network Drive Icons"
SLEEP 1
EndFunction

Function fnScrFunc4()
$ProgressTextBox.text = "Set the correct domain time"
SETTIME "\\SSC01"
EndFunction

Function fnScrFunc5()
$ProgressTextBox.text = "Set some internet favorites"
SLEEP 1
EndFunction

Function fnScrFunc6()
$ProgressTextBox.text = "Logonscript complete. Thank you."
Sleep 1
EndFunction




Can he skip When a Function is completed?

Greets JoosTy

Top
#152640 - 2005-12-01 05:24 PM Re: Loginscript with progressbar
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 311
Loc: STRASBOURG, France
the line
Code:
$FuncToExecute=Split("fnScrFunc1,fnScrFunc2,fnScrFunc3,fnScrFunc4,fnScrFunc5,fnScrFunc6",",")

initializes an array that contains the list of functions to be called.


in the loop
Code:
For Each $sFunction ... next  


each function defined in the array is called sequentially. But there is a mistake in the code.
Code:
;$prgStatus.Max = Ubound($FuncToExecute)+1
For Each $sFunction in $FuncToExecute
;$prgStatus.Value = $prgStatus.Value+1
$nul=Execute($sFunction)
Next


the two commented lines should be uncommented because they are implementing the progressbar !!!
_________________________
Christophe

Top
#152641 - 2006-03-05 12:22 AM Re: Loginscript with progressbar
ashwin Offline
Lurker

Registered: 2006-03-05
Posts: 4
I have tested this script.
Now I just only want to add a messagebox at the end.
The problem now is that the messagebox doen't appear on the screen.
It is essential for the script that it contains the message.

How to solve this???

Top
#152642 - 2006-03-05 03:45 AM Re: Loginscript with progressbar
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
didn't we discuss this over here?
http://www.kixforms.org/forum/viewtopic.php?t=1096
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#152643 - 2006-03-05 06:17 AM Re: Loginscript with progressbar
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
In the script above there is no messagebox commands.

If you want one just add it like so

Code:

Next
$nul = MessageBox("Insert your Text Here","Notice",64)
Exit()
_________________________
Today is the tomorrow you worried about yesterday.

Top
#152644 - 2006-03-05 07:03 AM Re: Loginscript with progressbar
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Exit is not a function
Is that a KiX MessageBox() in a KF script?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#152645 - 2006-03-05 07:10 AM Re: Loginscript with progressbar
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Quote:

Exit is not a function
Is that a KiX MessageBox() in a KF script?




Ok that is what I get for cut and paste....
And yea that would be a KiX on top of a KF script. My bad, but it would still work.....
_________________________
Today is the tomorrow you worried about yesterday.

Top
#152646 - 2006-03-05 09:38 AM Re: Loginscript with progressbar
ashwin Offline
Lurker

Registered: 2006-03-05
Posts: 4
Quote:

In the script above there is no messagebox commands.

If you want one just add it like so

Code:

Next
$nul = MessageBox("Insert your Text Here","Notice",64)
Exit()




This seems ok, but when I execute this, I still don't see any messagebox.

I've tried running in debug mode. It appears the whole $nul = MessageBox("Insert your Text Here","Notice",64) is skipped.

I guess you cannot add MessageBox() in a kixform.

Btw. I have solved the whole problem by using a batch file. in the batchfile i refer to login.kix and afterwars to logix2.kix

login.kix is the script with progressbar and login2.kix contains code to create the messagebox.

Thanks for the idea though.

Top
#152647 - 2006-03-05 09:52 AM Re: Loginscript with progressbar
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Did you insert the messagebox command between your next and your exit. Or did you just copy and paste the whole thing into your script? I geuss I was not very specific as to how to do it.

I use messagebox along with KF with no problems.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#152648 - 2006-03-05 03:06 PM Re: Loginscript with progressbar
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

Ok that is what I get for cut and paste....
And yea that would be a KiX on top of a KF script. My bad, but it would still work.....



Hmmm... cut and paste gives me an error.

The form should be redesigned to use the KiXforms built-ins to display whatever message on the main form before the progress bar starts. That way users can read the message while waiting for the script to complete.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#152649 - 2006-03-05 10:51 PM Re: Loginscript with progressbar
ashwin Offline
Lurker

Registered: 2006-03-05
Posts: 4
Quote:

Did you insert the messagebox command between your next and your exit. Or did you just copy and paste the whole thing into your script? I geuss I was not very specific as to how to do it.

I use messagebox along with KF with no problems.




Yes I have used cut and paste, and still the same




Quote:

Quote:

Ok that is what I get for cut and paste....
And yea that would be a KiX on top of a KF script. My bad, but it would still work.....



Hmmm... cut and paste gives me an error.

The form should be redesigned to use the KiXforms built-ins to display whatever message on the main form before the progress bar starts. That way users can read the message while waiting for the script to complete.





After quite bit of testing I I've come to the following result:

Code:

Break On CLS ;- Remove CLS if using WKIX32
$nul=SetConsole("Hide") ;- Hide console when script is done

;------------------------Function
$FuncToExecute=Split("fnScrFunc1,fnScrFunc2,fnScrFunc3,fnScrFunc4,fnScrFunc5,fnScrFunc6",",")

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

;-------------------------Making Form
$Root = $System.Form()
$frmMain = $System.Form($Root)
$frmMain.TopMost = "True"
$frmMain.Size = 560,410
$frmMain.SysMenu = 1
$frmMain.Text = "Logging in..."
$frmMain.BackColor = 114, 125, 157

$picture = $frmMain.controls.Picturebox ("", 25, 25, 499, 340)
$picture.picture = "esj.bmp"
$picture.BorderStyle = 0

;----------------------------Tekst functie
$ProgressTextBox = $picture.Label
$ProgressTextBox.BackColor = 187, 192, 213
$ProgressTextBox.bounds = 10, 220, 480, 20
$ProgressTextBox.forecolor = 255, 255, 255
$ProgressTextBox.fontsize = 12
$ProgressTextBox.fontbold = true
$ProgressTextBox.FontName = Tahoma
$ProgressTextBox.TextAlign = MiddleCenter

$ProgressBar = $picture.ProgressBar()
$ProgressBar.Left = $ProgressTextBox.Left
$ProgressBar.Top = $ProgressTextBox.Bottom + 10
$ProgressBar.Width = $ProgressTextBox.Width
$ProgressBar.Height = $ProgressTextBox.Height

$ProgressTextBox1 = $picture.Label
$ProgressTextBox1.BackColor = 187, 192, 213
$ProgressTextBox1.bounds = 10, 20, 480, 100
;$ProgressTextBox1.forecolor = 255, 255, 255
;$ProgressTextBox1.fontsize = 12
;$ProgressTextBox1.fontbold = true
;$ProgressTextBox1.FontName = Tahoma
;$ProgressTextBox1.TextAlign = MiddleCenter

;-------------------------Script functies uitvoeren
$frmMain.Center
$frmMain.Show
;$prgStatus.Max = Ubound($FuncToExecute)+1
For Each $sFunction in $FuncToExecute
;$prgStatus.Value = $prgStatus.Value+1
$nul=Execute($sFunction)
Sleep 1
Next
Exit()

;-------------------------Functies

Function fnScrFunc1()
$ProgressTextBox.text = "Your message"
$ProgressBar.Value = $ProgressBar.Value + 16
Sleep 1
EndFunction

Function fnScrFunc2()
$ProgressTextBox.text = "Change This Computer Name"
$ProgressBar.Value = $ProgressBar.Value + 16
Sleep 1
EndFunction

Function fnScrFunc3()
$ProgressTextBox.text = "Change Network Drive Icons"
$ProgressBar.Value = $ProgressBar.Value + 16
Sleep 1
EndFunction

Function fnScrFunc4()
$ProgressTextBox.text = "Set the correct domain time"
$ProgressBar.Value = $ProgressBar.Value + 16
SetTime "\\SSC01"
EndFunction

Function fnScrFunc5()
$ProgressTextBox.text = "Set some internet favorites"
$ProgressBar.Value = $ProgressBar.Value + 16
Sleep 1
EndFunction

Function fnScrFunc6()
$ProgressTextBox.text = "Logonscript complete. Thank you."
$ProgressBar.Value = 100
Sleep 1.5
EndFunction

Next
$nul = MessageBox("Test_message","Test_title",64)
Exit()



I've added:

$ProgressTextBox1 = $picture.Label
$ProgressTextBox1.BackColor = 187, 192, 213
$ProgressTextBox1.bounds = 10, 20, 480, 100
;$ProgressTextBox1.forecolor = 255, 255, 255
;$ProgressTextBox1.fontsize = 12
;$ProgressTextBox1.fontbold = true
;$ProgressTextBox1.FontName = Tahoma
;$ProgressTextBox1.TextAlign = MiddleCenter

The last five are unimportant

and added

Code:
$ProgressTextBox1.text = "your text"


within Function fnScrFunc1()

Now you'll see your message above the login bar.

Top
#152650 - 2006-03-05 11:17 PM Re: Loginscript with progressbar
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Nope that is not what I meant at all. See code snippet below
Code:

$frmMain.Center
$frmMain.Show
;$prgStatus.Max = Ubound($FuncToExecute)+1
For Each $sFunction in $FuncToExecute
;$prgStatus.Value = $prgStatus.Value+1
$nul=Execute($sFunction)
Sleep 1
Next
;Insert here
$nul = MessageBox("Test_message","Test_title",64)
Exit()



Or go with what works for you
_________________________
Today is the tomorrow you worried about yesterday.

Top
#152651 - 2006-03-05 11:47 PM Re: Loginscript with progressbar
ashwin Offline
Lurker

Registered: 2006-03-05
Posts: 4
Thx that work fine now.

Although now I don't have to use this anymore, since I use the form to show my message. I think some other guys I know will appreciate this

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1013 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.063 seconds in which 0.024 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