here is a demo script posted by Shawn on kf.org:


Break On

$System = CreateObject("Kixtart.System")

$Form = $System.Form()
$Form.Size = 600,400
$Form.Text = "Kixpad"
$Form.FontName = "Tahoma"
$Form.FontSize = 8.25

$CommandLabel = $Form.Controls.Add("Label")
$CommandLabel.Left = 5
$CommandLabel.Top = 5
$CommandLabel.Width = 65
$CommandLabel.Text = "Command:"
$CommandLabel.TextAlign = "MiddleLeft"

$CommandTextBox = $Form.Controls.Add("TextBox")
$CommandTextBox.Top = $CommandLabel.Top
$CommandTextBox.Left = $CommandLabel.Right
$CommandTextBox.Right = $Form.ClientWidth - 90
$CommandTextBox.Anchor = 13
$CommandTextBox.Text = 'cmd /c dir %%systemroot%%'

$ExecuteButton = $Form.Controls.Add("Button")
$ExecuteButton.Text = "Execute"
$ExecuteButton.Top = $CommandLabel.Top
$ExecuteButton.Left = $CommandTextBox.Right + 10
$ExecuteButton.Anchor = 9
$ExecuteButton.OnClick = "ExecuteButton_Click()"

$ListingTextBox = $Form.Controls.Add("TextBox")
$ListingTextBox.MultiLine = "True"
$ListingTextBox.ScrollBars = "Both"
$ListingTextBox.Left = 5
$ListingTextBox.Top = $CommandLabel.Bottom + 5
$ListingTextBox.Right = $Form.ClientWidth - 5
$ListingTextBox.Bottom = $Form.ClientHEight - 35
$ListingTextBox.Anchor = 15
$ListingTextBox.FontName = "Courier New"
$ListingTextBox.FontSize = 10
$ListingTextBox.BackColor = "Black"
$ListingTextBox.ForeColor = "White"
$ListingTextBox.MaxLength = 0

$StyleLabel = $Form.Controls.Add("Label")
$StyleLabel.Left = 5
$StyleLabel.Top = $ListingTextBox.Bottom + 5
$StyleLabel.Width = 80
$StyleLabel.Text = "Window Style"
$StyleLabel.TextAlign = "MiddleLeft"

$StyleComboBox = $Form.Controls.Add("ComboBox")
$StyleComboBox.Top = $StyleLabel.Top
$StyleComboBox.Left = $StyleLabel.Right
$StyleComboBox.Width = 150
$StyleComboBox.DropDownStyle = 2

$WindowStyles = "Hidden", "Normal (focus)", "Minimized (focus)", "Maximized", "Normal", "Minimized"

For Each $Style In $WindowStyles
 $= $StyleComboBox.AddItem($Style)
Next

$StyleComboBox.ListIndex = 4

$CloseButton = $Form.Controls.Add("Button")
$CloseButton.Top = $ListingTextBox.Bottom + 5
$CloseButton.Text = "Close"
$CloseButton.Left = $ExecuteButton.Left
$CloseButton.Anchor = 10
$CloseButton.OnClick = "CloseButton_Click()"

$Form.AcceptButton = $ExecuteButton
$Form.CancelButton = $CloseButton

$Form.Center
$Form.Show

$CommandTextBox.Focus

While $Form.Visible
 $= Execute($Form.DoEvents)
Loop

Exit 0

Function CloseButton_Click()
 $Form.Hide
EndFunction

Function ExecuteButton_Click()

 $WindowStyle = $StyleComboBox.ListIndex

 $ListingTextBox.Text = $System.Shell($CommandTextBox.Text,$WindowStyle,3)

EndFunction


You can set the WindowStyle to hidden, thus no console popup happens, and instead of assigning the console output to a TextBox text property you can assign it to a variable for later analysis \:\)


Edited by Jochen (2007-10-24 01:13 PM)
_________________________