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

ScriptOMatic .Net

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Tue Nov 13, 2007 5:41 pm    Post subject: ScriptOMatic .Net Reply with quote

After playing around a little bit this project is loosely based on Chris S's KixoMatic. I basically completely rewrote it in KiXforms.net and added support for more info then only Win32 plus adding support to show/run the code in VBS. It's not completely finished yet but everything works Smile
Without further ado:
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

$Form1 = $System.Form()
$Form1.Left = 0
$Form1.StartPosition = 0  ;FormStartPosition_Manual
$Form1.Size = $System.Size(604,588) ;(Width,Height)
$Form1.Text = "ScriptOMatic .Net"
$Form1.Top = 0
$Form1.TopMost = 0  ;False

$ComboBox1 = $System.ComboBox()
$ComboBox1.Anchor = 13 ;Left,Top,Right
$ComboBox1.IntegralHeight = 0
$ComboBox1.ItemHeight = 25
$ComboBox1.Left = 10
$ComboBox1.Text = "Begin by selecting a class"
$ComboBox1.Top = 10
$ComboBox1.Width = 410
$ComboBox1.Sorted = 1
$ComboBox1.SelectedIndexChanged = "$$=CheckType()"
$nul = $Form1.Controls.Add($ComboBox1)

$Button1 = $System.Button()
$Button1.Anchor = 9 ;Top,Right
$Button1.Left = 430
$Button1.Text = "Run"
$Button1.Top = 10
$Button1.Width = 40
$Button1.Click = "RunScript()"
$nul = $Form1.Controls.Add($Button1)

$Button2 = $System.Button()
$Button2.Anchor = 9 ;Top,Right
$Button2.Left = 470
$Button2.Text = "Save"
$Button2.Top = 10
$Button2.Width = 40
$Button2.Click = "SaveScript()"
$nul = $Form1.Controls.Add($Button2)

$Button3 = $System.Button()
$Button3.Anchor = 9 ;Top,Right
$Button3.Left = 510
$Button3.Text = "Open"
$Button3.Top = 10
$Button3.Width = 40
$Button3.Click = "OpenScript()"
$nul = $Form1.Controls.Add($Button3)

$Button4 = $System.Button()
$Button4.Anchor = 9 ;Top,Right
$Button4.Left = 550
$Button4.Text = "Quit"
$Button4.Top = 10
$Button4.Width = 40
$Button4.Click = "$$Form1.Hide"
$nul = $Form1.Controls.Add($Button4)

$TextBox1 = $System.TextBox()
$TextBox1.Anchor = 15  ;Top,Left,Bottom,Right
$TextBox1.BackColor = $System.Color.FromName("Control")
$TextBox1.Height = 330
$TextBox1.Left = 10
$TextBox1.MultiLine = -1  ;True
$TextBox1.ReadOnly = -1  ;True
$TextBox1.ScrollBars = 3  ;Both
$TextBox1.Text = ""
$TextBox1.Top = 82 ;70
$TextBox1.Width = 580
$TextBox1.Font = $System.Font("Courier New",8.25,0) ;Regular
$nul = $Form1.Controls.Add($TextBox1)

$TextBox2 = $System.TextBox()
$TextBox2.Anchor = 14  ;Left,Bottom,Right
$TextBox2.BackColor = $System.Color.FromName("Control")
$TextBox2.Height = 110
$TextBox2.Left = 10
$TextBox2.MultiLine = -1  ;True
$TextBox2.ReadOnly = -1  ;True
$TextBox2.ScrollBars = 2  ;Vertical
$TextBox2.Text = ""
$TextBox2.Top = 430
$TextBox2.Width = 580
$TextBox2.Font = $System.Font("Courier New",8.25,0) ;Regular
$nul = $Form1.Controls.Add($TextBox2)

$Label1 = $System.Label()
$Label1.Anchor = 14  ;Left,Bottom,Right
$Label1.BorderStyle = 0
$Label1.Height = 20
$Label1.Left = 10
$Label1.Text = "Methods:"
$Label1.Top = 415
$nul = $Form1.Controls.Add($Label1)

$GroupBox1 = $System.GroupBox()
$GroupBox1.Left = 10
$GroupBox1.Text = "Class Types"
$GroupBox1.Top = 32
$GroupBox1.Width = 210
$GroupBox1.Height = 45
$nul = $Form1.Controls.Add($GroupBox1)

$GroupBox2 = $System.GroupBox()
$GroupBox2.Anchor = 1 ;Top
$GroupBox2.Left = 225
$GroupBox2.Text = "Script Type"
$GroupBox2.Top = 32
$GroupBox2.Width = 110
$GroupBox2.Height = 45
$nul = $Form1.Controls.Add($GroupBox2)

$GroupBox3 = $System.GroupBox()
$GroupBox3.Anchor = 9  ;Top,Right
$GroupBox3.Left = 340
$GroupBox3.Text = "VBS Runtime"
$GroupBox3.Top = 32
$GroupBox3.Width = 112
$GroupBox3.Height = 45
$GroupBox3.Hide
$nul = $Form1.Controls.Add($GroupBox3)

$RadioButton1 = $System.RadioButton()
$RadioButton1.Appearance = 1  ;Button
$RadioButton1.Checked = -1  ;True
$RadioButton1.Left = 5
$RadioButton1.Text = "Win32"
$RadioButton1.TextAlign = 32  ;MiddleCenter
$RadioButton1.Top = 15
$RadioButton1.Width = 50
$RadioButton1.Click = "$$=EnumClasses('WIN32_','cimv2')"
$nul = $GroupBox1.Controls.Add($RadioButton1)

$RadioButton2 = $System.RadioButton()
$RadioButton2.Appearance = 1  ;Button
$RadioButton2.Left = 55
$RadioButton2.Text = "CIM"
$RadioButton2.TextAlign = 32  ;MiddleCenter
$RadioButton2.Top = 15
$RadioButton2.Width = 50
$RadioButton2.Click = "$$=EnumClasses('CIM_','cimv2')"
$nul = $GroupBox1.Controls.Add($RadioButton2)

$RadioButton3 = $System.RadioButton()
$RadioButton3.Appearance = 1  ;Button
$RadioButton3.Left = 105
$RadioButton3.Text = "SNMP"
$RadioButton3.TextAlign = 32  ;MiddleCenter
$RadioButton3.Top = 15
$RadioButton3.Width = 50
$RadioButton3.Click = "$$=EnumSNMPClass()"
$nul = $GroupBox1.Controls.Add($RadioButton3)

$RadioButton4 = $System.RadioButton()
$RadioButton4.Appearance = 1  ;Button
$RadioButton4.Left = 155
$RadioButton4.Text = "WMI"
$RadioButton4.TextAlign = 32  ;MiddleCenter
$RadioButton4.Top = 15
$RadioButton4.Width = 50
$RadioButton4.Click = "$$=EnumClasses('','wmi')"
$nul = $GroupBox1.Controls.Add($RadioButton4)

$RadioButton5 = $System.RadioButton()
$RadioButton5.Appearance = 1  ;Button
$RadioButton5.Checked = -1  ;True
$RadioButton5.Left = 5
$RadioButton5.Text = "KIX"
$RadioButton5.TextAlign = 32  ;MiddleCenter
$RadioButton5.Top = 15
$RadioButton5.Width = 50
$RadioButton5.Click = "$$=CheckType()"
$nul = $GroupBox2.Controls.Add($RadioButton5)

$RadioButton6 = $System.RadioButton()
$RadioButton6.Appearance = 1  ;Button
$RadioButton6.Left = 55
$RadioButton6.Text = "VBS"
$RadioButton6.TextAlign = 32  ;MiddleCenter
$RadioButton6.Top = 15
$RadioButton6.Width = 50
$RadioButton6.Click = "$$=CheckType()"
$nul = $GroupBox2.Controls.Add($RadioButton6)

$RadioButton7 = $System.RadioButton()
$RadioButton7.Appearance = 1  ;Button
$RadioButton7.Checked = -1  ;True
$RadioButton7.Left = 5
$RadioButton7.Text = "CScript"
$RadioButton7.TextAlign = 32  ;MiddleCenter
$RadioButton7.Top = 15
$RadioButton7.Width = 50
$nul = $GroupBox3.Controls.Add($RadioButton7)

$RadioButton8 = $System.RadioButton()
$RadioButton8.Appearance = 1  ;Button
$RadioButton8.Left = 55
$RadioButton8.Text = "WScript"
$RadioButton8.TextAlign = 32  ;MiddleCenter
$RadioButton8.Top = 15
$RadioButton8.Width = 52
$nul = $GroupBox3.Controls.Add($RadioButton8)

$OpenFileDialog1 = $System.OpenFileDialog()
$OpenFileDialog1.InitialDirectory = "@SCRIPTDIR"
$OpenFileDialog1.Filter = "KiX files (*.kix)|*.kix|VBS files (*.vbs)|*.vbs|All files (*.*)|*.*"
$OpenFileDialog1.FilterIndex = 1
$OpenFileDialog1.RestoreDirectory = 1 ;True

$SaveFileDialog1 = $System.SaveFileDialog()
$SaveFileDialog1.InitialDirectory = "@SCRIPTDIR"
$SaveFileDialog1.Filter = "KiX files (*.kix)|*.kix|VBS files (*.vbs)|*.vbs|All files (*.*)|*.*"
$SaveFileDialog1.FilterIndex = 1
$SaveFileDialog1.RestoreDirectory = 1 ;True

$Form2 = $System.Form()
$Form2.Text = "Loading Classes..."
$Form2.ControlBox = 0  ;False
$Form2.StartPosition = 1  ;FormStartPosition_CenterScreen
$Form2.Size = $System.Size(250,60) ;(Width,Height)

$PBar = $System.ProgressBar()
$PBar.Width = 242
$PBar.Height = 25
$PBar.Style = "1"
$PBar.Center
$nul = $Form2.Controls.Add($PBar)

$=EnumClasses("WIN32_","cimv2")
$Form1.Center
$Form1.Show  ;Displays the Form

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

Function CheckType()
  Select
    Case $RadioButton3.Checked = -1 AND $RadioButton5.Checked = -1
      $GroupBox3.Hide
      ListSNMPKix
    Case $RadioButton3.Checked = -1 AND $RadioButton6.Checked = -1
      $GroupBox3.Show
      ListSNMPVBS
    Case $RadioButton5.Checked = -1
      $GroupBox3.Hide
      ListClassKIX
    Case $RadioButton6.Checked = -1
      $GroupBox3.Show
      ListClassVBS
  EndSelect
EndFunction

Function EnumClasses($Type, $Root)
  $Form2.Show
  $PBar.Value = 0
  $ComboBox1.Items.Clear
  $ComboBox1.Enabled = 0
  Dim $objWMIService, $objClass, $IsQ
  $objWMIService = GetObject("winmgmts:\\.\root\"+$Root)
  $PBar.Max = $objWMIService.SubclassesOf().Count
  For Each $objClass in $objWMIService.SubclassesOf()
    $PBar.Value = $PBar.Value + 1
    $IsQ = 0
    If Instr($objClass.Path_.Class,$Type)
      For Each $Qualifier in $objClass.Qualifiers_
        If Instr($Qualifier.Name, "ASSOCIATION")
          $IsQ = 1
        Endif
      Next
      If $IsQ = 0
        $=$ComboBox1.Items.Add($objClass.Path_.Class)
      Endif
    Endif
  Next
  $Form2.Hide
  $ComboBox1.Enabled = 1
  $objWMIService = ""
EndFunction

Function EnumSNMPClass()
  $Form2.Show
  $PBar.Value = 0
  $ComboBox1.Items.Clear
  $ComboBox1.Enabled = 0
  Dim $objLocator, $objWMIService, $objClass
  $objLocator = CreateObject("WbemScripting.SWbemLocator")
  $objWMIService = $objLocator.ConnectServer("", "root/snmp/localhost")
  $PBar.Max = $objWMIService.SubclassesOf().Count
  For Each $objclass in $objWMIService.SubclassesOf()
    $PBar.Value = $PBar.Value + 1
    If Instr($objClass.Path_.Class,"SNMP_")
      $=$ComboBox1.Items.Add($objClass.Path_.Class)
    EndIf
  Next
  $Form2.Hide
  $ComboBox1.Enabled = 1
  $objLocator = ""
  $objWMIService = ""
EndFunction

Function ListSNMPKiX()
  Dim $Class, $Script, $Script2, $objWMIService, $objClass, $objProperty, $objMethod
  If $ComboBox1.Text <> "Begin by selecting a class"
    $Class = $ComboBox1.Text
    $objLocator = CreateObject("WbemScripting.SWbemLocator")
    $objWMIService = $objLocator.ConnectServer("", "root/snmp/localhost")
    $objClass = $objWMIService.Get($Class)
    $Script = 'Break On' + @CRLF
    $Script = $Script + '$$strComputer = "."' + @CRLF
    $Script = $Script + '$$objLocator = CreateObject("WbemScripting.SWbemLocator")' + @CRLF
    $Script = $Script + '$$objWMIService = $$objLocator.ConnectServer($strComputer, "root/snmp/localhost")' + @CRLF
    $Script = $Script + '$$objNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")' + @CRLF
    $Script = $Script + '$$colItems = $$objWMIService.Instancesof("$Class",,$$objNamedValueSet)' + @CRLF
    $Script = $Script + 'For each $$objItem in $$colItems' + @CRLF
    For Each $objProperty in $objClass.properties_
      $Prop = $objProperty.name
      If $objProperty.IsArray
        $Script = $Script + '  For each $$Item in $objItem.' + $Prop + @CRLF
        $Script = $Script + '    "*' + $Prop + ': " + $$Item ?' + @CRLF
        $Script = $Script + '  Next' + @CRLF
      Else
        $Script = $Script + '  "' + $Prop + ': " + $$objItem.' + $Prop + ' ?' + @CRLF
      Endif
    Next
    $Script = $Script + '  ?' + @CRLF
    $Script = $Script + 'Next'
    For Each $objMethod in $objClass.methods_
      $Method = $objMethod.name
        $Script2 = $Script2 + ' ' + $Method + ': $$objItem.' + $Method + @CRLF
    Next
    $script = $script + @CRLF + "? 'Press Any Key to Close the Window'" + @CRLF + "Get $"
    $TextBox1.Text = $Script
  Else
    $TextBox1.Text = ""
  Endif
  $objWMIService = ""
EndFunction

Function ListSNMPVBS()
  Dim $Class, $Script, $Script2, $objWMIService, $objClass, $objProperty, $objMethod
  If $ComboBox1.Text <> "Begin by selecting a class"
    $Class = $ComboBox1.Text
    $TextBox1.Text = ""
    $TextBox2.Text = ""
    $objLocator = CreateObject("WbemScripting.SWbemLocator")
    $objWMIService = $objLocator.ConnectServer("", "root/snmp/localhost")
    $objClass = $objWMIService.Get($Class)
    $Script = 'On Error Resume Next' + @CRLF
    $Script = $Script + 'strComputer = "."' + @CRLF
    $Script = $Script + 'Set objLocator = CreateObject("WbemScripting.SWbemLocator")' + @CRLF
    $Script = $Script + 'Set objWMIService = objLocator.ConnectServer(strComputer, "root/snmp/localhost")' + @CRLF
    $Script = $Script + 'Set objNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")' + @CRLF
    $Script = $Script + 'Set colItems = objWMIService.Instancesof("$Class",,objNamedValueSet)' + @CRLF
    $Script = $Script + 'For Each objItem in colItems' + @CRLF
    For Each $objProperty in $objClass.properties_
      $Prop = $objProperty.name
      If $objProperty.IsArray
        $Script = $Script + '  For Each Item in objItem.' + $Prop + @CRLF
        $Script = $Script + '    WScript.Echo "*' + $Prop + ': " & Item' + @CRLF
        $Script = $Script + '  Next' + @CRLF
      Else
        $Script = $Script + '  WScript.Echo "' + $Prop + ': " & objItem.' + $Prop + @CRLF
      Endif
    Next
    $Script = $Script + '  WScript.Echo' + @CRLF + 'Next' + @CRLF
    If $RadioButton7.Checked = -1
      $Script = $Script + @CRLF + 'WScript.Echo "Press Any Key to Close the Window"' + @CRLF + 'Wscript.StdIn.ReadLine'
    EndIf
    For Each $objMethod in $objClass.methods_
      $Method = $objMethod.name
        $Script2 = $Script2 + ' ' + $Method + ': objItem.' + $Method + @CRLF
    Next
    $TextBox1.Text = $Script
    $TextBox2.Text = $Script2
  Else
    $TextBox1.Text = ""
    $TextBox2.Text = ""
  Endif
  $objWMIService = ""
EndFunction

Function ListClassKiX()
  Dim $Class, $Script, $Script2, $objWMIService, $objClass, $objProperty, $objMethod
  If $ComboBox1.Text <> "Begin by selecting a class"
    $Class = $ComboBox1.Text
    $TextBox1.Text = ""
    $TextBox2.Text = ""
    If $RadioButton4.Checked = -1
      $objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\wmi")
    Else
      $objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    EndIf
    $objClass = $objWMIService.Get($Class)
    $Script = 'Break On' + @CRLF
    $Script = $Script + '$$strComputer = "."' + @CRLF
    If $RadioButton4.Checked = -1
      $Script = $Script + '$$objWMIService = GetObject("winmgmts:\\" + $$strComputer + "\root\wmi")' + @CRLF
    Else
      $Script = $Script + '$$objWMIService = GetObject("winmgmts:\\" + $$strComputer + "\root\cimv2")' + @CRLF
    EndIf
    $Script = $Script + '$$colItems = $$objWMIService.ExecQuery("Select * from $Class",,48)' + @CRLF
    $Script = $Script + 'For Each $$objItem in $$colItems' + @CRLF
    For Each $objProperty in $objClass.properties_
      $Prop = $objProperty.name
      If $objProperty.IsArray
        $Script = $Script + '  For Each $$Item in $objItem.' + $Prop + @CRLF
        $Script = $Script + '    "*' + $Prop + ': " + $$Item ?' + @CRLF
        $Script = $Script + '  Next' + @CRLF
      Else
        $Script = $Script + '  "' + $Prop + ': " + $$objItem.' + $Prop + ' ?' + @CRLF
      Endif
    Next
    $Script = $Script + '  ?' + @CRLF + 'Next' + @CRLF
    For Each $objMethod in $objClass.methods_
      $Method = $objMethod.name
        $Script2 = $Script2 + ' ' + $Method + ': $$objItem.' + $Method + @CRLF
    Next
    $script = $script + @CRLF + "? 'Press Any Key to Close the Window'" + @CRLF + "Get $"
    $TextBox1.Text = $Script
    $TextBox2.Text = $Script2
  Else
    $TextBox1.Text = ""
    $TextBox2.Text = ""
  Endif
  $objWMIService = ""
EndFunction

Function ListClassVBS()
  Dim $Class, $Script, $Script2, $objWMIService, $objClass, $objProperty, $objMethod
  If $ComboBox1.Text <> "Begin by selecting a class"
    $Class = $ComboBox1.Text
    $TextBox1.Text = ""
    $TextBox2.Text = ""
    If $RadioButton4.Checked = -1
      $objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\wmi")
    Else
      $objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    EndIf
    $objClass = $objWMIService.Get($Class)
    $Script = 'On Error Resume Next' + @CRLF
    $Script = $Script + 'strComputer = "."' + @CRLF
    If $RadioButton4.Checked = -1
      $Script = $Script + 'Set objWMIService = GetObject("winmgmts:\\" + strComputer + "\root\wmi")' + @CRLF
    Else
      $Script = $Script + 'Set objWMIService = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")' + @CRLF
    EndIf
    $Script = $Script + 'Set colItems = objWMIService.ExecQuery("Select * from $Class",,48)' + @CRLF
    $Script = $Script + 'For Each objItem in colItems' + @CRLF
    For Each $objProperty in $objClass.properties_
      $Prop = $objProperty.name
      If $objProperty.IsArray
        $Script = $Script + '  For Each Item in objItem.' + $Prop + @CRLF
        $Script = $Script + '    WScript.Echo "*' + $Prop + ': " & Item' + @CRLF
        $Script = $Script + '  Next' + @CRLF
      Else
        $Script = $Script + '  WScript.Echo "' + $Prop + ': " & objItem.' + $Prop + @CRLF
      Endif
    Next
    $Script = $Script + '  WScript.Echo' + @CRLF + 'Next' + @CRLF
    If $RadioButton7.Checked = -1
      $Script = $Script + @CRLF + 'WScript.Echo "Press Any Key to Close the Window"' + @CRLF + 'Wscript.StdIn.ReadLine'
    EndIf
    For Each $objMethod in $objClass.methods_
      $Method = $objMethod.name
        $Script2 = $Script2 + ' ' + $Method + ': objItem.' + $Method + @CRLF
    Next
    $TextBox1.Text = $Script
    $TextBox2.Text = $Script2
  Else
    $TextBox1.Text = ""
    $TextBox2.Text = ""
  Endif
  $objWMIService = ""
EndFunction

Function RunScript()
  Dim $FSO, $strTmpName, $objScript, $objShell, $strComdLine, $nul
  $FSO = CreateObject("Scripting.FileSystemObject")
  $objShell = CreateObject("WScript.Shell")
  If $RadioButton5.Checked = -1
    $strTmpName = "temp_script.kix"
    $objScript = $FSO.CreateTextFile($strTmpName)
    $objScript.Write($TextBox1.Text)
    $objScript.Close
    If "@SCRIPTEXE"<>"wkix32.exe"
      $strCmdLine = "kix32.exe"
    Else
      $strCmdLine = "wkix32.exe"
    EndIf
    If @SCRIPTDIR<>@CURDIR and Exist(@SCRIPTDIR + "\" + @SCRIPTEXE)
      $strCmdLine = '"' + @SCRIPTDIR + $strCmdLine + '" "' + $strTmpName + '"'
    Else
      $strCmdLine = '"' + $strCmdLine + ' "' + $strTmpName + '"'
    EndIf
    $nul = $objShell.Run($strCmdLine)
  Else
    $strTmpName = "temp_script.vbs"
    $objScript = $FSO.CreateTextFile($strTmpName)
    $objScript.Write($TextBox1.Text)
    $objScript.Close
    If $RadioButton7.Checked = -1
      $strCmdLine = "cscript.exe"
    Else
      $strCmdLine = "wscript.exe"
    EndIf
    If @SCRIPTDIR<>@CURDIR
      $strCmdLine = '"' + @SCRIPTDIR + $strCmdLine + '" "' + $strTmpName + '"'
    Else
      $strCmdLine = '"' + $strCmdLine + ' "' + $strTmpName + '"'
    EndIf
    $nul = $objShell.Run($strCmdLine)
  EndIf
EndFunction

Function SaveScript()
  Dim $dlgSave, $FSO, $strTmpName, $objScript
  $FSO = CreateObject("Scripting.FileSystemObject")
  If $RadioButton5.Checked = -1
    $strTmpName = "temp_script.kix"
    $SaveFileDialog1.FilterIndex = 1
    $SaveFileDialog1.FileName = $ComboBox1.Text
  Else
    $strTmpName = "temp_script.vbs"
    $SaveFileDialog1.FilterIndex = 2
    $SaveFileDialog1.FileName = $ComboBox1.Text
  EndIf
  $objScript = $FSO.CreateTextFile($strTmpName)
  $objScript.Write($TextBox1.Text)
  $objScript.Close
  If $SaveFileDialog1.ShowDialog() = 1
    $dlgSave = $SaveFileDialog1.FileName
  EndIf
  Copy $strTmpName $dlgSave
EndFunction

Function OpenScript()
  Dim $dlgOpen, $FSO, $Script, $objFile
  If $OpenFileDialog1.ShowDialog() = 1
    $dlgOpen = $OpenFileDialog1.Filename
    $FSO = CreateObject("Scripting.FileSystemObject")
    $objFile = $FSO.OpenTextFile($dlgOpen)
    $Script = $objFile.ReadAll()
    $TextBox1.Text = $Script
    $objFile.Close
    $TextBox1.Show
  EndIf
EndFunction

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Nov 15, 2007 3:57 pm    Post subject: Reply with quote

Nice. Can I make a suggestion. Might want to re-word the text in that drop-down box to like:

"Begin by selecting a class from this drop-down"

or something such. Found that I was just clicking the "Class Types" buttons and nothing was happening (i though those were the classes you wanted me to select) ....

Figured it out finally. Great work.
Back to top
View user's profile Send private message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Fri Nov 16, 2007 7:43 am    Post subject: Reply with quote

Thanks Smile

Yeah, that seems like a god idea, I'll change that. Maybe I should hide or disable the buttons until a class is selected.

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Wed Sep 24, 2008 6:27 pm    Post subject: Reply with quote

just started doing this and then logged on here...
what you mean it's not completely finished?
what's missing?

how old version this is based on?

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Tue Sep 30, 2008 10:01 am    Post subject: Reply with quote

It's not finished for these reasons:
1. It misses other Class Types, currently it only supports Root\CIMV2, root\SNMP and root\wmi.
2. SNMP only works when you have installed it and it doesn't contain a check for that.
3. Code needs cleaning up.

In a few minutes I will post ScriptOMatic .Net v2.0
It does contain all Class Types, and it will only show what you have installed.
Still needs some code cleanup though.

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion 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