Is there a way that I can break out of the runscripts function when the start button is pressed. It locks up until it completes all the the scripts in the ini file.

Code:
;===============================================================================================

;**** Last Modified on 10/18/2004 at 2:29:07 PM by dkrogol ****
;===============================================================================================

Break On

$System = CreateObject("Kixtart.System")

;KD START

;************* Form **************
$Form = $System.Form()
$Form.BackColor = 192,192,192
$Form.ForeColor = 0,128,0
$Form.Height = 550
$Form.Left = 88
$Form.Text = "Company Laptop Utility - @fullname - @wksta"
$Form.Top = 104
$Form.Width = 700
;**************************************

;************* ListView **************
$ListView = $Form.Controls.ListView()
$ListView.Height = 472
$ListView.HeaderStyle = 2
$ListView.Left = 0
$ListView.Top = 30
$ListView.Width = 698
$ListView.OnDoubleClick = "readlog"
;**************************************

;************* startbutton **************
$startbutton = $Form.Controls.Button()
$startbutton.Cancel = "True"
$startbutton.Default = "True"
$startbutton.FlatStyle = 3
$startbutton.FontBold = "True"
$startbutton.Height = 22
$startbutton.Left = 15
$startbutton.Text = "Start"
$startbutton.ToolTipText = "Executes daily tasks"
$startbutton.Top = 4
$startbutton.Width = 69
$startbutton.OnClick = "runscripts()"
;**************************************

;************* Exit **************
$Exit = $Form.Controls.Button()
$Exit.FlatStyle = 3
$Exit.FontBold = "True"
$Exit.Height = 22
$Exit.Left = 615
$Exit.Text = "Exit "
$Exit.ToolTipText = "Exit application"
$Exit.Top = 4
$Exit.Width = 71
$Exit.OnClick = "Quit()"
;**************************************

;************* logo **************
$logo = $Form.Controls.PictureBox()
$logo.BackColor = 192,192,192
$logo.BorderStyle = 0
$logo.Height = 50
$logo.Left = 285
$logo.Picture = "c:\mtglaptop\bmp\logo1.bmp"
$logo.Top = 0
$logo.Width = 125
;**************************************

;************* user **************
$user = $Form.Controls.Label()
$user.BackColor = 192,192,192
$user.FontBold = "True"
$user.ForeColor = 0,0,0
$user.Height = 13
$user.Left = 105
$user.Text = "User: @fullname"
$user.Top = 9
$user.Width = 160
;**************************************

;************* PCName **************
$PCName = $Form.Controls.Label()
$PCName.BackColor = 192,192,192
$PCName.FontBold = "True"
$PCName.ForeColor = 0,128,64
$PCName.Height = 15
$PCName.Left = 15
$PCName.Text = "Computer Name: @wksta"
$PCName.Top = 510
$PCName.Width = 211
;**************************************

;************* ipaddress **************
$ipaddress = $Form.Controls.Label()
$ipaddress.BackColor = 192,192,192
$ipaddress.FontBold = "True"
$ipaddress.ForeColor = 0,128,0
$ipaddress.Height = 16
$ipaddress.Left = 510
$ipaddress.Text = "IP Address: @ipaddress0"
$ipaddress.Top = 510
$ipaddress.Width = 171
;**************************************

;************* Date_Day **************
$Date_Day = $Form.Controls.Label()
$Date_Day.BackColor = 192,192,192
$Date_Day.FontBold = "True"
$Date_Day.ForeColor = 0,128,0
$Date_Day.Height = 15
$Date_Day.Left = 285
$Date_Day.Text = "@day - @Monthno/@Mdayno/@year"
$Date_Day.Top = 502
$Date_Day.Width = 128
;**************************************

;KD END


$= $ListView.Columns.Add("Job",175)
$= $ListView.Columns.Add("Start",100)
$= $listview.Columns.Add("End",100)
$= $ListView.Columns.Add("Logfile",200)
$= $ListView.Columns.Add("Status",119)


$Form.Show
While $Form.Visible
$=Execute($System.Application.DoEvents())
$item=$listview.items.add
$Item.SubItems(0).Text = ("Session Completed Sucessfully")
Loop
Exit 1

Function runscripts ()
$form.Refresh()
Del "c:\mtglaptop\logs\*.*"
If Exist($inifile)
$ScriptArray = Split(ReadProfileString($inifile,"",""),Chr(10))
For Each $script in $ScriptArray
If Val(ReadProfileString($inifile,$script,"run"))
$starttime=@TIME
$message=ReadProfileString($inifile,$script,"message")
$log=ReadProfileString($inifile,$script,"log")
If $testrun=3
MessageBox ("Requestable job available. Do you want to run $message?","Requestable job",36,0)
EndIf
$item=$listview.items.add
$Item.SubItems(0).Text = ($message)
$Item.SubItems(1).Text = ($starttime);(@FULLNAME +"\"+ @USERID)
$Item.SubItems(3).Text = ($log)
$Item.SubItems(4).Text = ("Running")
Select
Case InStr ($script,".exe")
Shell $script
Case InStr ($script,".kix")
Call $script
EndSelect
Do
Sleep 0.5
Until
Exist ("c:\mtglaptop\logs\"+$log)
$Item.SubItems(2).Text=(@time)
$Item.SubItems(4).Text=("Complete")

EndIf
Next
EndFunction




Edited by Fugazi (2004-10-18 09:51 PM)
_________________________
I haven't failed. I just found another way that did not work.