#89969 - 2002-11-29 10:06 PM
Re: KixForms and the Cancel button
|
ArchAngel96
Getting the hang of it
Registered: 2002-10-20
Posts: 70
|
This is what I have so far. If you look at all my posts, you'll see what all I'm trying to do with this little wanna be "program". As far as looking like your's, not sure but I've used others work as examples for what it is that I'm trying to accomplish. I appologise if I'm stepping on anyone's "toes". I'm really just trying to teach myself kix and kixforms by doing this little exercise.
code:
Break On Dim $Intro Dim $Button2, $Button1 $x = 0
$Intro = CreateObject("Kixtart.Form") $Intro.Icon = "SHELL32.DLL;19"
$Intro.Caption = "Hardware Inventory" $Intro.SCALEHEIGHT = 402 $Intro.SCALEWIDTH = 600 $Intro.FONTNAME = "Arial" $Intro.FONTSIZE = 9 $Intro.CENTER
$fraBanner = $Intro.PictureBox $fraBanner.BACKCOLOR = $Intro.RGB(255,255,255) $fraBanner.HEIGHT = 70 $fraBanner.Left = 10 $fraBanner.TOP = 10 $fraBanner.WIDTH = 585
$picBanner = $fraBanner.Image $picBanner.Picture = "shell32.dll;16" $picBanner.HEIGHT = 60 $picBanner.Left = 5 $picBanner.TOP = 5 $picBanner.WIDTH = 60
; Draw on the banner $fraBanner.FONTSIZE = 12 $fraBanner.FONTNAME = "verdana" $fraBanner.ForeColor = 0 $fraBanner.PrintXY(70,0,"This program is used to conduct a hardware inventory on") $fraBanner.PrintXY(70,15,"the selected computers within the domain via remote.") $fraBanner.PrintXY(70,30,"The information is retrieved with the use of WMI.") $fraBanner.FONTBOLD = 1 $fraBanner.FONTSIZE = 10 $fraBanner.ForeColor = $Intro.RGB(0,100,100) $fraBanner.PrintXY(73,46,"Powered by KiX v@KIX AND Kixforms v"+$Form.Version) $fraBanner.FONTBOLD = 0 $fraBanner.FONTSIZE = 10
$Button1 = $Intro.CommandButton("Get List") $Button1.FontSize = 12 $Button1.Left = 25 $Button1.Top = 115 $Button1.Width = 100 $Button1.Height = 25 $Button1.OnClick = "cmdGet_List()"
$fraGetList = $Intro.Frame("Details") $fraGetList.HEIGHT = 75 $fraGetList.Left = 135 $fraGetList.TOP = 85 $fraGetList.WIDTH = 435
$Intro.FONTSIZE = 12 $Intro.FONTNAME = "verdana" $Intro.ForeColor = 0 $Intro.PrintXY(145,101,"This will get a list of computers on the current ") $Intro.PrintXY(145,117,"domain. The search paramiters for this search will ") $Intro.PrintXY(145,135,"be: All, Corporate or Store Machines.")
$Button2 = $Intro.CommandButton("Get" + Chr(13) + Chr(10) + "Inventory") $Button2.MultiLine = 1 $Button2.FONTNAME = "verdana" $Button2.FontSize = 12 $Button2.Left = 25 $Button2.Top = 200 $Button2.Width = 100 $Button2.Height = 50
$Intro.FONTNAME = "Arial" $Intro.FONTSIZE = 9 $fraGetInvent = $Intro.Frame("Details") $fraGetInvent.HEIGHT = 75 $fraGetInvent.Left = 135 $fraGetInvent.TOP = 185 $fraGetInvent.WIDTH = 435
$Intro.FONTSIZE = 11 $Intro.FONTNAME = "verdana" $Intro.ForeColor = 0 $Intro.PrintXY(145,200,"Use the selected list to conduct a hardware inventory.") $Intro.PrintXY(145,216,"The inventory will get model type and hardware info ") $Intro.PrintXY(145,235,"and port the data to a CSV file on DC01")
$ButtonExit = $Intro.CommandButton("Exit") $ButtonExit.FONTNAME = "Arial" $ButtonExit.FONTSIZE = 10 $ButtonExit.FONTBOLD = 1 $ButtonExit.TOP = 367 $ButtonExit.WIDTH = 129 $ButtonExit.HEIGHT = 23 $ButtonExit.Left = 445 $ButtonExit.OnClick = "quit()"
$Intro.Show While $Intro.Visible $=Execute($Intro.DoEvents) Loop
Exit 1
Function cmdGet_List()
Dim $Wait
$Wait = CreateObject("Kixtart.FORM") $Wait.CAPTION = "Select a Target" $Wait.SCALEWIDTH = 200 $Wait.SCALEHEIGHT = 250 $Wait.FONTSIZE = 12 $Wait.FONTNAME = "Arial" $Wait.PrintXY(20,20,"Select Computer Type") $Wait.CENTER
$Corporate = $Wait.OptionButton $Corporate.FONTSIZE = 11 $Corporate.FONTNAME = "Arial" $Corporate.Caption = "Corporate" $Corporate.Left = 45 $Corporate.Top = 50 $Corporate.Width = 100 $Corporate.Height = 25 $Corporate.OnClick = "$$x=1"
$Stores = $Wait.OptionButton $Stores.Caption = "Stores" $Stores.Left = 45 $Stores.Top = 80 $Stores.Width = 100 $Stores.Height = 25 $Stores.OnClick = "$$x=2"
$All = $Wait.OptionButton $All.Caption = "All Units" $All.Left = 45 $All.Top = 110 $All.Width = 100 $All.Height = 25 $All.OnClick = "$$x=3"
$Failed = $Wait.OptionButton $Failed.Caption = "Failed List" $Failed.Left = 45 $Failed.Top = 140 $Failed.Width = 130 $Failed.Height = 25 $Failed.OnClick = "$$x=4"
$Button2 = $Wait.CommandButton("Ok") $Button2.Left = 25 $Button2.Top = 205 $Button2.Width = 50 $Button2.Height = 25 $Button2.OnClick = "$$Wait.Tag=1" ; <--- here
$Button3 = $Wait.CommandButton("Cancel") $Button3.Left = 105 $Button3.Top = 205 $Button3.Width = 75 $Button3.Height = 25 $Button3.OnClick = 0 $Button3.OnClick = "$$Wait.Tag=2" ; <--- and here
$Wait.Tag = 0 ; <--- here $Wait.Show $Wait.Refresh
While $Wait.Visible AND NOT $Wait.Tag ; <--- here $=Execute($Wait.DoEvents) Loop
If $Wait.Tag = 1 Goto cmdList() EndIf
EndFunction
Function cmdList()
$temp = "%temp%\netview.tmp" $list = "%temp%\list.tmp"
Shell '%comspec% /c net view >"$temp"'
Select Case $x=1 ;-------------------------------- ; For all systems ;-------------------------------- If Open(1,"$temp") = 0 $line = ReadLine(1) While @error=0 If $line AND SubStr($line,1,4) = "\\S0" OR $line AND SubStr($line,1,3) = "\\W" OR $line AND SubStr($line,1,3) = "\\L" $hostname=SubStr($line,3,InStr($line," ")-1) Open(2, "$list", 5) = 0 WriteLine(2, $hostname + Chr(13) + Chr(10)) Close(2) EndIf $line = ReadLine(1) Loop $_ = Close(1) EndIf
Case $x=2 ;------------------------------------- ; if statement for S' ;------------------------------------- If Open(1,"$temp") = 0 $line = ReadLine(1) While @error=0 If $line AND SubStr($line,1,4) = "\\S0" $hostname=SubStr($line,3,InStr($line," ")-1) Open(2, "$list", 5) = 0 WriteLine(2, $hostname + Chr(13) + Chr(10)) Close(2) EndIf $line = ReadLine(1) Loop $_ = Close(1) EndIf
Case $x=3 ;----------------------------------- ; if statement for Corporate ;----------------------------------- If Open(1,"$temp") = 0 $line = ReadLine(1) While @error=0 If $line AND SubStr($line,1,3) = "\\W" OR $line AND SubStr($line,1,3) = "\\L" $hostname=SubStr($line,3,InStr($line," ")-1) ?"hostname=" $hostname Open(2, "$list", 5) = 0 WriteLine(2, $hostname + Chr(13) + Chr(10)) Close(2) EndIf $line = ReadLine(1) Loop $_ = Close(1) EndIf
Case $x=4 ;--------------------------------- ; use the failed list to run the ; inventory against. ;---------------------------------
EndFunction
[ 29. November 2002, 22:07: Message edited by: ArchAngel96 ]
_________________________
penny = the target
the playing field = three football fields side by side
you = only allowed to stand on the outside of the playing field
tool you get to use to find the penny = a ONE INCH LAWN DART
get the level of difficulty?
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 846 anonymous users online.
|
|
|