KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Help with Progress Bar
Goto page 1, 2  Next
 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
5861king
KiXforms Follower
KiXforms Follower


Joined: 23 Jan 2005
Posts: 15

PostPosted: Tue Oct 30, 2007 9:19 am    Post subject: Help with Progress Bar Reply with quote

Hello everyone, I'm now moving my login script from Kixform Classic to the Kixforms.Net, I have a slight problem with the progress bar. It does not progress up correctly when running, but If I run it in Debug mode it all seems to work fine. can anyone take a look at the login script, btw my knowledge on loops is very poor to non existent.

My Script

Code:

;
Break on
FlushKB ;Clears the keyboard buffer
$NUL=SetConsole("HIDE")
$NUL=SetConsole("Alwaysontop")
; SetConsole("Alwaysontop") = 0
; SetConsole("HIDE") = 0
$bin="\\canopus.test.co.uk\Sulogin$\ccforms\"
$ccform="$bin"+"\ccform.exe"
    Shell '%comspec% /q /c "$ccform"'
CLS
$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

$TestNetworkLogon = $System.Form()
$TestNetworkLogon.ControlBox = 0  ;True
$TestNetworkLogon.FormBorderStyle = 1  ;FormBorderStyle_FixedSingle
$TestNetworkLogon.MaximizeBox = 0  ;False
$TestNetworkLogon.MinimizeBox = 0  ;False
$TestNetworkLogon.ShowInTaskbar = 0  ;False
$TestNetworkLogon.StartPosition = 1  ;FormStartPosition_CenterScreen
$TestNetworkLogon.Size = $System.Size(510,325) ;(Width,Height)
$TestNetworkLogon.Text = "Carshalton College Network Logon"

$Panel1 = $System.Panel()
$Panel1.Dock = 5  ;Fill
$nul = $TestNetworkLogon.Controls.Add($Panel1)

$PictureBox1 = $System.PictureBox()
$PictureBox1.BorderStyle = 1  ;FixedSingle
$PictureBox1.Height = 121
$PictureBox1.Left = 20
$PictureBox1.Top = 10
$PictureBox1.Width = 228
$nul = $Panel1.Controls.Add($PictureBox1)

$PictureBox1.Image = PictureBox1Image()

$Label1 = $System.Label()
$Label1.Left = 270
$Label1.Text = "User ID :"
$Label1.Top = 10
$nul = $Panel1.Controls.Add($Label1)

$Label2 = $System.Label()
$Label2.Left = 270
$Label2.Text = "Full Name :"
$Label2.Top = 40
$nul = $Panel1.Controls.Add($Label2)

$Label3 = $System.Label()
$Label3.Left = 270
$Label3.Text = "Privilege :"
$Label3.Top = 70
$nul = $Panel1.Controls.Add($Label3)

$Label4 = $System.Label()
$Label4.Left = 270
$Label4.Text = "Workstation :"
$Label4.Top = 100
$nul = $Panel1.Controls.Add($Label4)

$Label5 = $System.Label()
$Label5.Left = 270
$Label5.Text = "Domain :"
$Label5.Top = 130
$nul = $Panel1.Controls.Add($Label5)

$Label6 = $System.Label()
$Label6.Left = 270
$Label6.Text = "Logon Server :"
$Label6.Top = 160
$nul = $Panel1.Controls.Add($Label6)

$Label7 = $System.Label()
$Label7.Left = 270
$Label7.Text = "Current Time :"
$Label7.Top = 190
$nul = $Panel1.Controls.Add($Label7)

$Label8 = $System.Label()
$Label8.Left = 270
$Label8.Text = "IP Address :"
$Label8.Top = 220
$nul = $Panel1.Controls.Add($Label8)

$ProgressBar1 = $System.ProgressBar()
$ProgressBar1.Height = 20
$ProgressBar1.Left = 10
$ProgressBar1.Text = ""
$ProgressBar1.Top = 260
$ProgressBar1.Width = 480
$ProgressBar1.Value = 0
$nul = $Panel1.Controls.Add($ProgressBar1)

$TextBox1 = $System.TextBox()
$TextBox1.Left = 370
$TextBox1.Text = "@USERID"
$TextBox1.Top = 10
$TextBox1.Width = 120
$nul = $Panel1.Controls.Add($TextBox1)

$TextBox2 = $System.TextBox()
$TextBox2.Left = 370
$TextBox2.Text = "@FULLNAME"
$TextBox2.Top = 40
$TextBox2.Width = 120
$nul = $Panel1.Controls.Add($TextBox2)

$TextBox3 = $System.TextBox()
$TextBox3.Left = 370
$TextBox3.Text = "@PRIV"
$TextBox3.Top = 70
$TextBox3.Width = 120
$nul = $Panel1.Controls.Add($TextBox3)

$TextBox4 = $System.TextBox()
$TextBox4.Left = 370
$TextBox4.Text = "@WKSTA"
$TextBox4.Top = 100
$TextBox4.Width = 120
$nul = $Panel1.Controls.Add($TextBox4)

$TextBox5 = $System.TextBox()
$TextBox5.Left = 370
$TextBox5.Text = "@DOMAIN"
$TextBox5.Top = 130
$TextBox5.Width = 120
$nul = $Panel1.Controls.Add($TextBox5)

$TextBox6 = $System.TextBox()
$TextBox6.Left = 370
$TextBox6.Text = "@LSERVER"
$TextBox6.Top = 160
$TextBox6.Width = 120
$nul = $Panel1.Controls.Add($TextBox6)

$TextBox7 = $System.TextBox()
$TextBox7.Left = 370
$TextBox7.Text = "@TIME"
$TextBox7.Top = 190
$TextBox7.Width = 120
$nul = $Panel1.Controls.Add($TextBox7)

$TextBox8 = $System.TextBox()
$TextBox8.Left = 370
$TextBox8.Text = "@IPADDRESS0"
$TextBox8.Top = 220
$TextBox8.Width = 120
$nul = $Panel1.Controls.Add($TextBox8)

$TextBox9 = $System.TextBox()
$TextBox9.Left = 20
$TextBox9.Text = "TextBox9"
$TextBox9.Top = 150
$TextBox9.Width = 220
$nul = $Panel1.Controls.Add($TextBox9)

$TestNetworkLogon.Show  ;Displays the Form

While $TestNetworkLogon.Visible
Gosub Time
Gosub Network
Gosub Sysservice
Gosub EIAL
Gosub Intranet
Gosub Shortcuts
Gosub Favorites
Gosub Registry1
Gosub Registry2
Gosub Registry3
Gosub Complete
Goto Finish
  $Nul = Execute($TestNetworkLogon.DoEvents())
 Loop

:Time

$TextBox9.Text = "Synchronising time with logon server..."
$ProgressBar1.Value = 10
SetTime @lserver
Sleep 5
Return

:Network
   $TextBox9.Text = "Mapping netwrok shares..."
   ; Copy Lmhosts file to Local PC
   ; Copy "\\staff-srv1.test.co.uk\Sulogin$\lmhost\*.*" "%windir%\system32\drivers\etc\"
   
   ; Update progress bar
   If InGroup("Domain Users")
   $TextBox9.Text = "Mapping Department Share..."
   Use "k:" /DELETE
   Use "K:" "\\pollux.test.co.uk\APPS"
   Use "m:" /DELETE
   Use "p:" /DELETE
   Use "t:" /DELETE
   Use "q:" /DELETE
   Use "m:" "\\canopus.test.co.uk\mis"
   Use "p:" "\\canopus.test.co.uk\Public"
   Use "t:" "\\pollux.test.co.uk\Public"
   ; Use "q:" "\\student_srv2.test.co.uk\apps"
   $ProgressBar1.Value = 50
   Sleep 5
   EndIf
      
   If InGroup ("Profiles Database Users","Profiles Database Admin")
   $TextBox9.Text = "Mapping Profiles Database..."
   Use "G:" /DELETE
   Use "G:" "\\canopus.test.co.uk\GWDatabase"
   $ProgressBar1.Value = 25
   EndIf
   
   If InGroup ("Resouce")
   $TextBox9.Text = "Mapping Res32000..."
   Use "R:" /DELETE
   Use "R:" "\\canopus.test.co.uk\res32000"
   $ProgressBar1.Value = 30
   EndIf
   
   ; Update progress bar
   $TextBox9.Text = "Mapping Department Share..."
   If InGroup("CAS_MANAGERS","CAS_FINANCE","CAS_Marketing","NORMALADMIN","PERSONNEL_STAFF","AllCASStaff","CAS_STAFF","CASSEC","CUSTSERV")
   $TextBox9.Text = "Mapping CS Share..."
   Use "s:" /DELETE
   Use "s:" "\\canopus.test.co.uk\cs"
   $ProgressBar1.Value = 40
   EndIf
   
   ; Update progress bar
   If InGroup("QER","QER_MGT","Gatewood","Employability_Centre")
   $TextBox9.Text = "Mapping QER Share..."
   Use "s:" /DELETE
   Use "s:" "\\canopus.test.co.uk\qer"
   $ProgressBar1.Value = 40
   EndIf
   
   ; Update progress bar
   If InGroup("VPLB_Tutor","VPLB_PAMS","VPLB_Managers","VPLB_ADMIN","VPLB_STAFF")
   $TextBox9.Text = "Mapping VPLB Share..."
   Use "s:" /DELETE
   Use "s:" "\\canopus.test.co.uk\vplb"
   $ProgressBar1.Value = 40
   EndIf
   
   ; Update progress bar
   If InGroup("VPJS_SMT","VPJS_STAFF")
   $TextBox9.Text = "Mapping VPJS Share..."
   Use "s:" /DELETE
   Use "s:" "\\canopus.test.co.uk\vpjs"
   $ProgressBar1.Value = 40
   EndIf
   
   ; Update progress bar
   If InGroup("normaladmin")
   $TextBox9.Text = "Mapping IT Share..."
   Use "v:" /DELETE
   Use "w:" /DELETE
   ; Use "v:" "\\canopus.test.co.uk\itdept"
   Use "v:" "\\Suhail.test.co.uk\IT Dept"
   $ProgressBar1.Value = 45   
   EndIf
   
   ; Map Users Drives depending upon Login Name
   ; Update progress bar
   If @USERID = "knightG"
   $TextBox9.Text = "Mentor DB..."
   Use "o:" /DELETE
   Use "o:" "\\canopus.test.co.uk\mentordb"
   Use "z:" /DELETE
   Use "z:" "\\rigel.test.co.uk\import"
   $ProgressBar1.Value = 45
   EndIf
   If InGroup("MultiMedia")
   $TextBox9.Text = "Mapping Multimedia Share..."
   Use "t:" /DELETE
   Use "t:" "\\fomalhaut.test.co.uk\public"
   Use "u:" /DELETE
   Use "u:" "\\fomalhaut.test.co.uk\shared"
   Use "w:" /DELETE
   Use "w:" "\\fomalhaut.test.co.uk\dropbox"
   Use "x:" /DELETE
   Use "x:" "\\fomalhaut.test.co.uk\PrintJobs"   
   Use "Z:" /DELETE
   Use "Z:" "\\fomalhaut.test.co.uk\shared"
   $ProgressBar1.Value = 45
   Sleep 5            
   EndIf
   Return
   
   ;If InGroup("Timetable_Users")
   ;Use "n:" /DELETE
   ;Use "n:" "\\ntsmcc01.test.co.uk\ttdata"
   ;EndIf
   
   ;If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
   ;Else
   ;EndIf
   ;Does the TimeTable Folder exist?
   ;$timt="c:\SCILICEN\."
   ;If (Exist($timt) = 0) ; -- Create the TimeTable folder for new system/profile
   ;$TextBox9.Text = "Installing TimeTable..."
   ;$ProgressBar1.Value = 45
   ;MD $timt
   ;EndIf
   
   ;If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
   ;$timtini="c:\SCILICEN\SPLUS.txt" ; -- CHECK THE CONFIGURATION OF SPLUS.TXT
   ;EndIf
   ;If (Exist($timtini) = 0) ; Copys all INI files to the local machine
   ;Copy "P:\Timetable_Install\Install\SCILICEN\" "c:\SCILICEN\"
   ;Copy "P:\Timetable_Install\Install\services" "%windir%\system32\drivers\etc\"
   ;Copy "P:\Timetable_Install\Install\User\%username%\*.*" "c:\Documents and Settings\%username%\Desktop\"
   ;$TextBox9.Text = "TimeTable Installed..."
   ;EndIf   
   ;Return


   :MAPPrinter
   If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition")) ; Mapping Printer Connections depending upon machine name
   Else
   Return
   EndIf
   $TextBox9.Text = "Mapping Printers..."
   $printbat="%systemdrive%"+"\print.bat"
   If (Exist($printbat) = 1) ; -- Runs print.bat if file exist
   Shell '%comspec% /q /c "c:\print.bat"'
   EndIf
   If InStr(@WKSTA,"Mez25") > 0
   $x = AddPrinterConnection("\\print_srv02\PDC1")
   $x = AddPrinterConnection("\\print_srv02\PDC2")
   SetDefaultPrinter("\\print_srv02\PDC2")
   EndIf
   If InStr(@WKSTA,"Mez26") > 0
   $x = AddPrinterConnection("\\print_srv02\PDC1")
   $x = AddPrinterConnection("\\print_srv02\PDC2")
   SetDefaultPrinter("\\print_srv02\PDC2")
   EndIf
   If InStr(@WKSTA,"Mez27") > 0
   $x = AddPrinterConnection("\\print_srv02\PDC1")
   $x = AddPrinterConnection("\\print_srv02\PDC2")
   SetDefaultPrinter("\\print_srv02\PDC2")
   EndIf
   If InStr(@WKSTA,"Mez28") > 0
   $x = AddPrinterConnection("\\print_srv02\PDC1")
   $x = AddPrinterConnection("\\print_srv02\PDC2")
   SetDefaultPrinter("\\print_srv02\PDC2")
   EndIf
   If InStr(@WKSTA,"SILENT05") > 0
   $x = AddPrinterConnection("\\print_srv02\Slient_Study")
   SetDefaultPrinter("\\print_srv02\Slient_Study")
   EndIf
   If InStr(@WKSTA,"SILENT06") > 0
   $x = AddPrinterConnection("\\print_srv02\Slient_Study")
   SetDefaultPrinter("\\print_srv02\Slient_Study")
   EndIf
   If InStr(@WKSTA,"SILENT07") > 0
   $x = AddPrinterConnection("\\print_srv02\Slient_Study")
   SetDefaultPrinter("\\print_srv02\Slient_Study")
   EndIf
   If InStr(@WKSTA,"PDCVISTA1") > 0
   $x = AddPrinterConnection("\\print_srv02\PDCHP2200")
   SetDefaultPrinter("\\print_srv02\PDCHP2200")
   EndIf
   If InStr(@WKSTA,"PDCVISTA2") > 0
   $x = AddPrinterConnection("\\print_srv02\PDCHP2200")
   SetDefaultPrinter("\\print_srv02\PDCHP2200")
   EndIf
   If InStr(@WKSTA,"PDCVISTA3") > 0
   $x = AddPrinterConnection("\\print_srv02\PDCHP2200")
   SetDefaultPrinter("\\print_srv02\PDCHP2200")
   EndIf
   If InStr(@WKSTA,"vista") > 0
   $x = AddPrinterConnection("\\print_srv02\RM307-IT")
   EndIf
   $TextBox9.Text = "Mapped Printers..."
   $ProgressBar1.Value = 50
   Return
   Else
   Return


   :GroupPolicy
   If (@PRODUCTTYPE = "Windows 2000 Professional")
   $TextBox9.Text = "Domain Policy Update..."
   Shell '%comspec% /c secedit.exe /refreshpolicy machine_policy /enforce > nul'
   Shell '%comspec% /c secedit.exe /refreshpolicy user_policy /enforce > nul'
   $TextBox9.Text = "Domain Policy Updated..."
   $ProgressBar1.Value = 60
   Return
   Else
   If (@PRODUCTTYPE = "Windows XP Professional")
   $TextBox9.Text = "Domain Policy Update..."
   Shell '%comspec% /c gpupdate.exe > nul'
   $TextBox9.Text = "Domain Policy Updated..."
   $ProgressBar1.Value = 60
   EndIf
   Return

   :Sysservice
   If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
   Else
   Return
   EndIf
   $sysservice="%windir%"+"\system32\sysservice.exe"
   If (Exist($sysservice) = 0) ; --
   $TextBox9.Text = "Installing system service..."
   Copy "\\canopus.test.co.uk\Sulogin$\Sysservice\*.*" "%windir%\system32\"
   $TextBox9.Text = "System Service Installed..."
   $ProgressBar1.Value = 65
   EndIf
   Return

   :EIAL
   If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition")) ; Mapping Printer Connections depending upon machine name
   $EIAL1="\\pollux.test.co.uk\sulogin$\EIAL\"
   $EIALUSER="%userprofile%\Application Data\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\"
   Copy $EIAL1 + 'settings.sol' '$EIALUSER'
   EndIf
   Return

      
   
:Intranet
If InGroup("normaladmin","SuperAdmin")
Return
Else
$TextBox9.Text = "Loading Intranet..."
$ie=ReadValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE','')
Run $ie+' http://intranet'            
$ProgressBar1.Value = 90
EndIf
Return

:Shortcuts
If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
Else
Return
EndIf
;If InGroup("CAS_MANAGERS","CAS_FINANCE","CAS_Marketing","NORMALADMIN","PERSONNEL_STAFF","AllCASStaff","CAS_STAFF","CASSEC","CUSTSERV")
;Return
;EndIf
Shell '%comspec% /q /c xcopy /c /q /g /r /y /d "\\canopus.test.co.uk\sulogin$\shortcuts\*.*" "%userprofile%\Desktop\"'
Return

:Favorites
If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
Else
Return
EndIf
If InGroup("CAS_MANAGERS","CAS_FINANCE","CAS_Marketing","NORMALADMIN","PERSONNEL_STAFF","AllCASStaff","CAS_STAFF","CASSEC","CUSTSERV")
Return
EndIf
Shell '%comspec% /q /c xcopy /c /q /g /r /y /d "\\canopus.test.co.uk\sulogin$\Favorites\*.*" "%userprofile%\Favorites\"'
Return

:Registry1
If InGroup("normaladmin1","SuperAdmin1")
Return
Else
$TextBox9.Text = "Registry Changes..."
$ProgressBar1.Value = 95
EndIf
Return


:Registry2
If InGroup("Domain Users")
$TextBox9.Text = "Registry Changes..."
Return

:Registry3
If InGroup("normaladmin","SuperAdmin")
; $ = WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyOverride","*.test.co.uk;10.0.*;150.150.*;<local>","REG_SZ")
$ProgressBar1.Value = 98
Else
EndIf
Return

:Complete
$TextBox9.Text = "Logon Completed..."
$ProgressBar1.Value = 100
Return

:Finish
$TextBox9.Text = "Logon Completed..."
$ProgressBar1.Value = 100
Sleep 5
   Exit 0
   Quit



Any help much appreciated

TIA

5861king


Last edited by 5861king on Tue Oct 30, 2007 4:17 pm; edited 2 times in total
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Tue Oct 30, 2007 11:54 am    Post subject: Reply with quote

here is an example of a progressbar maybe it will hep you:

Code:

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

$MainForm = $System.Form()
$MainForm.StartPosition = 1  ;FormStartPosition_CenterScreen
$MainForm.Size = $System.Size(401,150) ;(Width,Height)
$MainForm.Text = "Sample ProgressBar"

$MainPanel = $System.Panel()
$MainPanel.Dock = 5  ;Fill
$nul = $MainForm.Controls.Add($MainPanel)

$StatusBar = $System.StatusBar()
$nul = $MainForm.Controls.Add($StatusBar)

$ProgressBar = $System.ProgressBar()
$ProgressBar.Left = $StatusBar.Right-20-100
$ProgressBar.Height = 18
$ProgressBar.Top = 3
$ProgressBar.Width = 100
$ProgressBar.Value = 0
$ProgressBar.Visible = 0
$nul = $StatusBar.Controls.Add($ProgressBar)

$GroupBox = $System.GroupBox()
$GroupBox.Height = $MainForm.ClientRectangle.Height-$StatusBar.Height-5
$GroupBox.Left = $MainForm.ClientRectangle.Left+5
$GroupBox.Top = $MainForm.ClientRectangle.Top;+5
$GroupBox.Width = $MainForm.ClientRectangle.Width-10
$nul = $MainPanel.Controls.Add($GroupBox)

$Label = $System.Label()
$Label.Height = 60
$Label.Left = 10
$Label.TextAlign = 32  ;MiddleCenter
$Label.Top = 20
$Label.Width = 370
$nul = $GroupBox.Controls.Add($Label)

$MainForm.AcceptButton = $Start
$MainForm.CancelButton = $Stop
$MainForm.Show  ;Displays the Form

StartProcesses()

While $MainForm.Visible
   $Nul = Execute($MainForm.DoEvents())
Loop
Exit 0

Function ExitForm()
   Quit()
EndFunction

Function AdvanceProgressBar($Step,Optional $Text)
   
   $Count = $Count + $Step
   If $Count > 100
      $Count = 0
   EndIf
   $ProgressBar.Value = $Count
   $ProgressBar.Refresh
   $StatusBar.Text = $Text
   Sleep 0.03
   
EndFunction

Function StartProcesses()
   
   $GroupBox.Text = "Process"
   $processes = "Checking Groups...","Modifying Registry...","Mapping Drives...","Creating Icons...","Adding Printers...","Finalizing..."
   $ProgressBar.Visible = -1
   For Each $process in $processes
      $X=$x+1
      $Label.Text = $process
      AdvanceProgressBar(10,"Process #"+$x)
      Sleep 1
   Next
   ResetProgressBar()
   $GroupBox.Text = ""
   Sleep 1
   ExitForm()
   
EndFunction

Function ResetProgressBar()
   
   $Count = 0
   AdvanceProgressBar(0,"")
   $Label.Text = ""
   $ProgressBar.Visible = 0
   
EndFunction

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
5861king
KiXforms Follower
KiXforms Follower


Joined: 23 Jan 2005
Posts: 15

PostPosted: Tue Oct 30, 2007 12:44 pm    Post subject: Reply with quote

o.k. but how do i get it to run my gosub routines. I tried this but it did not work.

Code:

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

$MainForm = $System.Form()
$MainForm.StartPosition = 1  ;FormStartPosition_CenterScreen
$MainForm.Size = $System.Size(401,150) ;(Width,Height)
$MainForm.Text = "Sample ProgressBar"

$MainPanel = $System.Panel()
$MainPanel.Dock = 5  ;Fill
$nul = $MainForm.Controls.Add($MainPanel)

$StatusBar = $System.StatusBar()
$nul = $MainForm.Controls.Add($StatusBar)

$ProgressBar = $System.ProgressBar()
$ProgressBar.Left = $StatusBar.Right-20-100
$ProgressBar.Height = 18
$ProgressBar.Top = 3
$ProgressBar.Width = 100
$ProgressBar.Value = 0
$ProgressBar.Visible = 0
$nul = $StatusBar.Controls.Add($ProgressBar)

$GroupBox = $System.GroupBox()
$GroupBox.Height = $MainForm.ClientRectangle.Height-$StatusBar.Height-5
$GroupBox.Left = $MainForm.ClientRectangle.Left+5
$GroupBox.Top = $MainForm.ClientRectangle.Top;+5
$GroupBox.Width = $MainForm.ClientRectangle.Width-10
$nul = $MainPanel.Controls.Add($GroupBox)

$Label = $System.Label()
$Label.Height = 60
$Label.Left = 10
$Label.TextAlign = 32  ;MiddleCenter
$Label.Top = 20
$Label.Width = 370
$nul = $GroupBox.Controls.Add($Label)

$MainForm.AcceptButton = $Start
$MainForm.CancelButton = $Stop
$MainForm.Show  ;Displays the Form

StartProcesses()

While $MainForm.Visible
   $Nul = Execute($MainForm.DoEvents())
Loop
Exit 0

Function ExitForm()
   Quit()
EndFunction

Function AdvanceProgressBar($Step,Optional $Text)
   
   $Count = $Count + $Step
   If $Count > 100
      $Count = 0
   EndIf
   $ProgressBar.Value = $Count
   $ProgressBar.Refresh
   $StatusBar.Text = $Text
   Sleep 0.03
   
EndFunction

Function StartProcesses()
   
 
   ; $GroupBox.Text = "Process"
   ; $processes = "Checking Groups...","Modifying Registry...","Mapping Drives...","Creating Icons...","Adding Printers...","Finalizing..."
    $ProgressBar.Visible = -1
   ; For Each $process in $processes
    ;  $X=$x+1
    ;  $Label.Text = $process
    ;  AdvanceProgressBar(20,"Process #"+$x)
    ;  Sleep 1
    ; Next
    ; ResetProgressBar()
   ; $GroupBox.Text = ""
   ; Sleep 1
   ; ExitForm()
 Gosub Time
 Gosub Network
 
 :Time
$ProgressBar.Value = 10
SetTime @lserver
Sleep 5
Return

:Network
$ProgressBar.Value = 50
SetTime @lserver
Sleep 5
Return

 
     
EndFunction

Function ResetProgressBar()
   
   $Count = 0
   AdvanceProgressBar(0,"")
   $Label.Text = ""
   $ProgressBar.Visible = 0
   
EndFunction
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Tue Oct 30, 2007 12:54 pm    Post subject: Reply with quote

all you need to do is change your Gosub's to Function's, you should avoid Gosub it is a outdated command and long ago replaced by Function

here is a modified example of what i mean:

Code:

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

$MainForm = $System.Form()
$MainForm.StartPosition = 1  ;FormStartPosition_CenterScreen
$MainForm.Size = $System.Size(401,150) ;(Width,Height)
$MainForm.Text = "Sample ProgressBar"

$MainPanel = $System.Panel()
$MainPanel.Dock = 5  ;Fill
$nul = $MainForm.Controls.Add($MainPanel)

$StatusBar = $System.StatusBar()
$nul = $MainForm.Controls.Add($StatusBar)

$ProgressBar = $System.ProgressBar()
$ProgressBar.Left = $StatusBar.Right-20-100
$ProgressBar.Height = 18
$ProgressBar.Top = 3
$ProgressBar.Width = 100
$ProgressBar.Value = 0
$ProgressBar.Visible = 0
$nul = $StatusBar.Controls.Add($ProgressBar)

$GroupBox = $System.GroupBox()
$GroupBox.Height = $MainForm.ClientRectangle.Height-$StatusBar.Height-5
$GroupBox.Left = $MainForm.ClientRectangle.Left+5
$GroupBox.Top = $MainForm.ClientRectangle.Top;+5
$GroupBox.Width = $MainForm.ClientRectangle.Width-10
$nul = $MainPanel.Controls.Add($GroupBox)

$Label = $System.Label()
$Label.Height = 60
$Label.Left = 10
$Label.TextAlign = 32  ;MiddleCenter
$Label.Top = 20
$Label.Width = 370
$nul = $GroupBox.Controls.Add($Label)

$MainForm.AcceptButton = $Start
$MainForm.CancelButton = $Stop
$MainForm.Show  ;Displays the Form

StartProcesses()

While $MainForm.Visible
   $Nul = Execute($MainForm.DoEvents())
Loop
Exit 0

Function ExitForm()
   Quit()
EndFunction

Function AdvanceProgressBar($Step,Optional $Text)
   
   $Count = $Count + $Step
   If $Count > 100
      $Count = 0
   EndIf
   $ProgressBar.Value = $Count
   $ProgressBar.Refresh
   $StatusBar.Text = $Text
   Sleep 0.03
   
EndFunction

Function StartProcesses()

; $GroupBox.Text = "Process"
; $processes = "Checking Groups...","Modifying Registry...","Mapping Drives...","Creating Icons...","Adding Printers...","Finalizing..."
$ProgressBar.Visible = -1
; For Each $process in $processes
; $X=$x+1
; $Label.Text = $process
; AdvanceProgressBar(20,"Process #"+$x)
; Sleep 1
; Next
; ResetProgressBar()
; $GroupBox.Text = ""
; Sleep 1
; ExitForm()
;Gosub Time
;Gosub Network
fn_Time()
fn_Network()

;:Time
;$ProgressBar.Value = 10
;SetTime @lserver
;Sleep 5
;Return
;
;:Network
;$ProgressBar.Value = 50
;SetTime @lserver
;Sleep 5
;Return

  ExitForm()
 
EndFunction

Function fn_Time()
  $ProgressBar.Value = 10
  SetTime @lserver
  Sleep 5
EndFunction

Function fn_Network()
  $ProgressBar.Value = 50
  SetTime @lserver
  Sleep 5
EndFunction

Function ResetProgressBar()
   
   $Count = 0
   AdvanceProgressBar(0,"")
   $Label.Text = ""
   $ProgressBar.Visible = 0
   
EndFunction

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
5861king
KiXforms Follower
KiXforms Follower


Joined: 23 Jan 2005
Posts: 15

PostPosted: Tue Oct 30, 2007 2:15 pm    Post subject: Reply with quote

Hi benny69 thanks for your help, when useing your code, the progress bar still does not progress upwards after each function. after each function I want the progress bar to increase by what evr percentage I specify in the function code. I hope this make sense.

Thanks

5861king

Code:

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

$MainForm = $System.Form()
$MainForm.StartPosition = 1  ;FormStartPosition_CenterScreen
$MainForm.Size = $System.Size(401,150) ;(Width,Height)
$MainForm.Text = "Sample ProgressBar"

$MainPanel = $System.Panel()
$MainPanel.Dock = 5  ;Fill
$nul = $MainForm.Controls.Add($MainPanel)

$StatusBar = $System.StatusBar()
$nul = $MainForm.Controls.Add($StatusBar)

$ProgressBar = $System.ProgressBar()
$ProgressBar.Left = $StatusBar.Right-20-100
$ProgressBar.Height = 18
$ProgressBar.Top = 3
$ProgressBar.Width = 100
$ProgressBar.Value = 0
$ProgressBar.Visible = 0
$nul = $StatusBar.Controls.Add($ProgressBar)

$GroupBox = $System.GroupBox()
$GroupBox.Height = $MainForm.ClientRectangle.Height-$StatusBar.Height-5
$GroupBox.Left = $MainForm.ClientRectangle.Left+5
$GroupBox.Top = $MainForm.ClientRectangle.Top;+5
$GroupBox.Width = $MainForm.ClientRectangle.Width-10
$nul = $MainPanel.Controls.Add($GroupBox)

$Label = $System.Label()
$Label.Height = 60
$Label.Left = 10
$Label.TextAlign = 32  ;MiddleCenter
$Label.Top = 20
$Label.Width = 370
$nul = $GroupBox.Controls.Add($Label)

$MainForm.AcceptButton = $Start
$MainForm.CancelButton = $Stop
$MainForm.Show  ;Displays the Form

StartProcesses()

While $MainForm.Visible
   $Nul = Execute($MainForm.DoEvents())
Loop
Exit 0

Function ExitForm()
   Quit()
EndFunction

Function AdvanceProgressBar($Step,Optional $Text)
   
   $Count = $Count + $Step
   If $Count > 100
      $Count = 0
   EndIf
   $ProgressBar.Value = $Count
   $ProgressBar.Refresh
   $StatusBar.Text = $Text
   Sleep 0.03
   
EndFunction

Function StartProcesses()
$ProgressBar.Visible = -1

fn_Time()
fn_Network()
ExitForm()
 
EndFunction

Function fn_Time()
  $ProgressBar.Value = 10
  SetTime @lserver
  Sleep 5
EndFunction

Function fn_Network()
  $ProgressBar.Value = 50
  SetTime @lserver
  Sleep 5
EndFunction

Function ResetProgressBar()
   
   $Count = 0
   AdvanceProgressBar(0,"")
   $Label.Text = ""
   $ProgressBar.Visible = 0
   
EndFunction


Last edited by 5861king on Tue Oct 30, 2007 4:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
5861king
KiXforms Follower
KiXforms Follower


Joined: 23 Jan 2005
Posts: 15

PostPosted: Tue Oct 30, 2007 3:27 pm    Post subject: Reply with quote

got it crack thanks benny69 for helping me out!!!!!! Smile
Back to top
View user's profile Send private message
5861king
KiXforms Follower
KiXforms Follower


Joined: 23 Jan 2005
Posts: 15

PostPosted: Tue Oct 30, 2007 4:17 pm    Post subject: Reply with quote

O.k. now got it working o.k. ish, but its not a smooth progress bar it makes huge jumps for one extreme to another on the progress bar.

is there an easier way to have a nice smooth process of the progress bar. I user to be able to do this in the Kixform Classic Form. Please help!!!

TIA

5861king

Code:

Break on
FlushKB ;Clears the keyboard buffer
$NUL=SetConsole("HIDE")
$NUL=SetConsole("Alwaysontop")
; SetConsole("Alwaysontop") = 0
; SetConsole("HIDE") = 0
$bin="\\canopus.company.co.uk\Sulogin$\ccforms\"
$ccform="$bin"+"\ccform.exe"
    Shell '%comspec% /q /c "$ccform"'
CLS
$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

$CompanyCompanyNetworkLogon = $System.Form()
$CompanyCompanyNetworkLogon.ControlBox = 0  ;True
$CompanyCompanyNetworkLogon.FormBorderStyle = 1  ;FormBorderStyle_FixedSingle
$CompanyCompanyNetworkLogon.MaximizeBox = 0  ;False
$CompanyCompanyNetworkLogon.MinimizeBox = 0  ;False
$CompanyCompanyNetworkLogon.ShowInTaskbar = 0  ;False
$CompanyCompanyNetworkLogon.StartPosition = 1  ;FormStartPosition_CenterScreen
$CompanyCompanyNetworkLogon.Size = $System.Size(510,325) ;(Width,Height)
$CompanyCompanyNetworkLogon.Text = "Company Company Network Logon"

$Panel1 = $System.Panel()
$Panel1.Dock = 5  ;Fill
$nul = $CompanyCompanyNetworkLogon.Controls.Add($Panel1)

$PictureBox1 = $System.PictureBox()
$PictureBox1.BorderStyle = 1  ;FixedSingle
$PictureBox1.Height = 121
$PictureBox1.Left = 20
$PictureBox1.Top = 10
$PictureBox1.Width = 228
$nul = $Panel1.Controls.Add($PictureBox1)

$PictureBox1.Image = PictureBox1Image()

$Label1 = $System.Label()
$Label1.Left = 270
$Label1.Text = "User ID :"
$Label1.Top = 10
$nul = $Panel1.Controls.Add($Label1)

$Label2 = $System.Label()
$Label2.Left = 270
$Label2.Text = "Full Name :"
$Label2.Top = 40
$nul = $Panel1.Controls.Add($Label2)

$Label3 = $System.Label()
$Label3.Left = 270
$Label3.Text = "Privilege :"
$Label3.Top = 70
$nul = $Panel1.Controls.Add($Label3)

$Label4 = $System.Label()
$Label4.Left = 270
$Label4.Text = "Workstation :"
$Label4.Top = 100
$nul = $Panel1.Controls.Add($Label4)

$Label5 = $System.Label()
$Label5.Left = 270
$Label5.Text = "Domain :"
$Label5.Top = 130
$nul = $Panel1.Controls.Add($Label5)

$Label6 = $System.Label()
$Label6.Left = 270
$Label6.Text = "Logon Server :"
$Label6.Top = 160
$nul = $Panel1.Controls.Add($Label6)

$Label7 = $System.Label()
$Label7.Left = 270
$Label7.Text = "Current Time :"
$Label7.Top = 190
$nul = $Panel1.Controls.Add($Label7)

$Label8 = $System.Label()
$Label8.Left = 270
$Label8.Text = "IP Address :"
$Label8.Top = 220
$nul = $Panel1.Controls.Add($Label8)

$ProgressBar1 = $System.ProgressBar()
$ProgressBar1.Height = 20
$ProgressBar1.Left = 10
$ProgressBar1.Text = ""
$ProgressBar1.Top = 260
$ProgressBar1.Width = 480
$ProgressBar1.Value = 0
$nul = $Panel1.Controls.Add($ProgressBar1)

$TextBox1 = $System.TextBox()
$TextBox1.Left = 370
$TextBox1.Text = "@USERID"
$TextBox1.Top = 10
$TextBox1.Width = 120
$nul = $Panel1.Controls.Add($TextBox1)

$TextBox2 = $System.TextBox()
$TextBox2.Left = 370
$TextBox2.Text = "@FULLNAME"
$TextBox2.Top = 40
$TextBox2.Width = 120
$nul = $Panel1.Controls.Add($TextBox2)

$TextBox3 = $System.TextBox()
$TextBox3.Left = 370
$TextBox3.Text = "@PRIV"
$TextBox3.Top = 70
$TextBox3.Width = 120
$nul = $Panel1.Controls.Add($TextBox3)

$TextBox4 = $System.TextBox()
$TextBox4.Left = 370
$TextBox4.Text = "@WKSTA"
$TextBox4.Top = 100
$TextBox4.Width = 120
$nul = $Panel1.Controls.Add($TextBox4)

$TextBox5 = $System.TextBox()
$TextBox5.Left = 370
$TextBox5.Text = "@DOMAIN"
$TextBox5.Top = 130
$TextBox5.Width = 120
$nul = $Panel1.Controls.Add($TextBox5)

$TextBox6 = $System.TextBox()
$TextBox6.Left = 370
$TextBox6.Text = "@LSERVER"
$TextBox6.Top = 160
$TextBox6.Width = 120
$nul = $Panel1.Controls.Add($TextBox6)

$TextBox7 = $System.TextBox()
$TextBox7.Left = 370
$TextBox7.Text = "@TIME"
$TextBox7.Top = 190
$TextBox7.Width = 120
$nul = $Panel1.Controls.Add($TextBox7)

$TextBox8 = $System.TextBox()
$TextBox8.Left = 370
$TextBox8.Text = "@IPADDRESS0"
$TextBox8.Top = 220
$TextBox8.Width = 120
$nul = $Panel1.Controls.Add($TextBox8)

$TextBox9 = $System.TextBox()
$TextBox9.Left = 20
$TextBox9.Text = "TextBox9"
$TextBox9.Top = 150
$TextBox9.Width = 220
$nul = $Panel1.Controls.Add($TextBox9)

$CompanyCompanyNetworkLogon.Show  ;Displays the Form

While $CompanyCompanyNetworkLogon.Visible

fn_Time()
fn_Network()
fn_GroupPolicy()
fn_Sysservice()
fn_EIAL()
fn_Intranet()
fn_Finished
fn_ExitForm()

   $Nul = Execute($CompanyCompanyNetworkLogon.DoEvents())
Loop

Exit 0

Function fn_Time()
$TextBox9.Text = "Synchronising time with logon server..."
  $ProgressBar1.Value = 5
  SetTime @lserver
  Sleep 1
EndFunction

Function fn_Network()
  $ProgressBar1.Value = 10
  :Network
   $TextBox9.Text = "Mapping netwrok shares..."
   ; Copy Lmhosts file to Local PC
   ; Copy "\\staff-srv1.company.co.uk\Sulogin$\lmhost\*.*" "%windir%\system32\drivers\etc\"
   
   ; Update progress bar
   If InGroup("Domain Users")
   $TextBox9.Text = "Mapping Department Share..."
   Use "k:" /DELETE
   Use "K:" "\\pollux.company.co.uk\APPS"
   Use "m:" /DELETE
   Use "p:" /DELETE
   Use "t:" /DELETE
   Use "q:" /DELETE
   Use "m:" "\\canopus.company.co.uk\mis"
   Use "p:" "\\canopus.company.co.uk\Public"
   Use "t:" "\\pollux.company.co.uk\Public"
   ; Use "q:" "\\student_srv2.company.co.uk\apps"
   ; $ProgressBar1.Value = 50
   EndIf
      
   If InGroup ("Profiles Database Users","Profiles Database Admin")
   $TextBox9.Text = "Mapping Profiles Database..."
   Use "G:" /DELETE
   Use "G:" "\\canopus.company.co.uk\GWDatabase"
   ; $ProgressBar1.Value = 25
   EndIf
   
   If InGroup ("Resouce")
   $TextBox9.Text = "Mapping Res32000..."
   Use "R:" /DELETE
   Use "R:" "\\canopus.company.co.uk\res32000"
   ; $ProgressBar1.Value = 30
   EndIf
   
   ; Update progress bar
   $TextBox9.Text = "Mapping Department Share..."
   If InGroup("CAS_MANAGERS","CAS_FINANCE","CAS_Marketing","NORMALADMIN","PERSONNEL_STAFF","AllCASStaff","CAS_STAFF","CASSEC","CUSTSERV")
   $TextBox9.Text = "Mapping CS Share..."
   Use "s:" /DELETE
   Use "s:" "\\canopus.company.co.uk\cs"
   ; $ProgressBar1.Value = 40
   EndIf
   
   ; Update progress bar
   If InGroup("QER","QER_MGT","Gatewood","Employability_Centre")
   $TextBox9.Text = "Mapping QER Share..."
   Use "s:" /DELETE
   Use "s:" "\\canopus.company.co.uk\qer"
   ; $ProgressBar1.Value = 40
   EndIf
   
   ; Update progress bar
   If InGroup("VPLB_Tutor","VPLB_PAMS","VPLB_Managers","VPLB_ADMIN","VPLB_STAFF")
   $TextBox9.Text = "Mapping VPLB Share..."
   Use "s:" /DELETE
   Use "s:" "\\canopus.company.co.uk\vplb"
   ; $ProgressBar1.Value = 40
   EndIf
   
   ; Update progress bar
   If InGroup("VPJS_SMT","VPJS_STAFF")
   $TextBox9.Text = "Mapping VPJS Share..."
   Use "s:" /DELETE
   Use "s:" "\\canopus.company.co.uk\vpjs"
   ; $ProgressBar1.Value = 40
   EndIf
   
   ; Update progress bar
   If InGroup("normaladmin")
   $TextBox9.Text = "Mapping IT Share..."
   Use "v:" /DELETE
   Use "w:" /DELETE
   ; Use "v:" "\\canopus.company.co.uk\itdept"
   Use "v:" "\\Suhail.company.co.uk\IT Dept"
   ; $ProgressBar1.Value = 45   
   EndIf
   
   ; Map Users Drives depending upon Login Name
   ; Update progress bar
   If @USERID = "knightG"
   $TextBox9.Text = "Mentor DB..."
   Use "o:" /DELETE
   Use "o:" "\\canopus.company.co.uk\mentordb"
   Use "z:" /DELETE
   Use "z:" "\\rigel.company.co.uk\import"
   ; $ProgressBar1.Value = 45
   EndIf
   If InGroup("MultiMedia")
   ; $TextBox9.Text = "Mapping Multimedia Share..."
   Use "t:" /DELETE
   Use "t:" "\\fomalhaut.company.co.uk\public"
   Use "u:" /DELETE
   Use "u:" "\\fomalhaut.company.co.uk\shared"
   Use "w:" /DELETE
   Use "w:" "\\fomalhaut.company.co.uk\dropbox"
   Use "x:" /DELETE
   Use "x:" "\\fomalhaut.company.co.uk\PrintJobs"   
   Use "Z:" /DELETE
   Use "Z:" "\\fomalhaut.company.co.uk\shared"
   ; $ProgressBar1.Value = 45            
   EndIf

EndFunction



Function fn_GroupPolicy()
  $ProgressBar1.Value = 20
   If (@PRODUCTTYPE = "Windows 2000 Professional")
   $TextBox9.Text = "Domain Policy Update..."
   Shell '%comspec% /c secedit.exe /refreshpolicy machine_policy /enforce > nul'
   Shell '%comspec% /c secedit.exe /refreshpolicy user_policy /enforce > nul'
   $TextBox9.Text = "Domain Policy Updated..."
   $ProgressBar1.Value = 60
   Return
   Else
   
   If ((@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
   $TextBox9.Text = "Domain Policy Update..."
   Shell '%comspec% /c gpupdate.exe > nul'
   $TextBox9.Text = "Domain Policy Updated..."
   EndIf
  Sleep 1
EndFunction

Function fn_Sysservice()
  $ProgressBar1.Value = 25
  :Sysservice
   If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
   Else
   Return
   EndIf
   $sysservice="%windir%"+"\system32\sysservice.exe"
   If (Exist($sysservice) = 0) ; --
   $TextBox9.Text = "Installing system service..."
   Copy "\\canopus.company.co.uk\Sulogin$\Sysservice\*.*" "%windir%\system32\"
   $TextBox9.Text = "System Service Installed..."
   EndIf
  Sleep 1
EndFunction

Function fn_EIAL()
$TextBox9.Text = "Macromedia Flash Configuration..."
  $ProgressBar1.Value = 30
   If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition")) ; Mapping Printer Connections depending upon machine name
   $EIAL1="\\pollux.company.co.uk\sulogin$\EIAL\"
   $EIALUSER="%userprofile%\Application Data\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\"
   Copy $EIAL1 + 'settings.sol' '$EIALUSER'
   EndIf
   Return
   
   
  Sleep 1
EndFunction

Function fn_Intranet()
  $ProgressBar1.Value = 35
If InGroup("normaladmin","SuperAdmin")
Return
Else
$TextBox9.Text = "Loading Intranet..."
$ie=ReadValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE','')
Run $ie+' http://intranet'            
EndIf
Return   

   
  Sleep 1
EndFunction




Function fn_Finished()
$TextBox9.Text = "Logon Completed..."
$ProgressBar1.Value = 100
  $ProgressBar1.Value = 100
EndFunction

Function fn_ExitForm()
$ProgressBar1.Value = 100
Sleep 5
Exit
Quit
   Quit()
EndFunction
Back to top
View user's profile Send private message
5861king
KiXforms Follower
KiXforms Follower


Joined: 23 Jan 2005
Posts: 15

PostPosted: Tue Oct 30, 2007 4:45 pm    Post subject: Reply with quote

O.k. I changed the progressbar to increase by 10 for each function that is run. but still the progress bar only appears half way.

Code:

Break on
FlushKB ;Clears the keyboard buffer
$NUL=SetConsole("HIDE")
$NUL=SetConsole("Alwaysontop")
; SetConsole("Alwaysontop") = 0
; SetConsole("HIDE") = 0
$bin="\\canopus.company.co.uk\Sulogin$\ccforms\"
$ccform="$bin"+"\ccform.exe"
    Shell '%comspec% /q /c "$ccform"'
CLS
$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

$CompanyNetworkLogon = $System.Form()
$CompanyNetworkLogon.ControlBox = 0  ;True
$CompanyNetworkLogon.FormBorderStyle = 1  ;FormBorderStyle_FixedSingle
$CompanyNetworkLogon.MaximizeBox = 0  ;False
$CompanyNetworkLogon.MinimizeBox = 0  ;False
$CompanyNetworkLogon.ShowInTaskbar = 0  ;False
$CompanyNetworkLogon.StartPosition = 1  ;FormStartPosition_CenterScreen
$CompanyNetworkLogon.Size = $System.Size(510,325) ;(Width,Height)
$CompanyNetworkLogon.Text = "company Company Network Logon"

$Panel1 = $System.Panel()
$Panel1.Dock = 5  ;Fill
$nul = $CompanyNetworkLogon.Controls.Add($Panel1)

$PictureBox1 = $System.PictureBox()
$PictureBox1.BorderStyle = 1  ;FixedSingle
$PictureBox1.Height = 121
$PictureBox1.Left = 20
$PictureBox1.Top = 10
$PictureBox1.Width = 228
$nul = $Panel1.Controls.Add($PictureBox1)

$PictureBox1.Image = PictureBox1Image()

$Label1 = $System.Label()
$Label1.Left = 270
$Label1.Text = "User ID :"
$Label1.Top = 10
$nul = $Panel1.Controls.Add($Label1)

$Label2 = $System.Label()
$Label2.Left = 270
$Label2.Text = "Full Name :"
$Label2.Top = 40
$nul = $Panel1.Controls.Add($Label2)

$Label3 = $System.Label()
$Label3.Left = 270
$Label3.Text = "Privilege :"
$Label3.Top = 70
$nul = $Panel1.Controls.Add($Label3)

$Label4 = $System.Label()
$Label4.Left = 270
$Label4.Text = "Workstation :"
$Label4.Top = 100
$nul = $Panel1.Controls.Add($Label4)

$Label5 = $System.Label()
$Label5.Left = 270
$Label5.Text = "Domain :"
$Label5.Top = 130
$nul = $Panel1.Controls.Add($Label5)

$Label6 = $System.Label()
$Label6.Left = 270
$Label6.Text = "Logon Server :"
$Label6.Top = 160
$nul = $Panel1.Controls.Add($Label6)

$Label7 = $System.Label()
$Label7.Left = 270
$Label7.Text = "Current Time :"
$Label7.Top = 190
$nul = $Panel1.Controls.Add($Label7)

$Label8 = $System.Label()
$Label8.Left = 270
$Label8.Text = "IP Address :"
$Label8.Top = 220
$nul = $Panel1.Controls.Add($Label8)

$ProgressBar1 = $System.ProgressBar()
$ProgressBar1.Height = 20
$ProgressBar1.Left = 10
$ProgressBar1.Text = ""
$ProgressBar1.Top = 260
$ProgressBar1.Width = 480
$ProgressBar1.Value = 0
$nul = $Panel1.Controls.Add($ProgressBar1)

$TextBox1 = $System.TextBox()
$TextBox1.Left = 370
$TextBox1.Text = "@USERID"
$TextBox1.Top = 10
$TextBox1.Width = 120
$nul = $Panel1.Controls.Add($TextBox1)

$TextBox2 = $System.TextBox()
$TextBox2.Left = 370
$TextBox2.Text = "@FULLNAME"
$TextBox2.Top = 40
$TextBox2.Width = 120
$nul = $Panel1.Controls.Add($TextBox2)

$TextBox3 = $System.TextBox()
$TextBox3.Left = 370
$TextBox3.Text = "@PRIV"
$TextBox3.Top = 70
$TextBox3.Width = 120
$nul = $Panel1.Controls.Add($TextBox3)

$TextBox4 = $System.TextBox()
$TextBox4.Left = 370
$TextBox4.Text = "@WKSTA"
$TextBox4.Top = 100
$TextBox4.Width = 120
$nul = $Panel1.Controls.Add($TextBox4)

$TextBox5 = $System.TextBox()
$TextBox5.Left = 370
$TextBox5.Text = "@DOMAIN"
$TextBox5.Top = 130
$TextBox5.Width = 120
$nul = $Panel1.Controls.Add($TextBox5)

$TextBox6 = $System.TextBox()
$TextBox6.Left = 370
$TextBox6.Text = "@LSERVER"
$TextBox6.Top = 160
$TextBox6.Width = 120
$nul = $Panel1.Controls.Add($TextBox6)

$TextBox7 = $System.TextBox()
$TextBox7.Left = 370
$TextBox7.Text = "@TIME"
$TextBox7.Top = 190
$TextBox7.Width = 120
$nul = $Panel1.Controls.Add($TextBox7)

$TextBox8 = $System.TextBox()
$TextBox8.Left = 370
$TextBox8.Text = "@IPADDRESS0"
$TextBox8.Top = 220
$TextBox8.Width = 120
$nul = $Panel1.Controls.Add($TextBox8)

$TextBox9 = $System.TextBox()
$TextBox9.Left = 20
$TextBox9.Text = "TextBox9"
$TextBox9.Top = 150
$TextBox9.Width = 220
$nul = $Panel1.Controls.Add($TextBox9)

$CompanyNetworkLogon.Show  ;Displays the Form

; While $CompanyNetworkLogon.Visible
 
fn_Time()
fn_Network()
fn_Mappritner()
fn_GroupPolicy()
fn_Sysservice()
fn_EIAL()
fn_Intranet()
fn_Shortcuts()
fn_Favorites()
fn_Registry1()
fn_Finished
fn_ExitForm()

; $Nul = Execute($CompanyNetworkLogon.DoEvents())
; Loop

Exit 0

 

Function fn_Time()
$TextBox9.Text = "Synchronising time with logon server..."
  $ProgressBar1.Value = 10
  SetTime @lserver
  Sleep 1
EndFunction

Function fn_Network()
  $ProgressBar1.Value = 20
  :Network
   $TextBox9.Text = "Mapping netwrok shares..."
   ; Copy Lmhosts file to Local PC
   ; Copy "\\staff-srv1.company.co.uk\Sulogin$\lmhost\*.*" "%windir%\system32\drivers\etc\"
   
   ; Update progress bar
   If InGroup("Domain Users")
   $TextBox9.Text = "Mapping Department Share..."
   Use "k:" /DELETE
   Use "K:" "\\pollux.company.co.uk\APPS"
   Use "m:" /DELETE
   Use "p:" /DELETE
   Use "t:" /DELETE
   Use "q:" /DELETE
   Use "m:" "\\canopus.company.co.uk\mis"
   Use "p:" "\\canopus.company.co.uk\Public"
   Use "t:" "\\pollux.company.co.uk\Public"
   ; Use "q:" "\\srv2.company.co.uk\apps"
   EndIf   
EndFunction

Function fn_Mappritner()
  $ProgressBar1.Value = 30
   If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition")) ; Mapping Printer Connections depending upon machine name
   Else
   Return
   EndIf
   $TextBox9.Text = "Mapping Printers..."
   $printbat="%systemdrive%"+"\print.bat"
   If (Exist($printbat) = 1) ; -- Runs print.bat if file exist
   Shell '%comspec% /q /c "c:\print.bat"'
   EndIf
   If InStr(@WKSTA,"Mez25") > 0
   $x = AddPrinterConnection("\\print_srv02\PDC1")
   $x = AddPrinterConnection("\\print_srv02\PDC2")
   SetDefaultPrinter("\\print_srv02\PDC2")
   EndIf
   $TextBox9.Text = "Mapped Printers..."
  Sleep 1
EndFunction

Function fn_GroupPolicy()
  $ProgressBar1.Value = 40
   If (@PRODUCTTYPE = "Windows 2000 Professional")
   $TextBox9.Text = "Domain Policy Update..."
   Shell '%comspec% /c secedit.exe /refreshpolicy machine_policy /enforce > nul'
   Shell '%comspec% /c secedit.exe /refreshpolicy user_policy /enforce > nul'
   $TextBox9.Text = "Domain Policy Updated..."
   Return
   Else
   
   If ((@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
   $TextBox9.Text = "Domain Policy Update..."
   Shell '%comspec% /c gpupdate.exe > nul'
   $TextBox9.Text = "Domain Policy Updated..."
   EndIf
  Sleep 1
EndFunction

Function fn_Sysservice()
  $ProgressBar1.Value = 50
  :Sysservice
   If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
   Else
   Return
   EndIf
   $sysservice="%windir%"+"\system32\sysservice.exe"
   If (Exist($sysservice) = 0) ; --
   $TextBox9.Text = "Installing system service..."
   Copy "\\canopus.company.co.uk\Sulogin$\Sysservice\*.*" "%windir%\system32\"
   $TextBox9.Text = "System Service Installed..."
   EndIf
  Sleep 1
EndFunction

Function fn_EIAL()
$TextBox9.Text = "Macromedia Flash Configuration..."
  $ProgressBar1.Value = 60
   If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition")) ; Mapping Printer Connections depending upon machine name
   $EIAL1="\\pollux.company.co.uk\sulogin$\EIAL\"
   $EIALUSER="%userprofile%\Application Data\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\"
   Copy $EIAL1 + 'settings.sol' '$EIALUSER'
   EndIf
   Return
  Sleep 1
EndFunction

Function fn_Intranet()
  $ProgressBar1.Value = 70
If InGroup("normaladmin","SuperAdmin")
Return
Else
$TextBox9.Text = "Loading Intranet..."
$ie=ReadValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE','')
Run $ie+' http://intranet'            
EndIf
Return   
  Sleep 1
EndFunction

Function fn_Shortcuts()
  $ProgressBar1.Value = 80
If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
Else
Return
EndIf
Shell '%comspec% /q /c xcopy /c /q /g /r /y /d "\\canopus.company.co.uk\sulogin$\shortcuts\*.*" "%userprofile%\Desktop\"'
Return
  Sleep 1
EndFunction

Function fn_Favorites()
  $ProgressBar1.Value = 90   
If ((@PRODUCTTYPE = "Windows 2000 Professional") Or (@PRODUCTTYPE = "Windows XP Professional") Or (@PRODUCTTYPE = "Windows Vista Business Edition"))
Else
Return
EndIf
Shell '%comspec% /q /c xcopy /c /q /g /r /y /d "\\canopus.company.co.uk\sulogin$\Favorites\*.*" "%userprofile%\Favorites\"'
Return   
  Sleep 1
EndFunction

Function fn_Registry1()
  $ProgressBar1.Value = 100
If InGroup("Domain Users")
$TextBox9.Text = "Registry Changes..."
$CheckKey = KeyExist ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\company.co.uk")
EndIf
Return   
  Sleep 1
EndFunction

Function fn_Finished()
$TextBox9.Text = "Logon Completed..."
$ProgressBar1.Value = 100
  $ProgressBar1.Value = 100
EndFunction

Function fn_ExitForm()
$ProgressBar1.Value = 100
Sleep 5
Quit
   Quit()
EndFunction
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Tue Oct 30, 2007 5:28 pm    Post subject: Reply with quote

try using the AdvanceProgressBar() Function i provided in the earlier post, i think you will like it much better.
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
5861king
KiXforms Follower
KiXforms Follower


Joined: 23 Jan 2005
Posts: 15

PostPosted: Tue Oct 30, 2007 6:56 pm    Post subject: Reply with quote

benny69 wrote:
try using the AdvanceProgressBar() Function i provided in the earlier post, i think you will like it much better.


Hi benny69, thanks for the advice will give that a try, but I have just got home and tried the code that I posted earlier today on my Windows XP machine, guess what it worked fine without any glitches. However run it on my Vista machine at work and it goes all weird.

Could this be a bug?

Optimal
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Tue Oct 30, 2007 7:02 pm    Post subject: Reply with quote

on your machine at work (Vista) is User Acount Control turned on? If it is, I am sure that is part of your problem. With UAC turned on many things are not alowed to run with out user intervention or some times not at all.
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
5861king
KiXforms Follower
KiXforms Follower


Joined: 23 Jan 2005
Posts: 15

PostPosted: Tue Oct 30, 2007 7:05 pm    Post subject: Reply with quote

Nope UAC is turned off, its just when you run the Logon Script On vista the progress bar does not progress in a smooth manor. However you take the same exe and run it in Windows XP all works well. However this problem does not seem to exist on Kixforms Classic.
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Tue Oct 30, 2007 7:51 pm    Post subject: Reply with quote

Shawn,

what are your thoughts on this?

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Tue Oct 30, 2007 7:55 pm    Post subject: Reply with quote

King,

check out this thread over at Korg:

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=182111&Main=24747#Post182111

maybe the problem that Glen had is the same as yours.

maybe not

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
5861king
KiXforms Follower
KiXforms Follower


Joined: 23 Jan 2005
Posts: 15

PostPosted: Wed Oct 31, 2007 12:44 pm    Post subject: Reply with quote

Hi benny,

After alot of playing around, I think it might be a bug, the reason why I say this is that when I run this code and your code under Windows XP all works well without a problem. but when i run this code under Vista the progress bar does not corispond to progress number.

for example

$ProgressBar1.Value = 100 should mean fill the whole progress bar

this works well under xp but if you use this option under vista it only fills half of the progress bar. even when I run your code it does the same thing.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group