Page 1 of 1 1
Topic Options
#75175 - 2003-05-28 03:40 AM ADSIKiXScriptomatic Learning Tool
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
This KiXforms script was originally posted here:
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=14;t=000708

I have modified the code to enable English dialog boxes. I have added a Copy Source routine to the form as well. Removed && which caused error when run at about line 1077.

PostPrep was not able to convert the entire script in one conversion, so I used multiple conversions. You must copy ALL the code in order for the form to function.

NOTE: You MUST use the latest version of KiXforms in order to use this form.
KiXforms v2.3.0 Beta 2

http://www.kixforms.com/assets/index.htm

This form still requires some functions to be corrected for use with KiXtart.
One function attempts to use WSH to run the currentl source code in the text window, which won't work,
as this is now KiXtart code, not vbs code.

Here is how it looks on Windows XP

ADSI Scritomatic


;********************************************************************
; File: EzADscripto.kix
; Created: May 2003
; Version: 1.0
; Author: Christophe MELIN
; Description: Learning tool. Generates ADSI scripts to
; demonstrate the fundamental
; ADSI tasks, Create, Write, Read, and Modify.
;
;********************************************************************
; converted from EzADscripto.hta (December 2002)
;
; Author: The Scripting Guys - Dean Tsaltas, Bob Wells,
; Greg Stemp, and Ethan Wilansky.
; Initial concept from ScriptoMatic by Dean Tsaltas
; and Greg Stemp
;
; Copyright (C) 2003 Microsoft Corporation
;********************************************************************
;
; Originally posted here: 23. May 2003 17:04
; Microsoft releases ADSI Scriptomatic
; http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=14;t=000708
;
; Modified by Ron Lewis/NTDOC to enable some other features with KiXforms
; and a Copy Source routine within the code
; Posted with PostPrep by Lonkero/Jochen to enable easier Copy/Paste
; from the KiXtart.org BBS
; Modified v1.0 posted on May 26, 2003
;
;********************************************************************

Break On
Global $true, $false

$vbTab = chr(9)
$true = 1
$false = 0
$ScriptVersion='1.0'

;---------------------------------------------------------------------------
; Main Form
;---------------------------------------------------------------------------
$frmMain = CreateObject("Kixtart.Form")
$frmMain.Size = 640,480
$frmMain.BackColor = &E5A88A
$frmMain.FormBorderStyle = 4
;$frmMain.SysMenu = 0 ; Disable the sysmenu. Prevents users from closing forms
$frmMain.icon = 56
$frmMain.Text = "ADSI Scriptomatic for KIX"
$frmMain.Center

$frmMain.FontName = "arial"
$frmMain.FontSize = 20
$frmMain.FontItalic = True
$frmMain.FontBold = True
;$frmMain.ForeColor = &E3A17A-&151515
;$frmMain.PrintXY(330,25,'KiX Scriptomatic v$ScriptVersion')

$frmMain.ForeColor = &E3A17A+&151515
$frmMain.PrintXY(332,27,'KiX Scriptomatic v$ScriptVersion')
$frmMain.ForeColor = &E3A17A-&151515
$frmMain.PrintXY(330,25,'KiX Scriptomatic v$ScriptVersion')



$frmMain.FontSize = 12
$frmMain.ForeColor = &E5A88A-&151515
$frmMain.FontSize = 10
$frmMain.ForeColor = BLACK
$frmMain.FontSize = 10
$frmMain.FontBold = False
$frmMain.FontItalic = False

$ImageList = $frmMain.ImageList
$ImageList.ImageSize = 32,32
$ImageList.Images.Add($frmMain.SmallImageList.Images(1))
$ImageList.Images.Add($frmMain.SmallImageList.Images(7))
$ImageList.Images.Add($frmMain.SmallImageList.Images(3))
$ImageList.Images.Add($frmMain.SmallImageList.Images(28))
$ImageList.Images.Add($frmMain.SmallImageList.Images(9))

$TaskSelectPulldown = $frmMain.ComboBox
$TaskSelectPulldown.List = "Select a task","Create an object","Write an object","Read an object","Delete an object"
$TaskSelectPulldown.Top = 80
$TaskSelectPulldown.Left = 10
$TaskSelectPulldown.Bottom = $frmMain.ClientHeight / 2
$TaskSelectPulldown.width = 150
$TaskSelectPulldown.ListIndex = 0
$TaskSelectPulldown.TabStop = 1
$TaskSelectPulldown.Style = 1
$TaskSelectPulldown.OnClick = "$=TaskSelectPulldownCheck()"

$classesPulldown = $frmMain.ComboBox
$classesPulldown.List = "Select an object","User","Computer","Contact","Group","Organizational Unit"
$classesPulldown.Top = 80
$classesPulldown.Left = $TaskSelectPulldown.width+10
$classesPulldown.Bottom = $frmMain.ClientHeight / 2
$classesPulldown.width = $TaskSelectPulldown.width
$classesPulldown.ListIndex = 0
$classesPulldown.TabStop = 1
$classesPulldown.Style = 1
$classesPulldown.Enabled = $false
$classesPulldown.OnClick = "$=TaskSelectPulldownCheck()"

$Status = $frmMain.Label
$Status.Left = 0
$Status.Top = $frmMain.ClientHeight-20
$Status.Height = 20
$Status.Right = $frmMain.ClientWidth
$Status.BackColor = &E5A88A
$Status.ForeColor = Blue
$Status.BorderStyle = 0
$Status.Anchor = 1+4+8
$Status.Text = " Powered by Kixtart "+@KIX+" and Kixforms "+$frmMain.Version

$loadBtn = $frmMain.ToolButton
$loadBtn.Alignment = 2
$loadBtn.FlatStyle = 1
$loadBtn.left = 10
$loadBtn.top = 10
$loadBtn.width = 60
$loadBtn.height = 60
$loadBtn.text = "&Load"
$loadBtn.Icon = $ImageList.Images(0)
$loadBtn.border = 3
$loadBtn.ToolTip = "Loads a file into the application"
$loadBtn.BackColor = "Control"
$loadBtn.OnClick = "OpenScript()"

$btnCopy = $frmMain.ToolButton
$btnCopy.Alignment = 2
$btnCopy.FlatStyle = 1
$btnCopy.left = 70
$btnCopy.top = 10
$btnCopy.width = 60
$btnCopy.height = 60
$btnCopy.text = "&Copy"
$btnCopy.Icon = $ImageList.Images(1)
$btnCopy.border = 3
$btnCopy.ToolTip = "Copies source code to the clipboard"
$btnCopy.BackColor = "Control"
$btnCopy.OnClick = "CopySource()"

$saveBtn = $frmMain.ToolButton
$saveBtn.Alignment = 2
$saveBtn.FlatStyle = 1
$saveBtn.left = 130
$saveBtn.top = 10
$saveBtn.width = 60
$saveBtn.height = 60
$saveBtn.text = "&Save"
$saveBtn.Icon = $ImageList.Images(2)
$saveBtn.border = 3
$saveBtn.ToolTip = "Saves the current source as a file"
$saveBtn.BackColor = "control"
$saveBtn.OnClick = "SaveScript()"

$runBtn = $frmMain.ToolButton
$runBtn.Alignment = 2
$runBtn.FlatStyle = 1
$runBtn.left = 190
$runBtn.top = 10
$runBtn.width = 60
$runBtn.height = 60
$runBtn.text = "&Run"
$runBtn.Icon = $ImageList.Images(3)
$runBtn.border = 3
$runBtn.ToolTip = "Attempts to run current source using WSH... which will not work since this is now KiXtart code. That needs to be fixed in the future."
$runBtn.BackColor = "control"
$runBtn.OnClick = "RunScript()"

$exitBtn = $frmMain.ToolButton
$exitBtn.Alignment = 2
$exitBtn.FlatStyle = 1
$exitBtn.left = 250
$exitBtn.top = 10
$exitBtn.width = 60
$exitBtn.height = 60
$exitBtn.text = "E&xit"
$exitBtn.Icon = $ImageList.Images(4)
$exitBtn.border = 3
$exitBtn.ToolTip = "Exits the application without prompting"
$exitBtn.BackColor = "Control"
$exitBtn.OnClick = "QuitScript()"

$lblImptNote = $frmMain.Label
$lblImptNote.top = $TaskSelectPulldown.bottom + 10
$lblImptNote.left = 10
$lblImptNote.Anchor = 15
$lblImptNote.width = $frmMain.ClientWidth - (2 * $lblImptNote.left)
$lblImptNote.height = $frmMain.ClientHeight - 10 - $lblImptNote.top

$lblnotesbutton = $frmMain.label
$lblnotesbutton.top = $TaskSelectPulldown.bottom + 5
$lblnotesbutton.left = 10
$lblnotesbutton.forecolor = "Blue"
$lblnotesbutton.fontunderline = 1
$lblnotesbutton.MousePointer = 16
$lblnotesbutton.width = $frmMain.ClientWidth - (2 * $lblnotesbutton.left)
$lblnotesbutton.height = 20
$lblnotesbutton.caption = ""
$lblnotesbutton.OnClick = "ImptDialog()"

$lblnotesbuttonrun = $frmMain.label
$lblnotesbuttonrun.forecolor = "Blue"
$lblnotesbuttonrun.fontunderline = 1
$lblnotesbuttonrun.MousePointer = 16
$lblnotesbuttonrun.top = $lblnotesbutton.bottom + 5
$lblnotesbuttonrun.left = 10
$lblnotesbuttonrun.width = $frmMain.ClientWidth - (2 * $lblnotesbutton.left)
$lblnotesbuttonrun.height = 20
$lblnotesbuttonrun.caption = ""
$lblnotesbuttonrun.OnClick = "RunDialog()"

$Message = $frmMain.TextBox
$Message.FontSize = 10
$Message.Top = $lblnotesbuttonrun.bottom + 5
$Message.Left = 10
$Message.Right = $frmMain.ClientWidth - 10
$Message.height = $frmMain.ClientHeight - 30 - $message.top
$Message.MultiLine = $true
$Message.WordWrap = $false
$Message.Anchor = 15
$Message.ScrollBars = 3
$Message.FontName = "Courier New"
$Message.WordWrap = $false

$=InitialUIState()

$frmMain.Center
$frmMain.Show

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

EXIT 0

;**************************************************************************
; These subroutines control the state of the user interface. Each
; routine includes descriptive text.
;**************************************************************************
;This is the state the HTA UI elements should be in before anything is selected.
function InitialUIState
$TaskSelectPulldown.enabled = $true
$runbtn.enabled = $false
$savebtn.enabled = $false
$classesPulldown.ListIndex = 0
$classesPulldown.enabled = $false

$lblImptNote.visible = $true

$message.visible = $false
$message.text = ""

$lblnotesbutton.visible = $false
$lblnotesbuttonrun.visible = $false

$lblImptNote.FontBold = True
$lblImptNote.caption =
"EzAD Scriptomatic is an ADSI Scripting learning tool. The tool creates example scripts that read, write and modify Active Directory data. To successfully run scripts created with EzAD Scriptomatic, you must:" + @crlf + @crlf +
"1. Have Administrator access to Active Directory, and" + @crlf +
"2. Be logged on to the target Active Directory domain." + @crlf + @crlf +
"You should not run scripts created with EzAD Scriptomatic against a production domain without first testing the scripts in your designated testing environment."
endfunction

;If the operator selects a different task, reset the UI in preparation for selecting a class.
function ResetForClassesPullDown
$classesPulldown.enabled = $true
$message.text= ""
$message.visible= $false
$lblImptNote.visible = $true
$lblnotesbutton.visible = $false
$lblnotesbuttonrun.visible = $false
endfunction

;If the $TaskSelectPulldown is not set to Select a task enable the $classesPulldown.
;Otherwise, disable the $classesPulldown.
function TaskSelectPulldownCheck
if ($TaskSelectPulldown.ListIndex="0")
$=InitialUIState
return
endif

$=ResetForClassesPullDown
if ($ClassesPulldown.ListIndex="0")
return
endif

Select
Case $TaskSelectPulldown.ListIndex="1"
$=ResetForClassesPullDown
$=CreateCreateScript

Case $TaskSelectPulldown.ListIndex="2"
$=ResetForClassesPullDown
$=CreateWriteScript

Case $TaskSelectPulldown.ListIndex="3"
$=ResetForClassesPullDown
$=CreateReadScript

Case $TaskSelectPulldown.ListIndex="4"
$=ResetForClassesPullDown
$=CreateDeleteScript
EndSelect

;Enable the Running This Script, Run, and Save buttons.
$=FinalUIState
endfunction

;Once a script is generated, enable the Running This Script, Run, and Save buttons.
function FinalUIState
$lblImptNote.visible = $false
$message.visible= $true
$Message.SelStart = 0
$Message.SelLength = 0

$lblnotesbutton.visible = $true
$lblnotesbuttonrun.visible = $true

$lblnotesbuttonrun.caption="Read this before running the " + lcase($TaskSelectPulldown.Text) + " - " + $classesPulldown.Text + " script"
$runBtn.enabled = $true
$savebtn.enabled = $true
endfunction

;***************************************************************************
; When the operator presses the Run button, we use the WshShell $object's Run
; method to run the code currently in the text area under cscript.exe. we use
; cmd.exe's /k parameter to ensure the command window remains visible after
; the script has finished running.
;***************************************************************************
function RunScript()
$strTmpName = "%temp%\temp_script.kix"
if DoSave($strTmpName)
Shell("cmd /k cscript.exe $strTmpName")
endif
endfunction

;***************************************************************************
; When the operator presses the Save button, we present them with an InputBox
; and force them to give us the full path to where they'd like to the save
; the script that is currently in the text area. The user is probably quite
; upset with our laziness here....and who can blame them?
;***************************************************************************

function SaveScript()
$form=createobject("Kixtart.Form")
$SaveDir = @CurDir
; CD 'C:\util'
$value=$form.FileSaveDialog(
"Save file...",
"",
"Name of the document",
"KiX Script|*.kix|Text File|*.txt|All Files|*.*",
0
)

CD $SaveDir
If $Value
$strSaveFileName=$value
; Do the save
$=DoSave( $strSaveFileName )
EndIf
$form=Nothing
endfunction

;***************************************************************************
; When the operator presses the Open button, we present them with an InputBox
; and force them to give us the full path to the script they'd like to open.
; This is, of course, rather wonky - but it's meant to be.
;***************************************************************************

function OpenScript()
$form=createobject("Kixtart.Form")
$OpenDir = @CurDir
CD '%TEMP%'
$value=$form.FileOpenDialog(
"Open file...",
"",
"Name of the document",
"KiX Script|*.kix|Text File|*.txt|All Files|*.*",
0
)

CD $OpenDir
If $Value
$strOpenFileName=$value

; Load the file
$handle = freefilehandle()
$err = open($handle,$strOpenFileName,2)
if $err=0
$strHTML = ""
$line = ReadLine($handle)
WHILE @ERROR = 0
$strHTML = $strHTML + $line + @crlf
$line = ReadLine($handle)
LOOP

$message.text = $strHTML
$=close($handle)

$runBtn.enabled = $true
$savebtn.enabled = $true
endif
EndIf
$form=Nothing
$=FinalUIState()
$lblnotesbutton.visible = $false
$lblnotesbuttonrun.visible = $false
endfunction



;***************************************************************************
; When the operator presses the Quit button, the file where we've been storing
; the scripts gets deleted and the main window closes.
;***************************************************************************

function QuitScript()
DEL "temp_script.kix"
Quit 0
endfunction

;**************************************************************************
; These functions are called by other functions that generate the code for
; the Read an $object task. Each function in this section generates code
; based on attribute definitions.
;**************************************************************************
Function strReadCodeSV($strPageName,$arrName)
$strHTML = ""
$strHTML = $strHTML + '? "** $strPageName Properties Page : Single-Valued Attributes **"' + @crlf
For each $attrib in $arrName
if $attrib
$kixattrib = FormatKixObjName($attrib)
$strHTML = $strHTML + '$$str$kixattrib = $$objItem.Get("$attrib")' + @crlf
$strHTML = $strHTML + '? "$attrib : $$str$kixattrib"' + @crlf
endif
Next
$strReadCodeSV = $strHTML + @crlf
EndFunction

Function strReadCodeMV($strPageName,$arrName)
$strHTML = ""
$strHTML = $strHTML + '? "** $strPageName Properties Page : Multi-Valued Attributes **"' + @crlf
For Each $attrib in $arrName
if $attrib
$strHTML = $strHTML + '$$str$attrib = $$objItem.GetEx("$attrib")' + @crlf
$strHTML = $strHTML + '? "$attrib : "' + @crlf
$strHTML = $strHTML + 'For Each $$Item in $$str' + $attrib + @crlf
$strHTML = $strHTML + $vbTab + '? $$Item' + @crlf
$strHTML = $strHTML + 'Next' + @crlf
endif
Next
$StrReadCodeMV = $strHTML + @crlf
EndFunction

;For reading attributes stored as integers containing bit flags
Function IntReadCode($strPageName,$attrib,$arrConstant,$arrValue)
$strHTML = ""
$strHTML = $strHTML + '? "** $strPageName Properties Page : " + $attrib + " attribute **"' + @crlf
$strHTML = $strHTML + '$$objHash = CreateObject("Scripting.Dictionary")' + @crlf
$i = 0
For Each $constant in $arrConstant
if $constant
$strHTML = $strHTML + '$$=$$objHash.Add( "$constant", $arrValue[$i])' + @crlf
$i = 1 + $i
endif
Next
$strHTML = $strHTML + '$$int$attrib = $$objItem.Get("$attrib")' + @crlf
$strHTML = $strHTML + 'For Each $$Key in $$objHash.Keys' + @crlf
$strHTML = $strHTML + $vbTab + 'If $$objHash[$$Key] & $$int$attrib' + @crlf
$strHTML = $strHTML + $vbTab + $vbTab + '? "$$Key is enabled."' + @crlf
$strHTML = $strHTML + $vbTab + 'Else' + @crlf
$strHTML = $strHTML + $vbTab + $vbTab + '? "$$Key is disabled."' + @crlf
$strHTML = $strHTML + $vbTab + 'EndIf' + @crlf
$strHTML = $strHTML + "Next"
$IntReadCode = $strHTML + @crlf
EndFunction

Function ReadPropertiesSimple($strPageName,$interfaceName,$arrProp)
$strHTML = ""
$strHTML = $strHTML + '? "** $strPageName Properties Page : " + $interfaceName + " interface **"' + @crlf
For Each $prop in $arrProp
if $prop
$strHTML = $strHTML + '? " $prop : " + $$objItem.$prop' + @crlf
endif
Next
$ReadPropertiesSimple = $strHTML + @crlf
EndFunction

;**************************************************************************
; These functions are called by other functions that generate the code for
; the Write an $object task. Each function in this section generates code
; based on attribute definitions.
;**************************************************************************
Function strWriteCodeSV($strPageName,$arrName,$strValue)
$strHTML = ""
If $strValue = "VALUE"
$strHTML = $strHTML + '? "** $strPageName Properties Page : writing Single-Valued Attributes **"' + @crlf
Else
$strHTML = $strHTML + ';See Script Notes for information on setting this value.' + @crlf
$strHTML = $strHTML + '? "** $strPageName Properties Page : non standard valued **"' + @crlf
EndIf
For each $attrib in $arrName
if $attrib
$strHTML = $strHTML + '$$objItem.Put( "$attrib", "$strValue")' + @crlf
$strHTML = $strHTML + '$$objItem.SetInfo()' + @crlf
endif
Next
$strWriteCodeSV = $strHTML + @crlf
EndFunction

Function strWriteCodeMV($strPageName,$arrName,$strValue)
$strHTML = ""
If $strValue = "VALUE"
$strHTML = $strHTML + '? "** $strPageName Properties Page : writing Multi-Valued Attributes **"' + @crlf
Else
$strHTML = $strHTML + ';See Script Notes for information on setting this value.' + @crlf
$strHTML = $strHTML + '? "** $strPageName Properties Page : non standard Multi-Valued Attributes **"' + @crlf
EndIf
For each $attrib in $arrName
if $attrib
$strHTML = $strHTML + '$$objItem.PutEx( ADS_PROPERTY_UPDATE, "$attrib", ("$strValue 1", "$strValue 2", ... , "$strValue n") )' + @crlf
$strHTML = $strHTML + '$$objItem.SetInfo()' + @crlf
endif
Next
$strWriteCodeMV = $strHTML + @crlf
EndFunction


;**************************************************************************
; These functions write script code to the code window for the Read
; an $object task. Each function varies based on the selected class.
; The function name describes the class it supports.
;**************************************************************************
Function UserAttribsToRead
$strHTML = ""

;All attributes on the General Properties Page
$arrSVStringAttribsGP = "name", "givenName","initials","sn","displayName","description","physicalDeliveryOfficeName","telephoneNumber","mail","wWWHomePage"
$strHTML = $strHTML + strReadCodeSV("General",$arrSVStringAttribsGP)

$arrMVStringAttribsGP = "otherTelephone", "url"
$strHTML = $strHTML + strReadCodeMV("General",$arrMVStringAttribsGP)
;End General Properties Page

;All attributes on the Address Properties Page
$arrSVStringAttribsAP = "streetAddress", "l", "st", "postalCode", "c"
$strHTML = $strHTML + strReadCodeSV("Address",$arrSVStringAttribsAP)

$arrMVStringAttribsAP = "postOfficeBox",""
$strHTML = $strHTML + strReadCodeMV("Address",$arrMVStringAttribsAP)
;End Address Properties Page

;Selected attributes on the Account Properties Page
$arrSVStringAttribsAcP = "userPrincipalName", "dc", "sAMAccountName", "userWorkstations"
$strHTML = $strHTML + strReadCodeSV("Account",$arrSVStringAttribsAcP)

;Read the bit flags in userAccountControl
$arrUACConstants = "ADS_UF_SMARTCARD_REQUIRED", "ADS_UF_TRUSTED_FOR_DELEGATION", "ADS_UF_NOT_DELEGATED", "ADS_UF_USE_DES_KEY_ONLY","ADS_UF_DONT_REQUIRE_PREAUTH"
$arrUACValues = "&40000", "&80000", "&100000", "&200000", "&400000"
$strHTML = $strHTML + IntReadCode("Account","userAccountControl", $arrUACConstants,$arrUACValues)
;End read the bit flags in userAccountControl

;Read the IsAccountLocked property
$strHTML = $strHTML + 'If $$objItem.IsAccountLocked = $true' + @crlf
$strHTML = $strHTML + $vbTab + '? "ADS_UF_LOCKOUT is enabled"' + @crlf
$strHTML = $strHTML + 'Else' + @crlf
$strHTML = $strHTML + $vbTab + '? "ADS_UF_LOCKOUT is disabled"' + @crlf
$strHTML = $strHTML + 'EndIf' + @crlf + @crlf
;End read the IsAccountLocked property

;Read the AccountExpirationDate property
$strHTML = $strHTML + 'If (@@error = -2147467259) OR ($$objItem.AccountExpirationDate = "1/1/1970")' + @crlf
$strHTML = $strHTML + $vbTab + '? "no expiration date."' + @crlf
$strHTML = $strHTML + 'Else' + @crlf
$strHTML = $strHTML + $vbTab + '? "Account expires on: " + $$objItem.AccountExpirationDate' + @crlf
$strHTML = $strHTML + 'EndIf' + @crlf + @crlf
;End read the AccountExpirationDate property
;End Account Properties Page

;All attributes on the Profile Properties Page

Top
#75176 - 2003-05-28 08:35 AM Re: ADSIKiXScriptomatic Learning Tool
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hey Ron !

What shall I say other than this is a 'bold' script [Wink]

German Jury gives that :

[Big Grin] [Big Grin] [Big Grin] [Big Grin] [Big Grin]
_________________________



Top
#75177 - 2003-05-28 02:58 PM Re: ADSIKiXScriptomatic Learning Tool
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Ron,

I've made the following changes to the script that seem to help it run a little better...



function RunScript()
    $strTmpName = "%temp%\temp_script.kix"
    if DoSave($strTmpName)
        $objShell = CreateObject("WScript.Shell")
        $strCmdLine = "%COMSPEC% /k kix32.exe "
        $strCmdLine = $strCmdLine + $strTmpName
        $nul = $objShell.Run($strCmdLine)
        ;Run("%COMSPEC% /k kix32.exe $strTmpName")
    endif
endfunction



Using the Wscript.Shell command to run the temporary script allows us to keep our form running after closing the console window of the temporary script.

...more...



Function IntReadCode($strPageName,$attrib,$arrConstant,$arrValue)
    $strHTML = ""
    $strHTML = $strHTML + '? "** $strPageName Properties Page : $attrib attribute **"' + @crlf
    $strHTML = $strHTML + '$$objHash = CreateObject("Scripting.Dictionary")' + @crlf
    $i = 0
    For Each $constant in $arrConstant
        if $constant
            $strHTML = $strHTML + '$$=$$objHash.Add( "$constant", $arrValue[$i])' + @crlf
            $i = 1 + $i
        endif
    Next
    $strHTML = $strHTML + '$$int$attrib = $$objItem.Get("$attrib")' + @crlf
    $strHTML = $strHTML + 'For Each $$Key in $$objHash.Keys' + @crlf
    $strHTML = $strHTML + $vbTab + 'If $$objHash[$$Key] & $$int$attrib' + @crlf
    $strHTML = $strHTML + $vbTab + $vbTab + '? "$$Key is enabled."' + @crlf
    $strHTML = $strHTML + $vbTab + 'Else' + @crlf
    $strHTML = $strHTML + $vbTab + $vbTab + '? "$$Key is disabled."' + @crlf
    $strHTML = $strHTML + $vbTab + 'EndIf' + @crlf
    $strHTML = $strHTML + "Next"
    $IntReadCode = $strHTML + @crlf
EndFunction



...and...



Function ReadPropertiesSimple($strPageName,$interfaceName,$arrProp)
    $strHTML = ""
    $strHTML = $strHTML + '? "** $strPageName Properties Page : $interfaceName interface **"' + @crlf
    For Each $prop in $arrProp
        if $prop
            $strHTML = $strHTML + '? " $prop : " + $$objItem.$prop' + @crlf
        endif
    Next
    $ReadPropertiesSimple = $strHTML + @crlf
EndFunction


Top
#75178 - 2003-05-28 10:28 PM Re: ADSIKiXScriptomatic Learning Tool
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Great [Cool]

Thanks Chris. I'll take a look at implementing them into my code and trying them out when I get a chance.

If anyone else sees, finds an issue where they think they can help, please pitch in.

Top
#75179 - 2005-06-10 10:32 AM Re: ADSIKiXScriptomatic Learning Tool
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Sorry to drag up an old post, but someone e-mailed and asked about this and it took me a while to find it.

This code was never updated by me and currently I don't have time to review/update it either.

There are newer scripts from Microsoft on this topic and one should probably use their newer tools for now until such time as someone here has time to attempt a conversion to support KiXtart with Scriptomatic 2.1

KiXomatic by Chris S.
http://www.kixtart.org/ubbthreads/showflat.php?Number=86416
 
Microsoft releases ADSI Scriptomatic
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB14&Number=100023
 
The All-New KiXomatic 2.1 - 'Now with KiX!'
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=87235
 
KiXomatic 2.0 - Revised WmiEnumClasses with ProgressBar
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=87274
 
Scriptomatic 2 - Available for download
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=131762

Microsoft Scriptomatic 2 readme

Scriptomatic 2.0 download (1/13/2005)
 
 

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 837 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.07 seconds in which 0.03 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org