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
Script Archive
Tracking Systems

KiXforms Progressbar Example

Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive
View previous topic :: View next topic  
Author Message
KiXforms Aficionado
KiXforms Aficionado

Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Fri Jun 20, 2003 2:57 am    Post subject: KiXforms Progressbar Example Reply with quote

The following is a simple stand-alone progress bar script. It requires the latest version of KiXForms and demonstrates the use of a timer object and some progressbar methods.

; displays a progress bar for a certain amount of time

; 2003-06-18   v1.0   Passed inital code review

; remove any type of debugging on production systems
break off
debug off

dim $iRC


; dim the form objects
global $frmForceWait, $prgWaitBar, $tmrWaitTimer, $lblForceWait

dim $sINIFile, $iForceWait, $iSteps, $sLocalKiXForms, $sWindowsKiXForms, $sFormTitle
dim $iMargin, $iFormHeight, $iFormWidth, $iElementHeight

; check for current KiXForms DLL
if exist($sLocalKiXForms)
  case not exist($sWindowsKiXForms)
    copy $sLocalKiXForms $sWindowsKiXForms
    shell 'regsvr32 /s '+$sWindowsKiXForms
  case comparefiletimes($sLocalKiXForms,$sWindowsKiXForms)<>0
    shell 'regsvr32 /u /s '+$sWindowsKiXForms
    copy $sLocalKiXForms $sWindowsKiXForms
    shell 'regsvr32 /s '+$sWindowsKiXForms
  case getfileversion($sLocalKiXForms,'FileVersion')<>getfileversion($sWindowsKiXForms,'FileVersion')
    shell 'regsvr32 /u /s '+$sWindowsKiXForms
    copy $sLocalKiXForms $sWindowsKiXForms
    shell 'regsvr32 /s '+$sWindowsKiXForms

; set the waiting time in seconds
if not $iForceWait

; convert the waiting time to milliseconds for the timer

; initialize the form
$iMargin = 4
$iFormWidth = 300

$frmForceWait = CreateObject('Kixtart.Form')
if vartype($frmForceWait)<>9 or @ERROR
  sleep $iForceWait
  exit 0

if not $sFormTitle
  $sFormTitle='Sysprep LAN Integration Utility'

; create form itself
$frmForceWait.ClientWidth   = $iFormWidth
$frmForceWait.ClientHeight  = $iFormHeight
$frmForceWait.FontSize      = 10
$frmForceWait.Text          = $sFormTitle
$frmForceWait.TopMost       = 1
$frmForceWait.BorderStyle   = 1
$frmForceWait.ControlBox    = 0
$frmForceWait.ShowInTaskBar = 0

; create the label
$lblForceWait        = $frmForceWait.label('Initializing Components')
$lblForceWait.Width  = $frmForceWait.ClientWidth - 2*$iMargin
$lblForceWait.Height = $iElementHeight
$lblForceWait.Left   = $iMargin
$lblForceWait.Top    = $iMargin

; create the progressbar
$prgWaitBar         = $frmForceWait.progressbar()
$prgWaitBar.Width   = $frmForceWait.ClientWidth - 2*$iMargin
$prgWaitBar.Height  = $iElementHeight
$prgWaitBar.Left    = $lblForceWait.Left
$prgWaitBar.Top     = $lblForceWait.Top+$iElementHeight+$iMargin
$prgWaitBar.Value   = 0
$   = 1
$prgWaitBar.minimum = 0
$prgWaitBar.maximum = $iForceWait
$prgWaitBar.step    = $iSteps

; create the timer
$tmrWaitTimer          = $frmForceWait.timer()
$tmrWaitTimer.Interval = $iSteps
$tmrWaitTimer.OnTimer  = '$prgWaitBar.PerformStep()'

; display the form
$frmForceWait.ShowInTaskBar = 0
While $frmForceWait.Visible and $prgWaitBar.value<$prgWaitBar.maximum
  $iRC = Execute($frmForceWait.DoEvents())
$frmForceWait.TopMost = 0

exit 0


'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive All times are GMT
Page 1 of 1

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