Search is not available for this dataset
content
stringlengths
0
376M
' ' Usage: pagefile <newInitialSize> <newMaximumSize> ' on error resume next ' NB - change the name of the pagefile as appropriate, or enter it as commandline arg Set pagefile = GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_PageFile=""C:\\Pagefile.sys""") if err = 0 then WScript.Echo "Current Pagefile Characteristics" WScript.Echo "================================" WScript.Echo WScript.Echo "Initial Size = " & pagefile.InitialSize WScript.Echo "Maximum Size = " & pagefile.MaximumSize ' Set the new values from the arguments pagefile.InitialSize = WScript.Arguments (0) pagefile.MaximumSize = WScript.Arguments (1) WScript.Echo WScript.Echo "New Pagefile Characteristics" WScript.Echo "================================" WScript.Echo WScript.Echo "Initial Size = " & pagefile.InitialSize WScript.Echo "Maximum Size = " & pagefile.MaximumSize set shell = CreateObject ("WScript.Shell") i = shell.Popup ("Do you want to commit these settings?", , "Pagefile Sample", 1) WScript.Echo "" if i = 1 then ' Commit the changes - will take effect on next reboot pagefile.Put_ if err = 0 then 'Changes made WScript.Echo "You will need to restart your system for these changes to take effect" else WScript.Echo "Error saving changes: " & Err.Description & " [0x" & Hex(Err.number) & "]" end if else end if else WScript.Echo "Error - could not access pagefile [0x" & Hex(Err.Number) & "]" end if
<filename>Task/Happy-numbers/VBA/happy-numbers.vba Option Explicit Sub Test_Happy() Dim i&, Cpt& For i = 1 To 100 If Is_Happy_Number(i) Then Debug.Print "Is Happy : " & i Cpt = Cpt + 1 If Cpt = 8 Then Exit For End If Next End Sub Public Function Is_Happy_Number(ByVal N As Long) As Boolean Dim i&, Number$, Cpt& Is_Happy_Number = False 'default value Do Cpt = Cpt + 1 'Count Loops Number = CStr(N) 'conversion Long To String to be able to use Len() function N = 0 For i = 1 To Len(Number) N = N + CInt(Mid(Number, i, 1)) ^ 2 Next i 'If Not N = 1 after 50 Loop ==> Number Is Not Happy If Cpt = 50 Then Exit Function Loop Until N = 1 Is_Happy_Number = True End Function
VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 3120 ClientLeft = 60 ClientTop = 345 ClientWidth = 6195 LinkTopic = "Form1" ScaleHeight = 3120 ScaleWidth = 6195 StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmdIRM Caption = "Inbound Routing Methods" BeginProperty Font Name = "<NAME>" Size = 11.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 1440 TabIndex = 10 Top = 960 Width = 4575 End Begin VB.CommandButton cmdDevices Caption = "Devices" BeginProperty Font Name = "<NAME>" Size = 11.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 4440 TabIndex = 9 Top = 1680 Width = 1575 End Begin VB.CommandButton cmdProviders Caption = "Device Providers" BeginProperty Font Name = "<NAME>" Size = 11.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 2640 TabIndex = 8 Top = 2400 Width = 1935 End Begin VB.CommandButton cmdSecurity Caption = "Security" BeginProperty Font Name = "Palatino Linotype" Size = 11.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 4800 TabIndex = 7 Top = 2400 Width = 1215 End Begin VB.CommandButton cmdActivity Caption = "Activity" BeginProperty Font Name = "Palatino Linotype" Size = 11.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 3000 TabIndex = 6 Top = 1680 Width = 1215 End Begin VB.CommandButton cmdLoggingOptions Caption = "Logging Options" BeginProperty Font Name = "Palatino Linotype" Size = 11.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 120 TabIndex = 5 Top = 2400 Width = 2295 End Begin VB.CommandButton cmdMail Caption = "Mail" BeginProperty Font Name = "Pal<NAME>" Size = 11.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 1560 TabIndex = 4 Top = 1680 Width = 1215 End Begin VB.CommandButton cmdQueue Caption = "Queue" BeginProperty Font Name = "Palatino Linotype" Size = 11.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 120 TabIndex = 3 Top = 1680 Width = 1215 End Begin VB.CommandButton cmdFolders Caption = "Folders" BeginProperty Font Name = "Palatino Linotype" Size = 11.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 120 TabIndex = 2 Top = 960 Width = 1215 End Begin VB.CommandButton cmdSentItems Caption = "Sent Items" Enabled = 0 'False Height = 495 Left = 1560 TabIndex = 1 Top = 120 Width = 1215 End Begin VB.CommandButton cmdInbox Caption = "Inbox" Enabled = 0 'False Height = 495 Left = 120 TabIndex = 0 Top = 120 Width = 1215 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim ServerObject As New FAXCOMEXLib.FaxServer Dim Folders As FaxFolders Dim bFoldersInitialized As Boolean Option Explicit Private Sub InitFolders() If Not bFoldersInitialized Then Set Folders = ServerObject.Folders bFoldersInitialized = True End If End Sub Private Sub cmdActivity_Click() Dim Act As FaxActivity Set Act = ServerObject.Activity MsgBox Act.DelegatedOutgoingMessages, , "Delegated" MsgBox Act.IncomingMessages, , "Incoming" MsgBox Act.OutgoingMessages, , "Outgoing" MsgBox Act.QueuedMessages, , "Queued" MsgBox Act.RoutingMessages, , "Routing" Act.Refresh MsgBox "After Refresh" MsgBox Act.DelegatedOutgoingMessages, , "Delegated" MsgBox Act.IncomingMessages, , "Incoming" MsgBox Act.OutgoingMessages, , "Outgoing" MsgBox Act.QueuedMessages, , "Queued" MsgBox Act.RoutingMessages, , "Routing" End Sub Private Sub cmdDevices_Click() Dim DevicesCollection As FaxDevices Set DevicesCollection = ServerObject.GetDevices MsgBox DevicesCollection.Count, , "Count" MsgBox DevicesCollection.Item(1).Id, , "Item(1).Id" MsgBox DevicesCollection.ItemById(65538).Id, , "ItemById(65538).Id" Dim Device As FaxDevice Set Device = DevicesCollection.Item(1) ' Dim Methods As Variant ' Methods = Device.UsedRoutingMethods ' MsgBox UBound(Methods), , "U BOUND" ' MsgBox LBound(Methods), , "L BOUND" ' MsgBox IsEmpty(Methods), , "IS EMPTY" ' If Not IsEmpty(Methods) Then ' MsgBox Methods(0), , "First GUID" ' End If MsgBox Device.AutoAnswer, , "Auto Answer" ' MsgBox Device.CSID, , "CSID" ' MsgBox Device.Description, , "Description" ' MsgBox Device.DeviceName, , "Device Name" ' MsgBox Device.Id, , "Id" ' MsgBox Device.PoweredOff, , "Powered Off" ' MsgBox Device.ProviderGUID, , "Provider GUID" ' MsgBox Device.ProviderName, , "Provider Name" ' MsgBox Device.Receive, , "Receive" ' Device.Refresh ' MsgBox Device.RingsBeforeAnswer, , "Rings After Refresh" ' MsgBox Device.Send, , "Send" ' MsgBox Device.TSID, , "TSID" Device.AutoAnswer = Not Device.AutoAnswer Device.Save MsgBox Device.AutoAnswer, , "AutoAnswer After Save" Dim vProperty(5) As Byte vProperty(0) = 1 vProperty(1) = 2 vProperty(2) = 3 vProperty(3) = 4 vProperty(4) = 5 Dim vArg As Variant vArg = vProperty Device.SetExtensionProperty "{C3C9B43B-A7F8-44ae-90B3-D6768CD0DA59}", vArg Dim vRes As Variant vRes = Device.GetExtensionProperty("{C3C9B43B-A7F8-44ae-90B3-D6768CD0DA59}") MsgBox UBound(vRes), , "U BOUND" MsgBox LBound(vRes), , "L BOUND" MsgBox IsEmpty(vRes), , "IS EMPTY" If Not IsEmpty(vRes) Then MsgBox vRes(0), , "First Value" MsgBox vRes(1), , "Second Value" MsgBox vRes(3), , "Fourth Value" MsgBox vRes(4), , "Fifth Value" End If End Sub Private Sub cmdFolders_Click() Dim ff As FaxFolders Set ff = ServerObject.Folders MsgBox ff.IncomingArchive.AgeLimit, , "Incoming Archive Age Limit" Set ServerObject = Nothing MsgBox ff.OutgoingArchive.AgeLimit, , "Outgoing Archive Age Limit" End Sub Private Sub cmdInbox_Click() InitFolders Dim Inbox As FaxIncomingArchive Set Inbox = Folders.IncomingArchive ' MsgBox Inbox.SizeHigh ' MsgBox Inbox.SizeLow Dim Iter As FaxIncomingMessageIterator Set Iter = Inbox.GetMessages MsgBox Iter.EOF Iter.MoveFirst ' MsgBox Iter.EOF Dim Msg As FaxIncomingMessage Set Msg = Iter.Message ' MsgBox Msg.Id Dim Msg2 As FaxIncomingMessage Set Msg2 = Inbox.GetMessage(Msg.Id) MsgBox Msg2.Id Dim Count As Integer Count = 0 Iter.MoveFirst Set Msg = Iter.Message MsgBox Msg.Id While Not Iter.EOF Count = Count + 1 Iter.MoveNext If Count > 1879 Then MsgBox Msg.Id Exit Sub End If Wend MsgBox Count, , "Total Num Of Messages" ' Dim InBoundMsg As FaxInboundMessage ' Set InBoundMsg = Inbox.GetMessage("1102719151") ' 0000000041ba28af ' MsgBox InBoundMsg.Id ' MsgBox InBoundMsg.Pages ' MsgBox InBoundMsg.TSID ' InBoundMsg.Delete ' Dim InBoundMsg2 As FaxInboundMessage ' Set InBoundMsg2 = Inbox.GetMessage("00000000926628ae") ' MsgBox Inbox.AgeLimit ' MsgBox Inbox.UseArchive ' Inbox.UseArchive = Not Inbox.UseArchive ' MsgBox Inbox.UseArchive End Sub Private Sub cmdIRM_Click() Dim IR As FaxInboundRouting Set IR = ServerObject.InboundRouting Dim Coll As FaxInboundRoutingMethods Set Coll = IR.GetMethods MsgBox Coll.Count, , "Count" MsgBox Coll.Item(1).Guid MsgBox Coll.Item(2).Priority MsgBox Coll.Item(3).Priority, , "Before Change" Coll.Item(3).Priority = Coll.Item(3).Priority + 3 MsgBox Coll.Item(3).Priority, , "After Change" Coll.Item(3).Save MsgBox Coll.Item(3).Priority, , "After Save" Coll.Item(3).Refresh MsgBox Coll.Item(3).Priority, , "After Refresh" End Sub Private Sub cmdLoggingOptions_Click() Dim LogOpt As FaxLoggingOptions Set LogOpt = ServerObject.LoggingOptions Set ServerObject = Nothing Dim xx As FaxActivityLogging Set xx = LogOpt.ActivityLogging MsgBox xx.DatabasePath, , "Database Path" MsgBox xx.LogIncoming, , "LogIncoming" MsgBox xx.LogOutgoing, , "LogOutgoing" xx.LogIncoming = Not xx.LogOutgoing xx.Save xx.Refresh MsgBox xx.LogIncoming, , "LogIncoming" MsgBox xx.LogOutgoing, , "LogOutgoing" Dim yy As FaxEventLogging Set yy = LogOpt.EventLogging MsgBox yy.GeneralEventsLevel, , "General Events Level" MsgBox yy.InboundEventsLevel, , "Inbound Events Level" yy.InboundEventsLevel = fllMAX yy.Save yy.Refresh MsgBox yy.InboundEventsLevel, , "Inbound Events Level" End Sub Private Sub cmdMail_Click() Dim Mail As FaxMailOptions Set Mail = ServerObject.MailOptions MsgBox Mail.MAPIProfile, , "MAPI Profile" MsgBox Mail.SMTPDomain, , "Domain" MsgBox Mail.SMTPPassword, , "Password" MsgBox Mail.SMTPPort, , "Port" MsgBox Mail.SMTPSender, , "Sender" MsgBox Mail.SMTPServer, , "Server" MsgBox Mail.SMTPUser, , "User" MsgBox Mail.Type, , "Type" Refresh Mail.Type = fmroNONE Mail.SMTPDomain = "kuku" Mail.Save End Sub Private Sub cmdProviders_Click() Dim DPS As FaxDeviceProviders Set DPS = ServerObject.GetDeviceProviders MsgBox DPS.Count If DPS.Count > 0 Then ' MsgBox DPS.Item(1).Capabilities, , "Capabilities" ' MsgBox DPS.Item(1).Debug, , "Debug" ' MsgBox DPS.Item(1).FriendlyName, , "FriendlyName" ' MsgBox DPS.Item(1).Guid, , "Guid" ' MsgBox DPS.Item(1).ImageName, , "ImageName" ' MsgBox DPS.Item(1).InitErrorCode, , "InitErrorCode" ' MsgBox DPS.Item(1).MajorBuild, , "MajorBuild" ' MsgBox DPS.Item(1).MajorVersion, , "MajorVersion" ' MsgBox DPS.Item(1).MinorBuild, , "MinorBuild" ' MsgBox DPS.Item(1).MinorVersion, , "MinorVersion" ' MsgBox DPS.Item(1).Status, , "Status" ' MsgBox DPS.Item(1).TapiProviderName, , "TapiProviderName" Dim IDS As Variant IDS = DPS.Item(1).DeviceIds MsgBox UBound(IDS) MsgBox LBound(IDS) MsgBox IsEmpty(IDS) MsgBox IDS(0), , "Device ID" MsgBox "Variant ( SafeArray ) is freed" End If Set DPS = Nothing MsgBox "collection is freed" End Sub Private Sub cmdQueue_Click() InitFolders Dim Q As FaxOutgoingQueue Set Q = Folders.OutgoingQueue ' MsgBox Q.AgeLimit, , "Age Limit" ' MsgBox Q.AllowPersonalCoverPages, , "Allow Personal Cover Pages" ' MsgBox Q.Blocked, , "Blocked" ' MsgBox Q.Branding, , "Branding" ' MsgBox Q.DiscountRateEnd, , "Discount Rate End" ' MsgBox Q.DiscountRateStart, , "Discount Rate Start" ' MsgBox Q.Paused, , "Paused" ' Q.Refresh ' MsgBox "After Refresh" ' MsgBox Q.Retries, , "Retries" ' MsgBox Q.RetryDelay, , "Retry Delay" ' MsgBox Q.UseDeviceTSID, , "Use Device TSID" Set ServerObject = Nothing Set Folders = Nothing Dim QJobs As FaxOutgoingJobs Set QJobs = Q.GetJobs MsgBox QJobs.Count, , "Count" ' Set Q = Nothing Dim Jb As FaxOutgoingJob For Each Jb In QJobs MsgBox Jb.Id, , "Id of Loop" Jb.Resume Next Set Jb = QJobs.Item(1) MsgBox Jb.Id, , "Job Id of Item #1 in the Outgoing Job Collection" Dim x As String x = Jb.Id Dim Jbb As FaxOutgoingJob Set Jbb = Q.GetJob(x) MsgBox Jbb.Subject, , "Job by Id : Subject" Dim QI As FaxIncomingQueue Set QI = Folders.IncomingQueue Dim InJobs As FaxIncomingJobs Set InJobs = QI.GetJobs MsgBox InJobs.Count, , "Count" ' Print_Job_Subject Jbb End Sub Private Sub Print_Job_Subject(JobToPrint As FaxOutgoingJob) MsgBox JobToPrint.Subject, , "Print Job Subject Function" End Sub Private Sub cmdSecurity_Click() Dim SS As FaxSecurity Set SS = ServerObject.Security Set ServerObject = Nothing MsgBox SS.GrantedRights, , "Granted Rights" MsgBox SS.Descriptor, , "Descriptor" ' SS.Save SS.Refresh Dim ARV As Variant ARV = SS.Descriptor ARV(1) = 23 SS.Descriptor = ARV MsgBox SS.Descriptor, , "After Set My Value" End Sub Private Sub cmdSentItems_Click() InitFolders Dim SentItems As FaxOutgoingArchive Set SentItems = Folders.OutgoingArchive ' MsgBox SentItems.ArchiveFolder, , "Age" ' MsgBox SentItems.AgeLimit, , "Archive Folder" Dim Msg As FaxOutgoingMessage Set Msg = SentItems.GetMessage("0x00000200873628ae") MsgBox Msg.Id, , "First Msg ID" ' Dim sId As String ' sId = "0x00000200873628ae" 'Msg.Id Dim MsgA As FaxOutgoingMessage Set MsgA = SentItems.GetMessage("0x00000200839628ae") MsgBox MsgA.Id, , "Second Msg ID" Dim Iter As FaxOutgoingMessageIterator Set Iter = SentItems.GetMessages MsgBox Iter.EOF, , "EOF" MsgBox Iter.PrefetchSize, , "Prefetch Size" Iter.MoveFirst MsgBox Iter.EOF, , "EOF after MoveFirst" Dim Count As Integer Count = 0 While Not Iter.EOF Set Msg = Iter.Message MsgBox Msg.Id Count = Count + 1 Iter.MoveNext Wend MsgBox Count, , "Total Num Of Messages" ' MsgBox SentItems.AgeLimit ' MsgBox SentItems.UseArchive ' SentItems.UseArchive = Not SentItems.UseArchive ' MsgBox SentItems.UseArchive ' Dim OutBoundMsg As FaxOutboundMessage ' Set OutBoundMsg = SentItems.GetMessage("2201291729070") ' 00000200873628ae ' MsgBox OutBoundMsg.Id ' MsgBox OutBoundMsg.Pages ' MsgBox OutBoundMsg.Subject ' Dim Recipient As FaxPersonalProfile ' Set Recipient = OutBoundMsg.Recipient ' MsgBox Recipient.Name End Sub Private Sub Form_Load() ServerObject.Connect "" bFoldersInitialized = False End Sub Private Sub Check_Submit() Dim DocObject As New FAXCOMEXLib.FaxDocument Dim RepCol As FaxRecipients Set RepCol = DocObject.Recipients Dim FirstRecipient As FaxPersonalProfile Set FirstRecipient = RepCol.Add("+93 (3) 44") Dim AttachmentsObject As FaxAttachments DocObject.Attachments.Add "d:\test\test.txt" DocObject.ScheduleType = fstSPECIFIC_TIME DocObject.ScheduleTime = Now + 10 DocObject.Submit ServerObject Set AttachmentsObject = Nothing Set FirstRecipient = Nothing Set DocObject = Nothing ServerObject.Disconnect Set ServerObject = Nothing End Sub
<filename>Task/Conditional-structures/Visual-Basic/conditional-structures-7.vb<gh_stars>1-10 myName = 2 Debug.Print Switch(myName = 1, "James", myName = 2, "Jacob", myName = 3, "Jeremy") 'return : "Jacob"
' Windows Installer utility to copy a file into a database text field ' For use with Windows Scripting Host, CScript.exe or WScript.exe ' Copyright (c) Microsoft Corporation. All rights reserved. ' Demonstrates processing of primary key data ' Option Explicit Const msiOpenDatabaseModeReadOnly = 0 Const msiOpenDatabaseModeTransact = 1 Const msiViewModifyUpdate = 2 Const msiReadStreamAnsi = 2 Dim argCount:argCount = Wscript.Arguments.Count If argCount > 0 Then If InStr(1, Wscript.Arguments(0), "?", vbTextCompare) > 0 Then argCount = 0 If (argCount < 4) Then Wscript.Echo "Windows Installer utility to copy a file into a database text field." &_ vbNewLine & "The 1st argument is the path to the installation database" &_ vbNewLine & "The 2nd argument is the database table name" &_ vbNewLine & "The 3rd argument is the set of primary key values, concatenated with colons" &_ vbNewLine & "The 4th argument is non-key column name to receive the text data" &_ vbNewLine & "The 5th argument is the path to the text file to copy" &_ vbNewLine & "If the 5th argument is omitted, the existing data will be listed" &_ vbNewLine & "All primary keys values must be specified in order, separated by colons" &_ vbNewLine &_ vbNewLine & "Copyright (C) Microsoft Corporation. All rights reserved." Wscript.Quit 1 End If ' Connect to Windows Installer object On Error Resume Next Dim installer : Set installer = Nothing Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError ' Process input arguments and open database Dim databasePath: databasePath = Wscript.Arguments(0) Dim tableName : tableName = Wscript.Arguments(1) Dim rowKeyValues: rowKeyValues = Split(Wscript.Arguments(2),":",-1,vbTextCompare) Dim dataColumn : dataColumn = Wscript.Arguments(3) Dim openMode : If argCount >= 5 Then openMode = msiOpenDatabaseModeTransact Else openMode = msiOpenDatabaseModeReadOnly Dim database : Set database = installer.OpenDatabase(databasePath, openMode) : CheckError Dim keyRecord : Set keyRecord = database.PrimaryKeys(tableName) : CheckError Dim keyCount : keyCount = keyRecord.FieldCount If UBound(rowKeyValues) + 1 <> keyCount Then Fail "Incorrect number of primary key values" ' Generate and execute query Dim predicate, keyIndex For keyIndex = 1 To keyCount If Not IsEmpty(predicate) Then predicate = predicate & " AND " predicate = predicate & "`" & keyRecord.StringData(keyIndex) & "`='" & rowKeyValues(keyIndex-1) & "'" Next Dim query : query = "SELECT `" & dataColumn & "` FROM `" & tableName & "` WHERE " & predicate REM Wscript.Echo query Dim view : Set view = database.OpenView(query) : CheckError view.Execute : CheckError Dim resultRecord : Set resultRecord = view.Fetch : CheckError If resultRecord Is Nothing Then Fail "Requested table row not present" ' Update value if supplied. Cannot store stream object in string column, must convert stream to string If openMode = msiOpenDatabaseModeTransact Then resultRecord.SetStream 1, Wscript.Arguments(4) : CheckError Dim sizeStream : sizeStream = resultRecord.DataSize(1) resultRecord.StringData(1) = resultRecord.ReadStream(1, sizeStream, msiReadStreamAnsi) : CheckError view.Modify msiViewModifyUpdate, resultRecord : CheckError database.Commit : CheckError Else Wscript.Echo resultRecord.StringData(1) End If Sub CheckError Dim message, errRec If Err = 0 Then Exit Sub message = Err.Source & " " & Hex(Err) & ": " & Err.Description If Not installer Is Nothing Then Set errRec = installer.LastErrorRecord If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText End If Fail message End Sub Sub Fail(message) Wscript.Echo message Wscript.Quit 2 End Sub
Option Explicit Sub Main_Dec2bin() Dim Nb As Long Nb = 5 Debug.Print "The decimal value " & Nb & " should produce an output of : " & DecToBin(Nb) Debug.Print "The decimal value " & Nb & " should produce an output of : " & DecToBin2(Nb) Nb = 50 Debug.Print "The decimal value " & Nb & " should produce an output of : " & DecToBin(Nb) Debug.Print "The decimal value " & Nb & " should produce an output of : " & DecToBin2(Nb) Nb = 9000 Debug.Print "The decimal value " & Nb & " should produce an output of : " & DecToBin(Nb) Debug.Print "The decimal value " & Nb & " should produce an output of : " & DecToBin2(Nb) End Sub Function DecToBin(ByVal Number As Long) As String Dim strTemp As String Do While Number > 1 strTemp = Number - 2 * (Number \ 2) & strTemp Number = Number \ 2 Loop DecToBin = Number & strTemp End Function Function DecToBin2(ByVal Number As Long, Optional Places As Long) As String If Number > 511 Then DecToBin2 = "Error : Number is too large ! (Number must be < 511)" ElseIf Number < -512 Then DecToBin2 = "Error : Number is too small ! (Number must be > -512)" Else If Places = 0 Then DecToBin2 = WorksheetFunction.Dec2Bin(Number) Else DecToBin2 = WorksheetFunction.Dec2Bin(Number, Places) End If End If End Function
<reponame>npocmaka/Windows-Server-2003 '---------------------------------------- ' test.vbs ' ~~~~~~~~ ' This script lists all of the object in ' the cluster and their properties. ' It uses bugtool.exe to allow ' OuputDebugString from vbs '---------------------------------------- Dim Log Set Log = CreateObject( "BugTool.Logger" ) Log.Write "Starting Cluster Test" & vbCRLF Main Log.Write "Ending Cluster Test" & vbCRLF Sub Main On Error Resume Next '---------------------------------------- ' Open the cluster '---------------------------------------- Dim Cluster Set Cluster = CreateObject( "MSCluster.Cluster" ) Cluster.Open( "stacyh1" ) '---------------------------------------- ' This is the kind of error checking you ' will need throughout VBSCRIPT code. '---------------------------------------- If Err.Number <> 0 Then Log.Write "Unable to open the cluster" & vbCRLF Log.Write "Error " & Hex(Err.Number) & ": " & Err.Description & vbCRLF Exit Sub End If Log.Write "Cluster Name = " & Cluster.Name & vbCRLF '---------------------------------------- ' Quick test for variant type convert... '---------------------------------------- Dim oNode Set oNode = Cluster.Nodes("1") Log.Write "Node ID = " & oNode.NodeID & vbCRLF '---------------------------------------- ' Start the whole thing! '---------------------------------------- ListNodes Cluster End Sub '-------------------------------------- ' List Nodes '-------------------------------------- Sub ListNodes( Cluster ) Dim Nodes Set Nodes = Cluster.Nodes Dim Node Dim nIndex For nIndex = 1 to Nodes.Count Set Node = Nodes( nIndex ) Log.Write "Node Name = " & Node.Name & vbCRLF ListGroups Node Next End Sub '-------------------------------------- ' List Groups '-------------------------------------- Sub ListGroups( Node ) Dim Groups Set Groups = Node.ResourceGroups Dim Group Dim nIndex For nIndex = 1 to Groups.Count Set Group = Groups( nIndex ) Log.Write "Group Name = " & Group.Name & vbCRLF ListResources Group Next End Sub '-------------------------------------- ' List Resources '-------------------------------------- Sub ListResources( Group ) Dim Resources Set Resources = Group.Resources Dim Resource Dim nIndex For nIndex = 1 To Resources.Count Set Resource = Resources( nIndex ) Log.Write "Resource Name = " & Resource.Name & vbCRLF ListProperties Resource Next End Sub '-------------------------------------- ' List Properties '-------------------------------------- Sub ListProperties( Resource ) Dim Properties Dim Property Dim nIndex '------------------------------ ' Common Properties '------------------------------ Set Properties = Resource.CommonProperties Log.Write "Common Properties for " & Resource.Name & vbCRLF For nIndex = 1 To Properties.Count Set Property = Properties(nIndex) Log.Write vbTab & Property.Name & " = " & Property.Value & vbCRLF Next '------------------------------ ' Private Properties '------------------------------ Set Properties = Resource.PrivateProperties Log.Write "Private Properties for " & Resource.Name & vbCRLF For nIndex = 1 To Properties.Count Set Property = Properties(nIndex) Log.Write vbTab & Property.Name & " = " & Property.Value & vbCRLF Next End Sub
' ' Copyright (c) 1997-1999 Microsoft Corporation ' ' ' This Script list the user-groups in this domain ' ' ' This is a general routine to enumerate instances of a given class ' In this script, it is called for the class "ds_group" ' Sub EnumerateInstances ( objService , objClass ) On Error Resume Next Dim objInstance Dim objEnumerator Set objEnumerator = objService.InstancesOf ( objClass ) If Err = 0 Then For Each objInstance In objEnumerator Dim propertyEnumerator Set propertyEnumerator = objInstance.Properties_ WScript.Echo propertyEnumerator.Item("DS_sAMAccountName") Next Else WScript.Echo "Err = " + Err.Number End If End Sub ' Start of script ' Create a locator and connect to the namespace where the DS Provider operates Dim objLocator Set objLocator = CreateObject("WbemScripting.SWbemLocator") Dim objService Set objService = objLocator.ConnectServer(".", "root\directory\LDAP") ' Set the impersonation level objService.Security_.ImpersonationLevel = 3 ' Enumerate the instances of the class "ds_group" EnumerateInstances objService , "ds_group"
VERSION 5.00 Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX" Begin VB.Form Form1 BorderStyle = 0 'None Caption = "Form1" ClientHeight = 4920 ClientLeft = 0 ClientTop = 0 ClientWidth = 9480 LinkTopic = "Form1" MaxButton = 0 'False MDIChild = -1 'True MinButton = 0 'False ScaleHeight = 4920 ScaleWidth = 9480 ShowInTaskbar = 0 'False Begin VB.ListBox List1 Height = 4350 Left = 120 TabIndex = 1 Top = 360 Width = 9135 End Begin TabDlg.SSTab SSTab1 Height = 4815 Left = 0 TabIndex = 0 Top = 0 Width = 9405 _ExtentX = 16589 _ExtentY = 8493 _Version = 327681 TabHeight = 520 TabCaption(0) = "Tab 0" TabPicture(0) = "Form1.frx":0000 Tab(0).ControlEnabled= -1 'True Tab(0).ControlCount= 0 TabCaption(1) = "Tab 1" Tab(1).ControlEnabled= 0 'False Tab(1).ControlCount= 0 TabCaption(2) = "Tab 2" Tab(2).ControlEnabled= 0 'False Tab(2).ControlCount= 0 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False
<gh_stars>1-10 ' Combinations and permutations - vbs - 10/04/2017 dim i,j Wscript.StdOut.WriteLine "-- Long Integer - Permutations - from 1 to 12" for i=1 to 12 for j=1 to i Wscript.StdOut.Write "P(" & i & "," & j & ")=" & perm(i,j) & " " next 'j Wscript.StdOut.WriteLine "" next 'i Wscript.StdOut.WriteLine "-- Float integer - Combinations from 10 to 60" for i=10 to 60 step 10 for j=1 to i step i\5 Wscript.StdOut.Write "C(" & i & "," & j & ")=" & comb(i,j) & " " next 'j Wscript.StdOut.WriteLine "" next 'i Wscript.StdOut.WriteLine "-- Float integer - Permutations from 5000 to 15000" for i=5000 to 15000 step 5000 for j=10 to 70 step 20 Wscript.StdOut.Write "C(" & i & "," & j & ")=" & perm(i,j) & " " next 'j Wscript.StdOut.WriteLine "" next 'i Wscript.StdOut.WriteLine "-- Float integer - Combinations from 200 to 1000" for i=200 to 1000 step 200 for j=20 to 100 step 20 Wscript.StdOut.Write "P(" & i & "," & j & ")=" & comb(i,j) & " " next 'j Wscript.StdOut.WriteLine "" next 'i function perm(x,y) dim i,z z=1 for i=x-y+1 to x z=z*i next 'i perm=z end function 'perm function fact(x) dim i,z z=1 for i=2 to x z=z*i next 'i fact=z end function 'fact function comb(byval x,byval y) if y>x then comb=0 elseif x=y then comb=1 else if x-y<y then y=x-y comb=perm(x,y)/fact(y) end if end function 'comb
VERSION 5.00 Begin VB.Form Form1 Begin VB.Timer Timer1 Interval = 250 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Hello World! " End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False 'Everything above this line is hidden when in the IDE. Private goRight As Boolean Private Sub Label1_Click() goRight = Not goRight End Sub Private Sub Timer1_Timer() If goRight Then x = Mid(Label1.Caption, 2) & Left(Label1.Caption, 1) Else x = Right(Label1.Caption, 1) & Left(Label1.Caption, Len(Label1.Caption) - 1) End If Label1.Caption = x End Sub
<reponame>LaudateCorpus1/RosettaCodeData Option Explicit Private Type POINTAPI x As Long y As Long End Type Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long Private Declare Function GetCursorPos Lib "USER32" (lpPoint As POINTAPI) As Long Private Declare Function GetWindowDC Lib "USER32" (ByVal hWnd As Long) As Long Sub Color_of_a_screen_pixel() Dim myColor As Long myColor = Get_Color_Under_Cursor End Sub Function Get_Color_Under_Cursor() As Long Dim Pos As POINTAPI, lngDc As Long lngDc = GetWindowDC(0) GetCursorPos Pos Get_Color_Under_Cursor = GetPixel(lngDc, Pos.x, Pos.y) End Function
<filename>inetsrv/query/apps/ci/sql.vbs '------------------------------------------- ' ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ' ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO ' THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A ' PARTICULAR PURPOSE. ' ' Copyright (c) Microsoft Corporation, 1999. All Rights Reserved. ' ' PROGRAM: qu.vbs ' ' PURPOSE: Illustrates use of Indexing Service with Windows Scripting Host. ' Same behavior as the C++ sample application QSample. ' ' PLATFORM: Windows 2000 ' '------------------------------------------- main '------------------------------------------- sub Main if WScript.Arguments.Count < 1 then call Usage end if ' set defaults for all arguments query = "" locale = "" forceci = TRUE inputfile = "" quiet = FALSE maxhits = 0 firsthits = FALSE repeat = 1 ' parse command line arguments for i = 0 to WScript.Arguments.Count - 1 arg = WScript.Arguments( i ) first = left( arg, 1 ) c = mid( arg, 2, 1 ) if "/" = first or "-" = first then if ":" = mid( arg, 3, 1 ) then v = mid( arg, 4 ) select case c case "e" locale = v case "f" forceci = ( v = "+" ) case "i" inputfile = v case "r" repeat = v case "x" maxhits = v case "y" maxhits = v firsthits = TRUE case else Usage end select else select case c case "q" quiet = TRUE case else Usage end select end if else if "" = query then query = arg else Usage end if next for i = 1 to repeat if "" = inputfile then if "" = query then Usage end if DoQuery query, locale, forceci, quiet, maxhits, firsthits else if "" <> query then call Usage ' Open the input file and treat each line as a query. ' Report errors, but don't stop reading queries. set fs = WScript.CreateObject( "Scripting.FileSystemObject" ) set f = fs.OpenTextFile( inputfile, 1 ) do until f.AtEndOfStream line = f.ReadLine on error resume next DoQuery line, locale, forceci, quiet, maxhits, firsthits if 0 <> Err.Number then out Err.Description out "The query '" & line & "' failed, error 0x" & Hex( Err.Number ) Err.Clear end if out "" loop end if next end sub '------------------------------------------- sub Out( str ) WScript.echo str end sub sub Out2( num, str ) out right( space( 9 ) & num, 9 ) & " " & str end sub '------------------------------------------- sub Usage out "usage: cscript sql.vbs [arguments]" out " query An Indexing Service query." out " /e:locale ISO locale identifier, e.g. EN-US; default is system locale." out " /f:(+|-) + or -, for force use of index. Default is +." out " /i:inputfile Text input file with queries, one per line." out " /q Quiet. Don't display info other than query results." out " /r:# Number of times to repeat the command." out " /x:maxhits Maximum number of hits to retrieve, default is no limit." out " /y:firsthits Only look at the first N results." out "" out " examples: cscript qu.vbs mango" out "" out " locales: af ar-ae ar-bh ar-dz ar-eg ar-iq ar-jo ar-kw ar-lb" out " ar-ly ar-ma ar-om ar-qa ar-sa ar-sy ar-tn ar-ye be" out " bg ca cs da de de-at de-ch de-li de-lu e en en" out " en-au en-bz en-ca en-gb en-ie en-jm en-nz en-tt" out " en-us en-za es es es-ar es-bo es-c es-co es-cr" out " es-do es-ec es-gt es-hn es-mx es-ni es-pa es-pe" out " es-pr es-py es-sv es-uy es-ve et eu fa fi fo fr" out " fr-be fr-ca fr-ch fr-lu gd gd-ie he hi hr hu in" out " is it it-ch ja ji ko ko lt lv mk ms mt n neutr" out " nl-be no no p pt pt-br rm ro ro-mo ru ru-mo s sb" out " sk sq sr sr sv sv-fi sx sz th tn tr ts uk ur ve" out " vi xh zh-cn zh-hk zh-sg zh-tw zu" WScript.Quit( 2 ) end sub '------------------------------------------- function FormatValue( v, t ) if 7 = t or 137 = t then w = 20 elseif 2 = t or 3 = t or 4 = t or 5 = t or 14 = t or 17 = t or 18 = t or 19 = t then w = 7 elseif 20 = t or 21 = t then w = 12 else w = 0 end if if 0 = w then r = v else r = right( space( w ) & v, w ) end if FormatValue = r end function Const STAT_BUSY = 0 Const STAT_ERROR = &H1 Const STAT_DONE = &H2 Const STAT_REFRESH = &H3 Const STAT_PARTIAL_SCOPE = &H8 Const STAT_NOISE_WORDS = &H10 Const STAT_CONTENT_OUT_OF_DATE = &H20 Const STAT_REFRESH_INCOMPLETE = &H40 Const STAT_CONTENT_QUERY_INCOMPLETE = &H80 Const STAT_TIME_LIMIT_EXCEEDED = &H100 Function GetCiOutOfDate(value) GetCiOutOfDate = value And STAT_CONTENT_OUT_OF_DATE end Function Function GetCiQueryIncomplete(value) GetCiQueryIncomplete = value And STAT_CONTENT_QUERY_INCOMPLETE end Function Function GetCiQueryTimedOut(value) GetCiQueryTimedOut = value And STAT_TIME_LIMIT_EXCEEDED end Function '------------------------------------------- sub DoQuery( query, locale, forceci, quiet, maxhits, firsthits ) if "" <> query then set Connection = WScript.CreateObject( "ADODB.Connection" ) Connection.ConnectionString = "provider=msidxs;" Connection.Open set AdoCommand = WScript.CreateObject( "ADODB.Command" ) AdoCommand.CommandTimeout = 10 AdoCommand.ActiveConnection = Connection ' AdoCommand.CommandText = "SELECT size,path from SYSTEM..SCOPE('""\""') WHERE CONTAINS('microsoft') AND DOCAUTHOR <> 'David' ORDER BY Path DESC" AdoCommand.CommandText = query AdoCommand.Properties("Always Use Content Index") = forceci if 0 <> maxhits then if firsthits then AdoCommand.Properties("First Rows") = maxhits else AdoCommand.Properties("Maximum Rows") = maxhits end if end if if "" <> locale then AdoCommand.Properties("SQL Content Query Locale String") = locale end if set rs = WScript.CreateObject( "ADODB.RecordSet" ) rs.CursorType = adOpenKeyset rs.open AdoCommand ' Display the results, 20 rows at a time for performance const cRowsToGet = 20 rs.CacheSize = cRowsToGet cHits = 0 do until rs.EOF rows = rs.GetRows( cRowsToGet ) for r = 0 to UBound( rows, 2 ) row = "" for col = 0 to UBound( rows, 1 ) if 0 <> col then row = row & " " row = row & FormatValue( rows( col, r ), rs( col ).type ) next out row cHits = cHits + 1 next loop ' Display query status information if not quiet then out CHR(10) & cHits & " files matched the query '" & query & "'" if GetCiOutofDate(RS.Properties("Rowset Query Status")) then out "The index is out of date" end if if GetCiQueryIncomplete(RS.Properties("Rowset Query Status")) then out "The query results are incomplete; may require enumeration" end if if GetCiQueryTimedOut(RS.Properties("Rowset Query Status")) then out "The query timed out" end if end if end if end sub
Set Args = wscript.Arguments Set regSR = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestoreConfig='SR'") If Args.Count() = 0 Then Wscript.Echo "Usage: RegSR [RP{Session|Global|Life}Interval[=value]] [DiskPercent[=value]]" Else For i = 0 To Args.Count() - 1 Myarg = Args.Item(i) Pos = InStr(Myarg, "=") If Pos <> 0 Then Myarray = Split(Myarg, "=", -1, 1) myoption = Myarray(0) value = Myarray(1) Else myoption = Myarg End If If myoption = "RPSessionInterval" Then If Pos = 0 Then Wscript.Echo "RPSessionInterval = " & regSR.RPSessionInterval Else regSR.RPSessionInterval = value regSR.Put_ End If ElseIf myoption = "RPGlobalInterval" Then If Pos = 0 Then Wscript.Echo "RPGlobalInterval = " & regSR.RPGlobalInterval Else regSR.RPGlobalInterval = value regSR.Put_ End If ElseIf myoption = "RPLifeInterval" Then If Pos = 0 Then Wscript.Echo "RPLifeInterval = " & regSR.RPLifeInterval Else regSR.RPLifeInterval = value regSR.Put_ End If ElseIf myoption = "DiskPercent" Then If Pos = 0 Then Wscript.Echo "DiskPercent = " & regSR.DiskPercent Else regSR.DiskPercent = value regSR.Put_ End If End If Next End If
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 Qualset As SWbemQualifierSet Set Qualset = GetObject("winmgmts:").Get().Qualifiers_ Qualset.Add "q1", True Qualset.Add "q2", Array(1, 2, 3) Qualset.Add "q3", -2.33 Dim Q As SWbemQualifier Dim QQ As SWbemQualifier For Each Q In Qualset If IsArray(Q.Value) Then Dim str As String str = Q.Name & "= {" For x = LBound(Q.Value) To UBound(Q.Value) str = str & Q.Value(x) If x < UBound(Q.Value) Then str = str & "," Else str = str & "}" End If Next x Debug.Print str Else Debug.Print Q.Name, "=", Q.Value End If For Each QQ In Qualset Debug.Print QQ.Name Next Next End Sub
str = "IT WAS THE BEST OF TIMES, IT WAS THE WORST OF TIMES." Wscript.Echo str Wscript.Echo Rotate(str,5) Wscript.Echo Rotate(Rotate(str,5),-5) 'Rotate (Caesar encrypt/decrypt) test <numpos> positions. ' numpos < 0 - rotate left ' numpos > 0 - rotate right 'Left rotation is converted to equivalent right rotation Function Rotate (text, numpos) dim dic: set dic = CreateObject("Scripting.Dictionary") dim ltr: ltr = Split("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z") dim rot: rot = (26 + numpos Mod 26) Mod 26 'convert all to right rotation dim ch dim i for i = 0 to ubound(ltr) dic(ltr(i)) = ltr((rot+i) Mod 26) next Rotate = "" for i = 1 to Len(text) ch = Mid(text,i,1) if dic.Exists(ch) Then Rotate = Rotate & dic(ch) else Rotate = Rotate & ch end if next End Function
Function Encrypt(text,key) text = OnlyCaps(text) key = OnlyCaps(key) j = 1 For i = 1 To Len(text) ms = Mid(text,i,1) m = Asc(ms) - Asc("A") ks = Mid(key,j,1) k = Asc(ks) - Asc("A") j = (j Mod Len(key)) + 1 c = (m + k) Mod 26 c = Chr(Asc("A")+c) Encrypt = Encrypt & c Next End Function Function Decrypt(text,key) key = OnlyCaps(key) j = 1 For i = 1 To Len(text) ms = Mid(text,i,1) m = Asc(ms) - Asc("A") ks = Mid(key,j,1) k = Asc(ks) - Asc("A") j = (j Mod Len(key)) + 1 c = (m - k + 26) Mod 26 c = Chr(Asc("A")+c) Decrypt = Decrypt & c Next End Function Function OnlyCaps(s) For i = 1 To Len(s) char = UCase(Mid(s,i,1)) If Asc(char) >= 65 And Asc(char) <= 90 Then OnlyCaps = OnlyCaps & char End If Next End Function 'testing the functions orig_text = "Beware the Jabberwock, my son! The jaws that bite, the claws that catch!" orig_key = "vigenerecipher" WScript.StdOut.WriteLine "Original: " & orig_text WScript.StdOut.WriteLine "Key: " & orig_key WScript.StdOut.WriteLine "Encrypted: " & Encrypt(orig_text,orig_key) WScript.StdOut.WriteLine "Decrypted: " & Decrypt(Encrypt(orig_text,orig_key),orig_key)
' ' Copyright (c) Microsoft Corporation. All rights reserved. ' ' VBScript Source File ' ' Script Name: IIsWeb.vbs ' Option Explicit On Error Resume Next ' Error codes Const ERR_OK = 0 Const ERR_GENERAL_FAILURE = 1 ''''''''''''''''''''' ' Messages Const L_BindingConflict_ErrorMessage = "(ERROR: BINDING CONFLICT)" Const L_SitesNotFound_ErrorMessage = "Site(s) not found." Const L_IsAlready_Message = "Server %1 is already %2" Const L_CannotStart_Message = "%1: Server cannot be started in its current state" Const L_CannotStart2_Message = "(%1 server is %2)" Const L_CannotStop_Message = "%1: Server cannot be stopped in its current state" Const L_CannotStop2_Message = "(%1 server is %2)" Const L_CannotPause_Message = "%1: Server cannot be paused in its current state" Const L_CannotPause2_Message = "(%1 server is %2)" Const L_HasBeen_Message = "Server %1 has been %2" Const L_All_Text = "ALL" Const L_AllUnassigned_Text = "ALL UNASSIGNED" Const L_NotSpecified_Text = "NOT SPECIFIED" Const L_Server_Text = "Server" Const L_SiteName_Text = "Site Name" Const L_MetabasePath_Message = "Metabase Path" Const L_IP_Text = "IP" Const L_Host_Text = "Host" Const L_Port_Text = "Port" Const L_Root_Text = "Root" Const L_Status_Text = "Status" Const L_NA_Text = "N/A" Const L_Error_ErrorMessage = "Error &H%1: %2" Const L_UnexpectedState_ErrorMessage = "Unexpected state" Const L_GetRoot_ErrorMessage = "Could not obtaing ROOT virtual dir of site %1" Const L_RecursiveDel_ErrorMessage = "Could not recursively delete application site %1" Const L_SiteGet_ErrorMessage = "Could not obtain web site %1" Const L_Stop_ErrorMessage = "Could not stop web site %1" Const L_SiteDel_ErrorMessage = "Could not delete web site %1" Const L_GetWebServer_ErrorMessage = "Error trying to obtain WebServer object." Const L_CannotCreateDir_ErrorMessage = "Could not create root directory" Const L_DirFormat_ErrorMessage = "Root directory format unknown. Please use the" Const L_DirFormat2_ErrorMessage = "'<drive>:\<path>' format." Const L_CannotControl_ErrorMessage = "Server cannot be controled in its current state" Const L_FailChange_ErrorMessage = "Failed to change status of server %1" Const L_OperationRequired_ErrorMessage = "Please specify an operation before the arguments." Const L_MinInfoNeeded_ErrorMessage = "Need at least <root> to create a site." Const L_NotEnoughParams_ErrorMessage = "Not enough parameters." Const L_Query_ErrorMessage = "Error occurred while querying WMI provider." Const L_OnlyOneOper_ErrorMessage = "Please specify only one operation at a time." Const L_ServerInstance_ErrorMessage = "Error trying to create a new web server instance." Const L_ServerPut_ErrorMessage = "Error trying to save new web server instance." Const L_VDirInstance_ErrorMessage = "Error trying to create a new virtual directory instance." Const L_VDirPut_ErrorMessage = "Error trying to save new virtual directory instance." Const L_ScriptHelper_ErrorMessage = "Could not create an instance of the IIsScriptHelper object." Const L_CmdLib_ErrorMessage = "Could not create an instance of the CmdLib object." Const L_ChkCmdLibReg_ErrorMessage = "Please register the Microsoft.CmdLib component." Const L_ChkScpHelperReg_ErrorMessage = "Please register the Microsoft.IIsScriptHelper component." Const L_InvalidIP_ErrorMessage = "Invalid IP Address. Please check if it is well formated and" Const L_InvalidIP2_ErrorMessage = "belongs to this machine." Const L_InvalidPort_ErrorMessage = "Invalid port number." Const L_MapDrive_ErrorMessage = "Could not map network drive." Const L_PassWithoutUser_ErrorMessage = "Please specify /u switch before using /p." Const L_WMIConnect_ErrorMessage = "Could not connect to WMI provider." Const L_InvalidSwitch_ErrorMessage = "Invalid switch: %1" Const L_Admin_ErrorMessage = "You cannot run this command because you are not an" Const L_Admin2_ErrorMessage = "administrator on the server you are trying to configure." ''''''''''''''''''''' ' Help ' General help messages Const L_SeeHelp_Message = "Type IIsWeb /? for help." Const L_SeeStartHelp_Message = "Type IIsWeb /start /? for help." Const L_SeeStopHelp_Message = "Type IIsWeb /stop /? for help." Const L_SeePauseHelp_Message = "Type IIsWeb /pause /? for help." Const L_SeeCreateHelp_Message = "Type IIsWeb /create /? for help." Const L_SeeDeleteHelp_Message = "Type IIsWeb /delete /? for help." Const L_SeeQueryHelp_Message = "Type IIsWeb /query /? for help." Const L_Help_HELP_General01_Text = "Description: Start, Stop, Pause, Delete, Query, or Create a" Const L_Help_HELP_General01a_Text = " Web Site" Const L_Help_HELP_General02_Text = "Syntax: IIsWeb [/s <server> [/u <username> [/p <password>]]]" Const L_Help_HELP_General03_Text = " /<operation> [arguments]" Const L_Help_HELP_General04_Text = "Parameters:" Const L_Help_HELP_General05_Text = "" Const L_Help_HELP_General06_Text = "Value Description" Const L_Help_HELP_General07_Text = "/s <server> Connect to machine <server>" Const L_Help_HELP_General07a_Text = " [Default: this system]" Const L_Help_HELP_General08_Text = "/u <username> Connect as <domain>\<username> or" Const L_Help_HELP_General09_Text = " <username> [Default: current user]" Const L_Help_HELP_General10_Text = "/p <password> Password for the <username> user" Const L_Help_HELP_General11_Text = "<operation> /start Starts a site(s) on given" Const L_Help_HELP_General11a_Text = " IIS Server." Const L_Help_HELP_General12_Text = " /stop Stops a site(s) from running" Const L_Help_HELP_General13_Text = " on a given IIS Server." Const L_Help_HELP_General14_Text = " /pause Pauses a site(s) that is" Const L_Help_HELP_General15_Text = " running on a given IIS Server." Const L_Help_HELP_General18_Text = " /delete Deletes IIS configuration" Const L_Help_HELP_General19_Text = " from an existing Web Site." Const L_Help_HELP_General19a_Text = " Content will not be deleted." Const L_Help_HELP_General20_Text = " /create Creates a Web Site." Const L_Help_HELP_General21_Text = " /query Queries existing Web Sites." Const L_Help_HELP_General22_Text = "For detailed usage:" Const L_Help_HELP_General23_Text = "IIsWeb /start /?" Const L_Help_HELP_General24_Text = "IIsWeb /stop /?" Const L_Help_HELP_General25_Text = "IIsWeb /pause /?" Const L_Help_HELP_General27_Text = "IIsWeb /delete /?" Const L_Help_HELP_General28_Text = "IIsWeb /create /?" Const L_Help_HELP_General29_Text = "IIsWeb /query /?" ' Common to all status change commands Const L_Help_HELP_Status03_Text = "Parameters:" Const L_Help_HELP_Status09_Text = "<website> Use either the site name or metabase" Const L_Help_HELP_Status09p1_Text = " path to specify the site" Const L_Help_HELP_Status10_Text = "Examples:" ' Start help messages Const L_Help_HELP_Start01_Text = "Description: Starts a site(s) on a given IIS Server." Const L_Help_HELP_Start02_Text = "Syntax: IIsWeb [/s <server> [/u <username> [/p <password>]]]" Const L_Help_HELP_Start02p1_Text = " /start <website> [<website> ...]" Const L_Help_HELP_Start11_Text = "IIsWeb /start ""Default Web Site""" Const L_Help_HELP_Start12_Text = "IIsWeb /start w3svc/1" Const L_Help_HELP_Start13_Text = "IIsWeb /start w3svc/2 ""Default Web Site"" w3svc/10" Const L_Help_HELP_Start14_Text = "IIsWeb /s Server1 /u Administrator /p p@ssWOrd /start w3svc/4" ' Stop help messages Const L_Help_HELP_Stop01_Text = "Description: Stops a site(s) on a given IIS Server." Const L_Help_HELP_Stop02_Text = "Syntax: IIsWeb [/s <server> [/u <username> [/p <password>]]]" Const L_Help_HELP_Stop02p1_Text = " /stop <website> [<website> ...]" Const L_Help_HELP_Stop11_Text = "IIsWeb /stop ""Default Web Site""" Const L_Help_HELP_Stop12_Text = "IIsWeb /stop w3svc/1" Const L_Help_HELP_Stop13_Text = "IIsWeb /stop w3svc/2 ""Default Web Site"" w3svc/10" Const L_Help_HELP_Stop14_Text = "IIsWeb /s Server1 /u Administrator /p p@ssWOrd /stop w3svc/4" ' Pause help messages Const L_Help_HELP_Pause01_Text = "Description: Pauses a site(s) on a given IIS Server." Const L_Help_HELP_Pause02_Text = "Syntax: IIsWeb [/s <server> [/u <username> [/p <password>]]]" Const L_Help_HELP_Pause02p1_Text = " /pause <website> [<website> ...]" Const L_Help_HELP_Pause11_Text = "IIsWeb /pause ""Default Web Site""" Const L_Help_HELP_Pause12_Text = "IIsWeb /pause w3svc/1" Const L_Help_HELP_Pause13_Text = "IIsWeb /pause w3svc/2 ""Default Web Site"" w3svc/10" Const L_Help_HELP_Pause14_Text = "IIsWeb /s Server1 /u Administrator /p p@ssWOrd /pause w3svc/4" ' Delete help messages Const L_Help_HELP_Delete01_Text = "Description: Deletes IIS configuration for an existing web" Const L_Help_HELP_Delete01p1_Text = " site. Content will not be deleted." Const L_Help_HELP_Delete02_Text = "Syntax: IIsWeb [/s <server> [/u <username> [/p <password>]]]" Const L_Help_HELP_Delete02p1_Text = " /delete <website> [<website> ...]" Const L_Help_HELP_Delete11_Text = "IIsWeb /delete ""Default Web Site""" Const L_Help_HELP_Delete12_Text = "IIsWeb /delete w3svc/1" Const L_Help_HELP_Delete13_Text = "IIsWeb /delete w3svc/2 ""Default Web Site"" w3svc/10" Const L_Help_HELP_Delete14_Text = "IIsWeb /s Server1 /u Administrator /p p@ssWOrd /delete w3svc/4" ' Create help messages Const L_Help_HELP_Create01_Text = "Description: Creates a web site." Const L_Help_HELP_Create02_Text = "Syntax: IIsWeb [/s <server> [/u <username> [/p <password>]]]" Const L_Help_HELP_Create02p1_Text = " /create <root> <name> [/d <host>] [/b <port>]" Const L_Help_HELP_Create02p2_Text = " [/i <ip>] [/dontstart]" Const L_Help_HELP_Create09_Text = "<root> Root directory for the new server. If" Const L_Help_HELP_Create09p1_Text = " this directory does not exist, it" Const L_Help_HELP_Create09p2_Text = " will be created." Const L_Help_HELP_Create10_Text = "<name> The name that appears in the Microsoft" Const L_Help_HELP_Create10p1_Text = " Management Console (MMC)." Const L_Help_HELP_Create11_Text = "/d <host> The host name to assign to this site." Const L_Help_HELP_Create11p1_Text = " WARNING: Only use host name if DNS" Const L_Help_HELP_Create11p2_Text = " is set up to find the server" Const L_Help_HELP_Create12_Text = "/b <port> The number of the port to which the" Const L_Help_HELP_Create12p1_Text = " new server should bind. [Default: 80]" Const L_Help_HELP_Create13_Text = "/i <ip> The IP address to assign to the new" Const L_Help_HELP_Create13p1_Text = " server. [Default: All Unassigned]" Const L_Help_HELP_Create15_Text = "/dontstart Don't start this site after it is created." Const L_Help_HELP_Create22_Text = "IIsWeb /create c:\inetpub\wwwroot ""My Site"" /b 80" Const L_Help_HELP_Create23_Text = "IIsWeb /s Server1 /u Administrator /p p@assWOrd /create c:\inetpub\wwwroot" Const L_Help_HELP_Create23p1_Text = " ""My Site""" Const L_Help_HELP_Create24_Text = "IIsWeb /create c:\inetpub\wwwroot ""My Site"" /i 172.30.163.244 /b 80" Const L_Help_HELP_Create24p1_Text = " /d www.mysite.com" ' Query help messages Const L_Help_HELP_Query01_Text = "Description: Queries existing web sites." Const L_Help_HELP_Query02_Text = "Syntax: IIsWeb [/s <server> [/u <username> [/p <password>]]]" Const L_Help_HELP_Query02p1_Text = " /query [<website> ...]" Const L_Help_HELP_Query11_Text = "IIsWeb /query ""Default Web Site""" Const L_Help_HELP_Query12_Text = "IIsWeb /query w3svc/1" Const L_Help_HELP_Query13_Text = "IIsWeb /query" Const L_Help_HELP_Query14_Text = "IIsWeb /query ""Default Web Site"" ""Sample Site"" w3svc/1" Const L_Help_HELP_Query15_Text = "IIsWeb /s Server1 /u Administrator /p p@ssW0rd /query ""Default Web Site""" ' Status Const L_Started_Text = "started" Const L_Stopped_Text = "stopped" Const L_Paused_Text = "paused" Const L_Continued_Text = "continued" Const L_Deleted_Text = "deleted" '''''''''''''''''''''''' Dim SiteStatus SiteStatus = Array("", "", L_Started_Text, "", L_Stopped_Text, "", L_Paused_Text, L_Continued_Text, L_Deleted_Text) ' Operation codes Const OPER_START = 1 Const OPER_STOP = 2 Const OPER_PAUSE = 3 Const OPER_DELETE = 4 Const OPER_CREATE = 5 Const OPER_QUERY = 6 ' ServerState codes Const SERVER_STARTING = 1 Const SERVER_STARTED = 2 Const SERVER_STOPPING = 3 Const SERVER_STOPPED = 4 Const SERVER_PAUSING = 5 Const SERVER_PAUSED = 6 Const SERVER_CONTINUING = 7 ' ' Main block ' Dim oScriptHelper, oCmdLib Dim strServer, strUser, strPassword, strSite Dim intOperation, intResult Dim strRoot, strName, strHost, strPort, strIP Dim bDontStart Dim aArgs, arg Dim strCmdLineOptions Dim oError ' Default values strServer = "." strUser = "" strPassword = "" intOperation = 0 strSite = "" strName = "" bDontStart = False ' Instantiate the CmdLib for output string formatting Set oCmdLib = CreateObject("Microsoft.CmdLib") If Err.Number <> 0 Then WScript.Echo L_CmdLib_ErrorMessage WScript.Echo L_ChkCmdLibReg_ErrorMessage WScript.Quit(ERR_GENERAL_FAILURE) End If Set oCmdLib.ScriptingHost = WScript.Application ' Instantiate script helper object Set oScriptHelper = CreateObject("Microsoft.IIsScriptHelper") If Err.Number <> 0 Then WScript.Echo L_ScriptHelper_ErrorMessage WScript.Echo L_ChkScpHelperReg_ErrorMessage WScript.Quit(ERR_GENERAL_FAILURE) End If Set oScriptHelper.ScriptHost = WScript ' Check if we are being run with cscript.exe instead of wscript.exe oScriptHelper.CheckScriptEngine ' Minimum number of parameters must exist If WScript.Arguments.Count < 1 Then WScript.Echo L_NotEnoughParams_ErrorMessage WScript.Echo L_SeeHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If strCmdLineOptions = "[server:s:1;user:u:1;password:p:1];start::n;stop::n;pause::n;delete::n;" & _ "[create:c:1;domain:d:1;port:b:1;ip:i:1;dontstart::0];query:q:n" Set oError = oScriptHelper.ParseCmdLineOptions(strCmdLineOptions) If Not oError Is Nothing Then If oError.ErrorCode = oScriptHelper.ERROR_NOT_ENOUGH_ARGS Then ' Not enough arguments for a specified switch WScript.Echo L_NotEnoughParams_ErrorMessage If oError.SwitchName = "create" Then WScript.Echo L_SeeCreateHelp_Message Else WScript.Echo L_SeeHelp_Message End If Else ' Invalid switch oCmdLib.vbPrintf L_InvalidSwitch_ErrorMessage, Array(oError.SwitchName) WScript.Echo L_SeeHelp_Message End If WScript.Quit(ERR_GENERAL_FAILURE) End If If oScriptHelper.GlobalHelpRequested Then DisplayHelpMessage WScript.Quit(ERR_OK) End If For Each arg In oScriptHelper.Switches Select Case arg Case "server" ' Server information strServer = oScriptHelper.GetSwitch(arg) Case "user" ' User information strUser = oScriptHelper.GetSwitch(arg) Case "password" ' Password information strPassword = oScriptHelper.GetSwitch(arg) Case "start" If (intOperation <> 0) Then WScript.Echo L_OnlyOneOper_ErrorMessage WScript.Echo L_SeeHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If intOperation = OPER_START If oScriptHelper.IsHelpRequested(arg) Then DisplayStartHelpMessage WScript.Quit(ERR_OK) End If aArgs = oScriptHelper.GetSwitch(arg) If UBound(aArgs) = -1 Then WScript.Echo L_NotEnoughParams_ErrorMessage WScript.Echo L_SeeStartHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If Case "stop" If (intOperation <> 0) Then WScript.Echo L_OnlyOneOper_ErrorMessage WScript.Echo L_SeeHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If intOperation = OPER_STOP If oScriptHelper.IsHelpRequested(arg) Then DisplayStopHelpMessage WScript.Quit(ERR_OK) End If aArgs = oScriptHelper.GetSwitch(arg) If UBound(aArgs) = -1 Then WScript.Echo L_NotEnoughParams_ErrorMessage WScript.Echo L_SeeStopHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If Case "pause" If (intOperation <> 0) Then WScript.Echo L_OnlyOneOper_ErrorMessage WScript.Echo L_SeeHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If intOperation = OPER_PAUSE If oScriptHelper.IsHelpRequested(arg) Then DisplayPauseHelpMessage WScript.Quit(ERR_OK) End If aArgs = oScriptHelper.GetSwitch(arg) If UBound(aArgs) = -1 Then WScript.Echo L_NotEnoughParams_ErrorMessage WScript.Echo L_SeePauseHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If Case "create" If (intOperation <> 0) Then WScript.Echo L_OnlyOneOper_ErrorMessage WScript.Echo L_SeeHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If intOperation = OPER_CREATE If oScriptHelper.IsHelpRequested(arg) Then DisplayCreateHelpMessage WScript.Quit(ERR_OK) End If strRoot = oScriptHelper.GetSwitch(arg) aArgs = oScriptHelper.NamedArguments If strRoot = "" Or UBound(aArgs) = -1 Then WScript.Echo L_NotEnoughParams_ErrorMessage WScript.Echo L_SeeCreateHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If strName = aArgs(0) strHost = oScriptHelper.GetSwitch("domain") strPort = oScriptHelper.GetSwitch("port") strIP = oScriptHelper.GetSwitch("ip") If oScriptHelper.Switches.Exists("dontstart") Then bDontStart = True End If Case "delete" If (intOperation <> 0) Then WScript.Echo L_OnlyOneOper_ErrorMessage WScript.Echo L_SeeHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If intOperation = OPER_DELETE If oScriptHelper.IsHelpRequested(arg) Then DisplayDeleteHelpMessage WScript.Quit(ERR_OK) End If aArgs = oScriptHelper.GetSwitch(arg) If UBound(aArgs) = -1 Then WScript.Echo L_NotEnoughParams_ErrorMessage WScript.Echo L_SeeDeleteHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If Case "query" If (intOperation <> 0) Then WScript.Echo L_OnlyOneOper_ErrorMessage WScript.Echo L_SeeHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If intOperation = OPER_QUERY If oScriptHelper.IsHelpRequested(arg) Then DisplayQueryHelpMessage WScript.Quit(ERR_OK) End If aArgs = oScriptHelper.GetSwitch(arg) End Select Next ' Check Parameters If intOperation = 0 Then WScript.Echo L_OperationRequired_ErrorMessage WScript.Echo L_SeeHelp_Message WScript.Quit(ERR_GENERAL_FAILURE) End If ' Check if /p is specified but /u isn't. In this case, we should bail out with an error If oScriptHelper.Switches.Exists("password") And Not oScriptHelper.Switches.Exists("user") Then WScript.Echo L_PassWithoutUser_ErrorMessage WScript.Quit(ERR_GENERAL_FAILURE) End If ' Check if /u is specified but /p isn't. In this case, we should ask for a password If oScriptHelper.Switches.Exists("user") And Not oScriptHelper.Switches.Exists("password") Then strPassword = <PASSWORD> End If ' Initializes authentication with remote machine intResult = oScriptHelper.InitAuthentication(strServer, strUser, strPassword) If intResult <> 0 Then WScript.Quit(intResult) End If ' Choose operation Select Case intOperation Case OPER_START intResult = ChangeWebSiteStatus(aArgs, SERVER_STARTED) Case OPER_STOP intResult = ChangeWebSiteStatus(aArgs, SERVER_STOPPED) Case OPER_PAUSE intResult = ChangeWebSiteStatus(aArgs, SERVER_PAUSED) Case OPER_DELETE intResult = DeleteWebSite(aArgs) Case OPER_CREATE 'intResult = CreateWebSite(aArgs) intResult = CreateWebSite(strRoot, strName, strHost, strPort, strIP, bDontStart) Case OPER_QUERY intResult = QueryWebSite(aArgs) End Select ' Return value to command processor WScript.Quit(intResult) ''''''''''''''''''''''''' ' End Of Main Block ''''''''''''''''''''' ''''''''''''''''''''''''''' ' DisplayHelpMessage ''''''''''''''''''''''''''' Sub DisplayHelpMessage() WScript.Echo L_Help_HELP_General01_Text WScript.Echo L_Help_HELP_General01a_Text WScript.Echo WScript.Echo L_Help_HELP_General02_Text WScript.Echo L_Help_HELP_General03_Text WScript.Echo 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_General07a_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_General11a_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_General18_Text WScript.Echo L_Help_HELP_General19_Text WScript.Echo L_Help_HELP_General19a_Text WScript.Echo L_Help_HELP_General20_Text WScript.Echo L_Help_HELP_General21_Text WScript.Echo WScript.Echo L_Help_HELP_General22_Text WScript.Echo 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_General27_Text WScript.Echo L_Help_HELP_General28_Text WScript.Echo L_Help_HELP_General29_Text End Sub Sub DisplayStartHelpMessage() WScript.Echo L_Help_HELP_Start01_Text WScript.Echo WScript.Echo L_Help_HELP_Start02_Text WScript.Echo L_Help_HELP_Start02p1_Text WScript.Echo WScript.Echo L_Help_HELP_Status03_Text WScript.Echo WScript.Echo L_Help_HELP_General06_Text WScript.Echo L_Help_HELP_General07_Text WScript.Echo L_Help_HELP_General07a_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_Status09_Text WScript.Echo L_Help_HELP_Status09p1_Text WScript.Echo WScript.Echo WScript.Echo L_Help_HELP_Status10_Text WScript.Echo WScript.Echo L_Help_HELP_Start11_Text WScript.Echo L_Help_HELP_Start12_Text WScript.Echo L_Help_HELP_Start13_Text WScript.Echo L_Help_HELP_Start14_Text End Sub Sub DisplayStopHelpMessage() WScript.Echo L_Help_HELP_Stop01_Text WScript.Echo WScript.Echo L_Help_HELP_Stop02_Text WScript.Echo L_Help_HELP_Stop02p1_Text WScript.Echo WScript.Echo L_Help_HELP_Status03_Text WScript.Echo WScript.Echo L_Help_HELP_General06_Text WScript.Echo L_Help_HELP_General07_Text WScript.Echo L_Help_HELP_General07a_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_Status09_Text WScript.Echo L_Help_HELP_Status09p1_Text WScript.Echo WScript.Echo WScript.Echo L_Help_HELP_Status10_Text WScript.Echo WScript.Echo L_Help_HELP_Stop11_Text WScript.Echo L_Help_HELP_Stop12_Text WScript.Echo L_Help_HELP_Stop13_Text WScript.Echo L_Help_HELP_Stop14_Text End Sub Sub DisplayPauseHelpMessage() WScript.Echo L_Help_HELP_Pause01_Text WScript.Echo WScript.Echo L_Help_HELP_Pause02_Text WScript.Echo L_Help_HELP_Pause02p1_Text WScript.Echo WScript.Echo L_Help_HELP_Status03_Text WScript.Echo WScript.Echo L_Help_HELP_General06_Text WScript.Echo L_Help_HELP_General07_Text WScript.Echo L_Help_HELP_General07a_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_Status09_Text WScript.Echo L_Help_HELP_Status09p1_Text WScript.Echo WScript.Echo WScript.Echo L_Help_HELP_Status10_Text WScript.Echo WScript.Echo L_Help_HELP_Pause11_Text WScript.Echo L_Help_HELP_Pause12_Text WScript.Echo L_Help_HELP_Pause13_Text WScript.Echo L_Help_HELP_Pause14_Text End Sub Sub DisplayDeleteHelpMessage() WScript.Echo L_Help_HELP_Delete01_Text WScript.Echo L_Help_HELP_Delete01p1_Text WScript.Echo WScript.Echo L_Help_HELP_Delete02_Text WScript.Echo L_Help_HELP_Delete02p1_Text WScript.Echo WScript.Echo L_Help_HELP_Status03_Text WScript.Echo WScript.Echo L_Help_HELP_General06_Text WScript.Echo L_Help_HELP_General07_Text WScript.Echo L_Help_HELP_General07a_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_Status09_Text WScript.Echo L_Help_HELP_Status09p1_Text WScript.Echo WScript.Echo WScript.Echo L_Help_HELP_Status10_Text WScript.Echo WScript.Echo L_Help_HELP_Delete11_Text WScript.Echo L_Help_HELP_Delete12_Text WScript.Echo L_Help_HELP_Delete13_Text WScript.Echo L_Help_HELP_Delete14_Text End Sub Sub DisplayCreateHelpMessage() WScript.Echo L_Help_HELP_Create01_Text WScript.Echo WScript.Echo L_Help_HELP_Create02_Text WScript.Echo L_Help_HELP_Create02p1_Text WScript.Echo L_Help_HELP_Create02p2_Text WScript.Echo WScript.Echo L_Help_HELP_Status03_Text WScript.Echo WScript.Echo L_Help_HELP_General06_Text WScript.Echo L_Help_HELP_General07_Text WScript.Echo L_Help_HELP_General07a_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_Create09_Text WScript.Echo L_Help_HELP_Create09p1_Text WScript.Echo L_Help_HELP_Create09p2_Text WScript.Echo L_Help_HELP_Create10_Text WScript.Echo L_Help_HELP_Create10p1_Text WScript.Echo L_Help_HELP_Create11_Text WScript.Echo L_Help_HELP_Create11p1_Text WScript.Echo L_Help_HELP_Create11p2_Text WScript.Echo L_Help_HELP_Create12_Text WScript.Echo L_Help_HELP_Create12p1_Text WScript.Echo L_Help_HELP_Create13_Text WScript.Echo L_Help_HELP_Create13p1_Text WScript.Echo L_Help_HELP_Create15_Text WScript.Echo WScript.Echo L_Help_HELP_Status10_Text WScript.Echo WScript.Echo L_Help_HELP_Create22_Text WScript.Echo L_Help_HELP_Create23_Text WScript.Echo L_Help_HELP_Create23p1_Text WScript.Echo L_Help_HELP_Create24_Text WScript.Echo L_Help_HELP_Create24p1_Text End Sub Sub DisplayQueryHelpMessage() WScript.Echo L_Help_HELP_Query01_Text WScript.Echo WScript.Echo L_Help_HELP_Query02_Text WScript.Echo L_Help_HELP_Query02p1_Text WScript.Echo WScript.Echo L_Help_HELP_Status03_Text WScript.Echo WScript.Echo L_Help_HELP_General06_Text WScript.Echo L_Help_HELP_General07_Text WScript.Echo L_Help_HELP_General07a_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_Status09_Text WScript.Echo L_Help_HELP_Status09p1_Text WScript.Echo WScript.Echo WScript.Echo L_Help_HELP_Status10_Text WScript.Echo WScript.Echo L_Help_HELP_Query11_Text WScript.Echo L_Help_HELP_Query12_Text WScript.Echo L_Help_HELP_Query13_Text WScript.Echo L_Help_HELP_Query14_Text WScript.Echo L_Help_HELP_Query15_Text End Sub ''''''''''''''''''''''''''' ' ChangeWebSiteStatus ' ' Try to change the status of a site ' to the one specified ''''''''''''''''''''''''''' Function ChangeWebSiteStatus(aArgs, newStatus) Dim Server, strSiteName Dim intResult, i, intNewStatus Dim aSites Dim providerObj, ServiceObj Dim bNonFatalError On Error Resume Next bNonFatalError = False oScriptHelper.WMIConnect If Err.Number Then WScript.Echo L_WMIConnect_ErrorMessage oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) ChangeWebSiteStatus = Err.Number Exit Function End If Set providerObj = oScriptHelper.ProviderObj intResult = 0 ' Quick check to see if we have permission Set ServiceObj = providerObj.Get("IIsWebService='W3SVC'") If Err.Number Then Select Case Err.Number Case &H80070005 WScript.Echo L_Admin_ErrorMessage WScript.Echo L_Admin2_ErrorMessage Case Else WScript.Echo Err.Description End Select ChangeWebSiteStatus = Err.Number Exit Function End If aSites = oScriptHelper.FindSite("Web", aArgs) If IsArray(aSites) Then If UBound(aSites) = -1 Then WScript.Echo L_SitesNotFound_ErrorMessage intResult = ERR_GENERAL_FAILURE End If Else ' Got duplicate sites. We should quit. ChangeWebSiteStatus = intResult Exit Function End If For i = LBound(aSites) to UBound(aSites) strSiteName = aSites(i) bNonFatalError = False ' Grab site state before trying to start it Set Server = providerObj.Get("IIsWebServer='" & strSiteName & "'") If (Err.Number <> 0) Then WScript.Echo L_GetWebServer_ErrorMessage oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) intResult = Err.Number End If If (Server.ServerState = newStatus) Then oCmdLib.vbPrintf L_IsAlready_Message, Array(strSiteName, UCase(SiteStatus(newStatus))) Else If (Server.ServerState = SERVER_STARTING or Server.ServerState = SERVER_STOPPING or _ Server.ServerState = SERVER_PAUSING or Server.ServerState = SERVER_CONTINUING) Then WScript.Echo L_CannotControl_ErrorMessage intResult = ERR_GENERAL_FAILURE Else Select Case newStatus Case SERVER_STARTED If (Server.ServerState = SERVER_STOPPED) Then intNewStatus = SERVER_STARTED Server.Start Else If (Server.ServerState = SERVER_PAUSED) Then intNewStatus = SERVER_CONTINUING Server.Continue Else oCmdLib.vbPrintf L_CannotStart_Message, Array(strSiteName) oCmdLib.vbPrintf L_CannotStart2_Message, Array(strSiteName, SiteStatus(Server.ServerState)) bNonFatalError = True End If End If Case SERVER_STOPPED If (Server.ServerState = SERVER_STARTED) Then intNewStatus = SERVER_STOPPED Server.Stop Else oCmdLib.vbPrintf L_CannotStop_Message, Array(strSiteName) oCmdLib.vbPrintf L_CannotStop2_Message, Array(strSiteName, SiteStatus(Server.ServerState)) bNonFatalError = True End If Case SERVER_PAUSED If (Server.ServerState = SERVER_STARTED) Then intNewStatus = SERVER_PAUSED Server.Pause Else oCmdLib.vbPrintf L_CannotPause_Message, Array(strSiteName) oCmdLib.vbPrintf L_CannotPause2_Message, Array(strSiteName, SiteStatus(Server.ServerState)) bNonFatalError = True End If Case Else WScript.Echo L_UnexpectedState_ErrorMessage WScript.Quit(ERR_GENERAL_FAILURE) End Select ' Error checking If (Err.Number <> 0) Then oCmdLib.vbPrintf L_FailChange_ErrorMessage, Array(strSite) oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) intResult = Err.Number Else If (bNonFatalError = False) Then oCmdLib.vbPrintf L_HasBeen_Message, Array(strSiteName, UCase(SiteStatus(intNewStatus))) End If End If End If End If Next Set Server = Nothing ChangeWebSiteStatus = intResult End Function ''''''''''''''''''''''''''' ' DeleteWebSite ''''''''''''''''''''''''''' Function DeleteWebSite(aArgs) Dim strSiteName Dim RootVDirObj, WebServerObj Dim aSites Dim providerObj, ServiceObj On Error Resume Next oScriptHelper.WMIConnect If Err.Number Then WScript.Echo L_WMIConnect_ErrorMessage oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) DeleteWebSite = Err.Number Exit Function End If Set providerObj = oScriptHelper.ProviderObj ' Quick check to see if we have permission Set ServiceObj = providerObj.Get("IIsWebService='W3SVC'") If Err.Number Then Select Case Err.Number Case &H80070005 WScript.Echo L_Admin_ErrorMessage WScript.Echo L_Admin2_ErrorMessage Case Else WScript.Echo Err.Description End Select DeleteWebSite = Err.Number Exit Function End If aSites = oScriptHelper.FindSite("Web", aArgs) If IsArray(aSites) Then If UBound(aSites) = -1 Then WScript.Echo L_SitesNotFound_ErrorMessage intResult = ERR_GENERAL_FAILURE End If Else ' Got duplicate sites. We should quit. ChangeWebSiteStatus = intResult Exit Function End If For Each strSiteName in aSites ' First delete application in this site Set RootVDirObj = providerObj.Get("IIsWebVirtualDir='" & strSiteName & "/ROOT'") If (Err.Number <> 0) Then oCmdLib.vbPrintf L_GetRoot_ErrorMessage, Array(strSiteName) oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) DeleteWebSite = Err.Number Exit Function End If RootVDirObj.AppDelete(True) If (Err.Number <> 0) Then oCmdLib.vbPrintf L_RecursiveDel_ErrorMessage, Array(strSiteName) oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) DeleteWebSite = Err.Number Exit Function End If ' Next, stop and delete the web site itself Set WebServerObj = providerObj.Get("IIsWebServer='" & strSiteName & "'") If (Err.Number <> 0) Then oCmdLib.vbPrintf L_SiteGet_ErrorMessage, Array(strSiteName) oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) DeleteWebSite = Err.Number Exit Function End If WebServerObj.Stop If (Err.Number <> 0) Then oCmdLib.vbPrintf L_Stop_ErrorMessage, Array(strSiteName) oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) DeleteWebSite = Err.Number Exit Function End If WebServerObj.Delete_ If (Err.Number <> 0) Then oCmdLib.vbPrintf L_SiteDel_ErrorMessage, Array(strSiteName) oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) DeleteWebSite = Err.Number Exit Function End If oCmdLib.vbPrintf L_HasBeen_Message, Array(strSiteName, L_Deleted_Text) Next DeleteWebSite = ERR_OK End Function ''''''''''''''''''''''''''' ' CreateWebSite ''''''''''''''''''''''''''' Function CreateWebSite(strRoot, strName, strHost, strPort, strIP, bDontStart) Dim strSitePath Dim strSiteObjPath Dim Bindings Dim objPath, serviceObj Dim serverObj, vdirObj Dim strStatus Dim providerObj On Error Resume Next ' Default port If (strPort = "") Then strPort = "80" ' Verify port number If Not oScriptHelper.IsValidPortNumber(strPort) Then WScript.Echo L_InvalidPort_ErrorMessage CreateWebSite = ERR_GENERAL_FAILURE Exit Function End If ' Verify IP Address If strIP <> "" Then If Not oScriptHelper.IsValidIPAddress(strIP) Then WScript.Echo L_InvalidIP_ErrorMessage WScript.Echo L_InvalidIP2_ErrorMessage CreateWebSite = ERR_GENERAL_FAILURE Exit Function End If End If ' Create physical directory oScriptHelper.CreateFSDir strRoot If Err.Number Then Select Case Err.Number Case &H8007000C WScript.Echo L_DirFormat_ErrorMessage WScript.Echo L_DirFormat2_ErrorMessage WScript.Echo L_SeeCreateHelp_Message CreateWebSite = Err.Number Exit Function Case &H8007000F WScript.Echo L_MapDrive_ErrorMessage CreateWebSite = Err.Number Exit Function Case Else WScript.Echo L_CannotCreateDir_ErrorMessage oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) CreateWebSite = Err.Number Exit Function End Select End If ' Time to connect to the IIS namespace oScriptHelper.WMIConnect If Err.Number Then WScript.Echo L_WMIConnect_ErrorMessage oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) CreateWebSite = Err.Number Exit Function End If Set providerObj = oScriptHelper.ProviderObj ' Build binding object Bindings = Array(0) Set Bindings(0) = providerObj.get("ServerBinding").SpawnInstance_() Bindings(0).IP = strIP Bindings(0).Port = strPort Bindings(0).Hostname = strHost Set serviceObj = providerObj.Get("IIsWebService='W3SVC'") If Err.Number Then Select Case Err.Number Case &H80070005 WScript.Echo L_Admin_ErrorMessage WScript.Echo L_Admin2_ErrorMessage Case Else WScript.Echo Err.Description End Select CreateWebSite = Err.Number Exit Function End If strSiteObjPath = serviceObj.CreateNewSite(strName, Bindings, strRoot) If Err Then oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) CreateWebSite = Err.Number Exit Function End If ' Parse site ID out of WMI object path Set objPath = CreateObject("WbemScripting.SWbemObjectPath") objPath.Path = strSiteObjPath strSitePath = objPath.Keys.Item("") ' Set web virtual directory properties Set vdirObj = providerObj.Get("IIsWebVirtualDirSetting='" & strSitePath & "/ROOT'") vdirObj.AuthFlags = 5 ' AuthNTLM + AuthAnonymous vdirObj.EnableDefaultDoc = True vdirObj.DirBrowseFlags = &H4000003E ' date, time, size, extension, longdate vdirObj.AccessFlags = 513 ' read, script vdirObj.Put_() If Err Then WScript.Echo L_VDirPut_ErrorMessage oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) providerObj.Delete(strSiteObjPath) CreateWebSite = Err.Number Exit Function End If ' Site should be stopped - CreateNewSite stops it by default Set serverObj = providerObj.Get("IIsWebServer='" & strSitePath & "'") ' Should we start the site? If Not bDontStart Then serverObj.Start ' If we cannot start the server, check for error stating the port is already in use If Err.Number = &H80070034 Or Err.Number = &H80070020 Then strStatus = UCase(SiteStatus(4)) & " " & L_BindingConflict_ErrorMessage Else strStatus = UCase(SiteStatus(2)) End If Else strStatus = UCase(SiteStatus(4)) End If If (strServer = ".") Then strServer = oScriptHelper.GetEnvironmentVar("%COMPUTERNAME%") End If If (strIP = "") Then strIP = L_AllUnassigned_Text If (strHost = "") Then strHost = L_NotSpecified_Text ' Post summary WScript.Echo L_Server_Text & Space(14 - Len(L_Server_Text)) & "= " & UCase(strServer) WScript.Echo L_SiteName_Text & Space(14 - Len(L_SiteName_Text)) & "= " & strName WScript.Echo L_MetabasePath_Message & Space(14 - Len(L_MetabasePath_Message)) & "= " & strSitePath WScript.Echo L_IP_Text & Space(14 - Len(L_IP_Text)) & "= " & strIP WScript.Echo L_Host_Text & Space(14 - Len(L_Host_Text)) & "= " & strHost WScript.Echo L_Port_Text & Space(14 - Len(L_Port_Text)) & "= " & strPort WScript.Echo L_Root_Text & Space(14 - Len(L_Root_Text)) & "= " & strRoot WScript.Echo L_Status_Text& Space(14 - Len(L_Status_Text)) & "= " & strStatus CreateWebSite = intResult End Function ''''''''''''''''''''''''''' ' QueryWebSite ''''''''''''''''''''''''''' Function QueryWebSite(aArgs) Dim Servers, Server, strQuery Dim ServerObj, ServiceObj Dim i, intResult, firstLen, secLen, thirdLen, fourthLen Dim bindings, binding Dim line, strIP, strPort, strHost, strState Dim providerObj Dim bFirstIteration On Error Resume Next oScriptHelper.WMIConnect If Err.Number Then WScript.Echo L_WMIConnect_ErrorMessage oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) QueryWebSiteStatus = Err.Number Exit Function End If Set providerObj = oScriptHelper.ProviderObj intResult = 0 ' Quick check to see if we have permission Set ServiceObj = providerObj.Get("IIsWebService='W3SVC'") If Err.Number Then Select Case Err.Number Case &H80070005 WScript.Echo L_Admin_ErrorMessage WScript.Echo L_Admin2_ErrorMessage Case Else WScript.Echo Err.Description End Select QueryWebSite = Err.Number Exit Function End If If (UBound(aArgs) = -1) Then strQuery = "select Name, ServerComment, ServerBindings from IIsWebServerSetting" Else strQuery = "select Name, ServerComment, ServerBindings from IIsWebServerSetting where " For i = LBound(aArgs) to UBound(aArgs) strQuery = strQuery & "(Name='" & aArgs(i) & "' or ServerComment='" & aArgs(i) & "')" If (i <> UBound(aArgs)) Then strQuery = strQuery & " or " End If Next End If ' Semi-sync query. (flags = ForwardOnly Or ReturnImediately = &H30) Set Servers = providerObj.ExecQuery(strQuery, , &H30) If (Err.Number <> 0) Then WScript.Echo L_Query_ErrorMessage oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description) WScript.Quit(Err.Number) End If bFirstIteration = True For Each Server in Servers bindings = Server.ServerBindings If bFirstIteration Then WScript.Echo L_SiteName_Text & " (" & L_MetabasePath_Message & ")" & _ Space(40 - Len(L_SiteName_Text & L_MetabasePath_Message) + 3) & _ L_Status_Text & Space(2) & L_IP_Text & Space(14) & L_Port_Text & Space(2) & L_Host_Text WScript.Echo "==============================================================================" End If ' Get server status from the element instance Set ServerObj = providerObj.Get("IIsWebServer='" & Server.Name & "'") strState = UCase(SiteStatus(ServerObj.ServerState)) If (IsArray(bindings)) Then For i = LBound(bindings) to UBound(bindings) If (bindings(i).IP = "") Then strIP = L_All_Text Else strIP = bindings(i).IP End If strPort = bindings(i).Port If (bindings(i).Hostname = "") Then strHost = L_NA_Text Else strHost = bindings(i).Hostname End If ' If this is the first binding list, print server comment and server name If (i = LBound(bindings)) Then firstLen = 40 - Len(Server.ServerComment & Server.Name) + 3 secLen = 8 - Len(strState) thirdLen = 16 - Len(strIP) fourthLen = 6 - Len(strPort) If (firstLen < 1) Then firstLen = 1 End If If (secLen < 1) Then secLen = 1 End If If (thirdLen < 1) Then thirdLen = 1 End If If (fourthLen < 1) Then fourthLen = 1 End If line = Server.ServerComment & " (" & Server.Name & ")" & _ Space(firstLen) & strState & _ Space(secLen) & strIP & Space(thirdLen) & strPort & _ Space(fourthLen) & strHost Else line = Space(54) & strIP & Space(thirdLen) & strPort & Space(fourthLen) & strHost End If WScript.Echo line Next End If bFirstIteration = False Next If bFirstIteration Then WScript.Echo L_SitesNotFound_ErrorMessage End If End Function
i=0 On Error Resume Next i = 2147483647 + 1 Debug.Print i 'i=0
Debug.Print Environ$("PATH")
Function gcd(u As Long, v As Long) As Long Dim t As Long Do While v t = u u = v v = t Mod v Loop gcd = u End Function
Private Function narcissistic(n As Long) As Boolean Dim d As String: d = CStr(n) Dim l As Integer: l = Len(d) Dim sumn As Long: sumn = 0 For i = 1 To l sumn = sumn + (Mid(d, i, 1) - "0") ^ l Next i narcissistic = sumn = n End Function Public Sub main() Dim s(24) As String Dim n As Long: n = 0 Dim found As Integer: found = 0 Do While found < 25 If narcissistic(n) Then s(found) = CStr(n) found = found + 1 End If n = n + 1 Loop Debug.Print Join(s, ", ") End Sub
on error resume next set locator=CreateObject("WbemScripting.SWbemLocatorEx") set conn=locator.Open("umi://nw01t1/LDAP","nw01t1domnb\administrator", "nw01t1domnb") set ou = conn.Get (".OU=ajaytest") WScript.Echo "Name:", ou.Name WScript.Echo "Class:", ou.Class WScript.Echo "GUID:", ou.GUID WScript.Echo "ADSPath:", ou.ADSPath WScript.Echo "Parent:", ou.Parent WScript.Echo "Schema:", ou.Schema WScript.Echo "Description:", ou.Description(0) WScript.Echo "LocalityName:", ou.LocalityName WScript.Echo "PostalAddress:", ou.PostalAddress WScript.Echo "TelephoneNumber:", ou.TelephoneNumber WScript.Echo "FaxNumber:", ou.FaxNumber WScript.Echo "SeeAlso:", ou.SeeAlso WScript.Echo "BusinessCategory:", ou.BusinessCategory
<gh_stars>1-10 Private Function roman(n As Integer) As String roman = WorksheetFunction.roman(n) End Function Public Sub main() s = [{10, 2016, 800, 2769, 1666, 476, 1453}] For Each x In s Debug.Print roman(CInt(x)); " "; Next x End Sub
<filename>admin/wmi/wbem/scripting/test/whistler/directory/simpleopen.vbs set conn = GetObject("umi:///winnt/computer=alanbos4") WScript.Echo typename(conn) Out "Starting..." Set oLoc = CreateObject("WbemScripting.SWbemLocatorEx") Out "Created LocatorEx" Set oSvc = oLoc.Open("umi://nw01t1/ldap", "nw01t1domnb\administrator", "nw01t1domnb") Out "Bound to umi://nw01t1/ldap" Set oObj = oSvc.Get(".ou=VB_UMI_Test") Out "Got Object " & oObj.Path_ sName = "organizationalUnit.ou=Test" & CLng((now()-Int(now()))*24*60*60) Set oChild = oObj.CreateInstance_(sName) oChild.Put_ Out "Created " & oChild.Path_ Sub Out(sLine) WScript.Echo sLine End Sub
<gh_stars>10-100 On Error Resume Next For Each Service in GetObject("winmgmts:{impersonationLevel=Impersonate}").ExecQuery _ ("Associators of {Win32_service.Name=""NetDDE""} Where AssocClass=Win32_DependentService Role=Dependent" ) WScript.Echo Service.Path_.DisplayName Next if Err <> 0 Then WScript.Echo Err.Number, Err.Description, Err.Source End if
<filename>Task/Empty-string/VBA/empty-string.vba dim s as string ' assign an empty string to a variable: s = "" ' test if a string is empty: if s = "" then Debug.Print "empty!" ' or: if Len(s) = 0 then Debug.Print "still empty!" 'test if a string is not empty: if s <> "" then Debug.Print "not an empty string" 'or: if Len(s) > 0 then Debug.Print "not empty."
Set Nvram = CreateObject("sacom.sanvram") BootCounter = Nvram.BootCounter(3)
<reponame>LaudateCorpus1/RosettaCodeData Sub ReplaceInString() Dim A$, B As String, C$ A = "<NAME>" B = Chr(108) ' "l" C = " " Debug.Print Replace(A, B, C) 'return : He o wor d End Sub
<filename>admin/wmi/wbem/scripting/test/vbscript/stress/putinstance.vbs On Error Resume Next while true Set S = GetObject("winmgmts:root/default") Set C = S.Get C.Path_.Class = "PUTCLASSTEST00" Set P = C.Properties_.Add ("p", 19) P.Qualifiers_.Add "key", true C.Put_ Set C = GetObject("winmgmts:root/default:PUTCLASSTEST00") Set I = C.SpawnInstance_ WScript.Echo "Relpath of new instance is", I.Path_.Relpath I.Properties_("p") = 11 WScript.Echo "Relpath of new instance is", I.Path_.Relpath Set NewPath = I.Put_ WScript.Echo "path of new instance is", NewPath.path If Err <> 0 Then WScript.Echo Err.Number, Err.Description Err.Clear End If wend
<gh_stars>10-100 ' The following sample retrieves the FreeSpace property for all ' instances of the class Win32_LogicalDisk. Set objServices = GetObject("cim:root/cimv2") Set objEnum = objServices.ExecQuery ("select FreeSpace from Win32_LogicalDisk") for each Instance in objEnum WScript.Echo Instance.Path_.DisplayName next
Option Explicit Sub Main() Dim evens() As Long, i As Long Dim numbers() As Long For i = 1 To 100000 ReDim Preserve numbers(1 To i) numbers(i) = i Next i evens = FilterInNewArray(numbers) Debug.Print "Count of initial array : " & UBound(numbers) & ", first item : " & numbers(LBound(numbers)) & ", last item : " & numbers(UBound(numbers)) Debug.Print "Count of new array : " & UBound(evens) & ", first item : " & evens(LBound(evens)) & ", last item : " & evens(UBound(evens)) FilterInPlace numbers Debug.Print "Count of initial array (filtered): " & UBound(numbers) & ", first item : " & numbers(LBound(numbers)) & ", last item : " & numbers(UBound(numbers)) End Sub Private Function FilterInNewArray(arr() As Long) As Long() Dim i As Long, t() As Long, cpt As Long For i = LBound(arr) To UBound(arr) If IsEven(arr(i)) Then cpt = cpt + 1 ReDim Preserve t(1 To cpt) t(cpt) = i End If Next i FilterInNewArray = t End Function Private Sub FilterInPlace(arr() As Long) Dim i As Long, cpt As Long For i = LBound(arr) To UBound(arr) If IsEven(arr(i)) Then cpt = cpt + 1 arr(cpt) = i End If Next i ReDim Preserve arr(1 To cpt) End Sub Private Function IsEven(Number As Long) As Boolean IsEven = (CLng(Right(CStr(Number), 1)) And 1) = 0 End Function
Attribute VB_Name = "entry" Public Const szNAME As String = "Certificate Services VB Exit" Public Const szDESCRIPTION As String = "VB Exit Module (Sample)" Sub main() End Sub
Sub Append_to_string() Dim A As String A = "<NAME>" Debug.Print A & Chr(100) 'return : Hello world End Sub
<filename>Task/Zig-zag-matrix/VBA/zig-zag-matrix.vba<gh_stars>1-10 Public Sub zigzag(n) Dim a() As Integer 'populate a (1,1) to a(n,n) in zigzag pattern 'check if n too small If n < 1 Then Debug.Print "zigzag: enter a number greater than 1" Exit Sub End If 'initialize ReDim a(1 To n, 1 To n) i = 1 'i is the row j = 1 'j is the column P = 0 'P is the next number a(i, j) = P 'fill in initial value 'now zigzag through the matrix and fill it in Do While (i <= n) And (j <= n) 'move one position to the right or down the rightmost column, if possible If j < n Then j = j + 1 ElseIf i < n Then i = i + 1 Else Exit Do End If 'fill in P = P + 1: a(i, j) = P 'move down to the left While (j > 1) And (i < n) i = i + 1: j = j - 1 P = P + 1: a(i, j) = P Wend 'move one position down or to the right in the bottom row, if possible If i < n Then i = i + 1 ElseIf j < n Then j = j + 1 Else Exit Do End If P = P + 1: a(i, j) = P 'move back up to the right While (i > 1) And (j < n) i = i - 1: j = j + 1 P = P + 1: a(i, j) = P Wend Loop 'print result Debug.Print "Result for n="; n; ":" For i = 1 To n For j = 1 To n Debug.Print a(i, j), Next Debug.Print Next End Sub
<reponame>LaudateCorpus1/RosettaCodeData dim s s = createobject("scripting.filesystemobject").opentextfile("slurp.vbs",1).readall wscript.echo s
Option Explicit sub verifydistribution(calledfunction, samples, delta) Dim i, n, maxdiff 'We could cheat via Dim d(7), but "7" wasn't mentioned in the Task. Heh. Dim d : Set d = CreateObject("Scripting.Dictionary") wscript.echo "Running """ & calledfunction & """ " & samples & " times..." for i = 1 to samples Execute "n = " & calledfunction d(n) = d(n) + 1 next n = d.Count maxdiff = 0 wscript.echo "Expected average count is " & Int(samples/n) & " across " & n & " buckets." for each i in d.Keys dim diff : diff = abs(1 - d(i) / (samples/n)) if diff > maxdiff then maxdiff = diff wscript.echo "Bucket " & i & " had " & d(i) & " occurences" _ & vbTab & " difference from expected=" & FormatPercent(diff, 2) next wscript.echo "Maximum found variation is " & FormatPercent(maxdiff, 2) _ & ", desired limit is " & FormatPercent(delta, 2) & "." if maxdiff > delta then wscript.echo "Skewed!" else wscript.echo "Smooth!" end sub
<filename>vb6/examples/pr578.vb VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "ConstDirective" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Const EvalDirective = 0 Public Function EvalConstDirective() As Long #If EvalDirective Then EvalConstDirective = 1 #Else EvalConstDirective = 0 #End If End Function
<reponame>LaudateCorpus1/RosettaCodeData Option Explicit Dim total As Long, prim As Long, maxPeri As Long Public Sub NewTri(ByVal s0 As Long, ByVal s1 As Long, ByVal s2 As Long) Dim p As Long, x1 As Long, x2 As Long p = s0 + s1 + s2 If p <= maxPeri Then prim = prim + 1 total = total + maxPeri \ p x1 = s0 + s2 x2 = s1 + s2 NewTri s0 + 2 * (-s1 + s2), 2 * x1 - s1, 2 * (x1 - s1) + s2 NewTri s0 + 2 * x2, 2 * x1 + s1, 2 * (x1 + s1) + s2 NewTri -s0 + 2 * x2, 2 * (-s0 + s2) + s1, 2 * (-s0 + x2) + s2 End If End Sub Public Sub Main() maxPeri = 100 Do While maxPeri <= 10& ^ 8 prim = 0 total = 0 NewTri 3, 4, 5 Debug.Print "Up to "; maxPeri; ": "; total; " triples, "; prim; " primitives." maxPeri = maxPeri * 10 Loop End Sub
<reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Sorting-algorithms-Gnome-sort/VBA/sorting-algorithms-gnome-sort.vba Private Function gnomeSort(s As Variant) As Variant Dim i As Integer: i = 1 Dim j As Integer: j = 2 Dim tmp As Integer Do While i < UBound(s) If s(i) <= s(i + 1) Then i = j j = j + 1 Else tmp = s(i) s(i) = s(i + 1) s(i + 1) = tmp i = i - 1 If i = 0 Then i = j j = j + 1 End If End If Loop gnomeSort = s End Function Public Sub main() Debug.Print Join(gnomeSort([{5, 3, 1, 7, 4, 1, 1, 20}]), ", ") End Sub
<gh_stars>1-10 Option Explicit Const olMailItem = 0 Sub SendMail(MsgTo As String, MsgTitle As String, MsgBody As String) Dim OutlookApp As Object, Msg As Object Set OutlookApp = CreateObject("Outlook.Application") Set Msg = OutlookApp.CreateItem(olMailItem) With Msg .To = MsgTo .Subject = MsgTitle .Body = MsgBody .Send End With Set OutlookApp = Nothing End Sub Sub Test() SendMail "somebody@some<EMAIL>", "Title", "Hello" End Sub
' Gaussian elimination - VBScript const n=6 dim a(6,6),b(6),x(6),ab ab=array( 1 , 0 , 0 , 0 , 0 , 0 , -0.01, _ 1 , 0.63, 0.39, 0.25, 0.16, 0.10, 0.61, _ 1 , 1.26, 1.58, 1.98, 2.49, 3.13, 0.91, _ 1 , 1.88, 3.55, 6.70, 12.62, 23.80, 0.99, _ 1 , 2.51, 6.32, 15.88, 39.90, 100.28, 0.60, _ 1 , 3.14, 9.87, 31.01, 97.41, 306.02, 0.02) k=-1 for i=1 to n buf="" for j=1 to n+1 k=k+1 if j<=n then a(i,j)=ab(k) else b(i)=ab(k) end if buf=buf&right(space(8)&formatnumber(ab(k),2),8)&" " next wscript.echo buf next for j=1 to n for i=j+1 to n w=a(j,j)/a(i,j) for k=j+1 to n a(i,k)=a(j,k)-w*a(i,k) next b(i)=b(j)-w*b(i) next next x(n)=b(n)/a(n,n) for j=n-1 to 1 step -1 w=0 for i=j+1 to n w=w+a(j,i)*x(i) next x(j)=(b(j)-w)/a(j,j) next wscript.echo "solution" buf="" for i=1 to n buf=buf&right(space(8)&formatnumber(x(i),2),8)&vbcrlf next wscript.echo buf
Option Explicit Sub Main_File_Exists() Dim myFile As String, myDirectory As String myFile = "Abdu'l-Bahá.txt" myDirectory = "C:\" Debug.Print File_Exists(myFile, myDirectory) End Sub Function File_Exists(F As String, D As String) As Boolean If F = "" Then File_Exists = False Else D = IIf(Right(D, 1) = "\", D, D & "\") File_Exists = (Dir(D & F) <> "") End If End Function
Pascal_Triangle(WScript.Arguments(0)) Function Pascal_Triangle(n) Dim values(100) values(1) = 1 WScript.StdOut.Write values(1) WScript.StdOut.WriteLine For row = 2 To n For i = row To 1 Step -1 values(i) = values(i) + values(i-1) WScript.StdOut.Write values(i) & " " Next WScript.StdOut.WriteLine Next End Function
VERSION 5.00 Begin VB.Form CheckOptionsForm BorderStyle = 3 'Fixed Dialog Caption = "Check Options" ClientHeight = 2340 ClientLeft = 45 ClientTop = 330 ClientWidth = 4350 Icon = "ChkOptn.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2340 ScaleWidth = 4350 ShowInTaskbar = 0 'False StartUpPosition = 3 'Windows Default Begin VB.TextBox MaxNumErrorsText Height = 285 Left = 1920 TabIndex = 9 Top = 1320 Width = 1335 End Begin VB.TextBox MaxPropSizeText Height = 285 Left = 1920 TabIndex = 7 Top = 840 Width = 1335 End Begin VB.TextBox MaxKeySizeText Height = 285 Left = 1920 TabIndex = 2 Top = 360 Width = 1335 End Begin VB.CommandButton CancelButton Caption = "Cancel" Height = 345 Left = 3000 TabIndex = 1 Top = 1920 Width = 1260 End Begin VB.CommandButton OkButton Cancel = -1 'True Caption = "OK" Default = -1 'True Height = 345 Left = 1560 TabIndex = 0 Top = 1920 Width = 1260 End Begin VB.Label Label6 Caption = "per key" Height = 255 Left = 3360 TabIndex = 10 Top = 1320 Width = 855 End Begin VB.Label Label5 Caption = "bytes" Height = 255 Left = 3360 TabIndex = 8 Top = 840 Width = 855 End Begin VB.Label Label4 Caption = "bytes" Height = 255 Left = 3360 TabIndex = 6 Top = 360 Width = 855 End Begin VB.Label Label3 Caption = "Max Num. Errors:" Height = 255 Left = 120 TabIndex = 5 Top = 1320 Width = 1695 End Begin VB.Label Label2 Caption = "Max Property Size:" Height = 255 Left = 120 TabIndex = 4 Top = 840 Width = 1695 End Begin VB.Label Label1 Caption = "Max Key Size:" Height = 255 Left = 120 TabIndex = 3 Top = 360 Width = 1695 End End Attribute VB_Name = "CheckOptionsForm" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit DefInt A-Z Private Sub Form_Load() MainForm.MetaUtilObj.Config("MaxKeySize") = Config.MaxKeySize MainForm.MetaUtilObj.Config("MaxPropertySize") = Config.MaxPropSize MainForm.MetaUtilObj.Config("MaxNumberOfErrors") = Config.MaxNumErrors End Sub Public Sub Init() MaxKeySizeText.Text = CStr(MainForm.MetaUtilObj.Config("MaxKeySize")) MaxPropSizeText.Text = CStr(MainForm.MetaUtilObj.Config("MaxPropertySize")) MaxNumErrorsText.Text = CStr(MainForm.MetaUtilObj.Config("MaxNumberOfErrors")) End Sub Private Sub OkButton_Click() Config.MaxKeySize = CLng(MaxKeySizeText.Text) Config.MaxPropSize = CLng(MaxPropSizeText.Text) Config.MaxNumErrors = CLng(MaxNumErrorsText.Text) MainForm.MetaUtilObj.Config("MaxKeySize") = CLng(MaxKeySizeText.Text) MainForm.MetaUtilObj.Config("MaxPropertySize") = CLng(MaxPropSizeText.Text) MainForm.MetaUtilObj.Config("MaxNumberOfErrors") = CLng(MaxNumErrorsText.Text) Me.Hide End Sub Private Sub CancelButton_Click() Me.Hide End Sub
VERSION 5.00 Begin VB.Form frmObjText Caption = "Loading..." ClientHeight = 7695 ClientLeft = 3270 ClientTop = 2475 ClientWidth = 11265 Icon = "frmObjText.frx":0000 LinkTopic = "Form1" ScaleHeight = 7695 ScaleWidth = 11265 Begin VB.TextBox txtMain BeginProperty Font Name = "Courier New" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 2055 Left = 120 Locked = -1 'True MultiLine = -1 'True ScrollBars = 3 'Both TabIndex = 0 Top = 120 Width = 4155 End End Attribute VB_Name = "frmObjText" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub Form_Resize() If Me.WindowState <> 1 Then txtMain.Move Me.ScaleLeft, Me.ScaleTop, Me.ScaleWidth, Me.ScaleHeight End If End Sub
<gh_stars>1-10 WScript.Echo 0 ^ 0
OPTION EXPLICIT '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----Windows Script Host script to generate components needed to run WSH '-----under Windows PE. '-----Copyright 2001, Microsoft Corporation '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----DIM, DEFINE VARIABLES, SET SOME GLOBAL OBJECTS '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' DIM strCmdArg, strCmdSwitch, arg, strCmdArray, CDDriveCollection, CDDrive, CDSource, FSO, Folder, HDDColl DIM HDD, FirstHDD, strAppend, WSHShell, strDesktop, strOptDest, strDestFolder DIM FILE, strCMDExpand, strCMDMid, strJobTitle, strNeedCD, iAmPlatform, iArchDir DIM iAmQuiet,iHaveSource, iHaveDest, iWillBrowse, WshSysEnv, strOSVer, strWantToView, strFolderName, intOneMore DIM strCMDado, strCMDmsadc, strCMDOle_db, strIDir, strSysDir Const ForAppending = 8 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----OFFER/TAKE CMDLINE PARAMETERS '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 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" THEN iHaveSource = 1 CDSource = TRIM(strCmdArray(1)) END IF IF lcase(strCmdArray(0)) = "/d" or lcase(strCmdArray(0)) = "-d" THEN iHaveDest = 1 strOptDest = 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&_ "/S:C:\"&vbCRLF&_ "-s:Z:\"&vbCRLF&_ "or"&vbCRLF&_ "-S:\\Myserver\Myshare"&vbCRLF&vbCRLF&_ "The script will still attempt to verify the presence of Windows XP files."&vbCrLF&vbCrLF&_ "/D - Destination. Opposite of CD - specifies build destination. Otherwise placed on desktop."&vbCRLF&vbCRLF&_ "/64 - build for Itanium. Generates scripts for Windows on the Itanium Processor Family."&vbCRLF&vbCRLF&_ "/Q - run without any dialog. This will not confirm success, will notify on failure."&vbCRLF&vbCRLF&_ "/E - explore completed files. Navigate to the created files when completed.", 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 Next ELSE iHaveSource = 0 END IF IF strOptDest = "" THEN iHaveDest = 0 ELSEIF INSTR(UCASE(strOptDest), "I386\") <> 0 OR INSTR(UCASE(strOptDest), "IA64\") <> 0 OR INSTR(UCASE(strOptDest), "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 ""I386"" or ""System32""", vbCritical, "Destination Path Incorrect" WScript.Quit END IF IF iAmQuiet <> 1 THEN iAmQuiet = 0 END IF IF iAmPlatform <> "Itanium" THEN iAmPlatform = "x86" END IF IF Right(strOptDest, 1) = "\" THEN strOptDest = Left(strOptDest, LEN(strOptDest)-1) END IF IF Right(CDSource, 1) = "\" THEN CDSource = Left(CDSource, LEN(CDSource)-1) END IF IF iAmPlatform = "Itanium" THEN iArchDir = "ia64" ELSEIF iAmPlatform = "x86" THEN iArchDir = "i386" END IF strJobTitle = "WSH 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 2000 OR HIGHER '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' strOSVer = WshSysEnv("OS") IF strOSVer <> "Windows_NT" THEN MsgBox "This script must be run on Windows 2000 or Windows XP", vbCritical, "Incorrect Windows Version" 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 <= 0 THEN MsgBox "No CD-ROM drives found. Exiting Script.", vbCritical, "No CD-ROM drive found" WScript.Quit END IF FOR EACH CDDrive IN CDDriveCollection CDSource = CDDrive.Drive(0) EXIT FOR NEXT END IF '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----PROMPT FOR WINDOWS CD - QUIT IF CANCELLED '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' IF iAmQuiet = 0 THEN strNeedCD = MsgBox("This script will place a folder on your desktop containing all necessary files needed to "&_ "install WSH (Windows Script Host) support under Windows PE."&vbCrLF&vbCrLF&"Please ensure that your "&_ "Windows XP Professional CD or Windows XP Professional binaries are available now on: "&vbCrLF&CDSource&vbCrLF&vbCrLF&"This script is only designed to be used with Windows PE/Windows XP RC1 "&_ "or newer.", 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. PUT NEW FOLDER THERE. APPEND TIMESTAMP IF THE FOLDER '-----ALREADY EXISTS. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' strDesktop = WshShell.SpecialFolders("Desktop") strFolderName = "WSH Build Files ("&iArchDir&")" IF iHaveDest = 0 THEN strDestFolder = strDesktop&"\"&strFolderName IF FSO.FolderExists(strDestFolder) THEN GetUnique() strDestFolder = strDestFolder&strAppend strFolderName = strFolderName&strAppend END IF FSO.CreateFolder(strDestFolder) ELSE strDestFolder = strOptDest IF NOT FSO.FolderExists(strDestFolder) THEN FSO.CreateFolder(strDestFolder) END IF END IF IF iHaveDest = 1 THEN strIDir = strDestFolder&"\"&iArchDir strSysDir = strDestFolder&"\"&iArchDir&"\System32" strDestFolder = strSysDir END IF IF FSO.FileExists(strDestFolder&"\autoexec.cmd") THEN SET FILE = FSO.OpenTextFile(strDestFolder&"\autoexec.cmd", ForAppending, true) FILE.WriteLine("call WSH.bat") FILE.Close() END IF '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----SET COMMON VARIABLES SO THE STRINGS AREN'T SO LARGE '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' strCMDExpand = "EXPAND """&CDSource&"\"&iArchDir&"\" strCMDMid = """ """&strDestFolder&"\" '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----SHELL OUT THE EXPANSION (or COPY) OF ALL NEEDED FILES. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----SHELL OUT THE COPYING OF wsh.inf. SOMETIMES THIS IS COMPRESSED, SOMETIMES IT ISN'T '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' IF FSO.FileExists(CDSource&"\"&iArchDir&"\wsh.inf") THEN FSO.CopyFile CDSource&"\"&iArchDir&"\wsh.inf", strDestFolder&"\" WshShell.Run "attrib -R """&strDestFolder&"\wsh.inf""", 0, FALSE ELSE WshShell.Run strCMDExpand&"wsh.in_"&strCMDMid&"wsh.inf""", 0, FALSE END IF '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----SHELL OUT THE EXPANSION OF core WSH Files. (EXE, DLL, OCX) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 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&"scrobj.dl_"&strCMDMid&"scrobj.dll""", 0, FALSE WshShell.Run strCMDExpand&"scrrun.dl_"&strCMDMid&"scrrun.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 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----CREATE THE SAMPLE WSH SCRIPT . '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' SET FILE = fso.CreateTextFile(strDestFolder&"\test.vbs", True) FILE.WriteLine("MsgBox ""Welcome to Windows PE.""&vbCrLF&vbCrLF&""WSH support is functioning."", vbInformation, ""WSH support is functioning.""") FILE.Close '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----CREATE the BATS THAT WILL INSTALL THE WSH ENVIRONMENT. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' SET FILE = fso.CreateTextFile(strDestFolder&"\WSH.bat", True) FILE.WriteLine ("@ECHO OFF") FILE.WriteLine ("START ""Installing WSH"" /MIN WSH2.bat") FILE.Close SET FILE = fso.CreateTextFile(strDestFolder&"\WSH2.bat", True) 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 ("") FILE.WriteLine ("REM - INSTALL FILE ASSOCIATIONS FOR WSH") FILE.WriteLine ("%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 WSH.inf") FILE.WriteLine ("EXIT") FILE.Close '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----FILES READY - ASK IF THE USER WANTS TO EXPLORE TO THEM. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' IF iAmQuiet = 0 THEN strWantToView = MsgBox("This script has successfully retrieved all necessary files needed to "&_ "install WSH on Windows PE. The files have been placed on your desktop in a directory named """&strFolderName&"""."&vbCrLF&vbCrLF&_ "In order to install the WSH components within Windows PE, place the contents of this folder (not the folder itself) into the I386\System32 or IA64\System32 directory "&_ "of your Windows PE CD, Hard drive install, or RIS Server installation, and modify your startnet.cmd to run the file ""WSH.bat"" (without quotes)."&vbCrLF&vbCrLF&_ "A sample script named test.vbs that you can use to verify installation has been provided as well. You can remove this for your production version of Windows PE."&vbCrLF&vbCrLF&_ "Would you like to open this folder now?", 36, 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 Professional CD in drive "&CDSource&" before continuing.", vbCritical, "No CD in drive "&CDSource&"" WScript.Quit ELSE IF CDDrive.DriveIntegrity(0) = FALSE THEN MsgBox "Could not read files from the CD in drive "&CDSource&".", vbCritical, "CD in drive "&CDSource&" 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(CDSource&"\"&a&"") TestForFolder(CDSource&"\DOCS") TestForFolder(CDSource&"\SUPPORT") TestForFolder(CDSource&"\VALUEADD") TestForFile(CDSource&"\"&a&"\System32\smss.exe") TestForFile(CDSource&"\"&a&"\System32\ntdll.dll") TestForFile(CDSource&"\"&a&"\winnt32.exe") TestForFile(CDSource&"\setup.exe") TestForANDFile CDSource&"\WIN51.B2", CDSource&"\WIN51.RC1", CDSource&"\WIN51.RC1" TestForANDFile CDSource&"\WIN51IP.B2", CDSource&"\WIN51IP.RC1", CDSource&"\WIN51MP.RC1" '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----TEST TO INSURE THAT THEY AREN'T TRYING TO INSTALL FROM Windows PE CD ITSELF '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Set Folder = FSO.GetFolder(CDSource&"\"&a&"\System32") IF Folder.Files.Count > 10 THEN FailOut() END IF END SUB '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----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 TestForANDFile(a,b,c) IF NOT FSO.FileExists(a) AND NOT FSO.FileExists(b) AND NOT FSO.FileExists(c) THEN FailOut() END IF END FUNCTION FUNCTION TestNoFile(a) IF FSO.FileExists(a) THEN FailOut() END IF END FUNCTION '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----GENERIC ERROR IF WE FAIL MEDIA RECOGNITION. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' SUB FailOut() MsgBox"The CD in drive "&CDSource&" does not appear to be a valid Windows XP Professional CD.", vbCritical, "Invalid CD in Drive "&CDSource WScript.Quit 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
Attribute VB_Name = "MiscFunctions" Option Explicit Public Sub InsertionSort( _ ByRef u_arrLongs() As Long _ ) Dim intIndex1 As Long Dim intIndex2 As Long Dim intCurrent1 As Long Dim intCurrent2 As Long Dim intLBound As Long Dim intUBound As Long intLBound = LBound(u_arrLongs) intUBound = UBound(u_arrLongs) For intIndex1 = intLBound + 1 To intUBound intCurrent1 = u_arrLongs(intIndex1) For intIndex2 = intIndex1 - 1 To intLBound Step -1 intCurrent2 = u_arrLongs(intIndex2) If (intCurrent2 > intCurrent1) Then u_arrLongs(intIndex2 + 1) = intCurrent2 Else Exit For End If Next u_arrLongs(intIndex2 + 1) = intCurrent1 Next End Sub Public Function GetLongArray( _ ByRef i_vntArray As Variant _ ) As Long() Dim intArray() As Long Dim intIndex As Long Dim intBase As Long Dim intUBound As Long ReDim intArray(UBound(i_vntArray) - LBound(i_vntArray)) intBase = LBound(i_vntArray) intUBound = UBound(i_vntArray) - LBound(i_vntArray) For intIndex = 0 To intUBound intArray(intIndex) = i_vntArray(intBase + intIndex) Next GetLongArray = intArray End Function Public Function CollectionContainsKey( _ ByRef i_col As Collection, _ ByVal i_strKey As String _ ) On Error GoTo LErrorHandler i_col.Item (i_strKey) CollectionContainsKey = True Exit Function LErrorHandler: CollectionContainsKey = False End Function Public Function FormatTime( _ ByVal i_dtmT0 As Date, _ ByVal i_dtmT1 As Date _ ) Dim dtmDelta As Date FormatTime = Format(i_dtmT0, "Long Time") & " to " & Format(i_dtmT1, "Long Time") & ": " dtmDelta = i_dtmT1 - i_dtmT0 FormatTime = FormatTime & _ Hour(dtmDelta) & " hr " & _ Minute(dtmDelta) & " min " & _ Second(dtmDelta) & " sec" End Function
Dim m_ISWiProject dim ISMFile Dim sacomponents, sdxroot Set Shell = WScript.CreateObject("WScript.Shell") buildMsiDir = Shell.ExpandEnvironmentStrings("%SDXROOT%") & "\enduser\sakit\buildmsi" Set objConn = CreateObject("ADODB.Connection") objConn.open = "Driver={Microsoft Access Driver (*.mdb)};DBQ=filedrop.mdb;DefaultDir=" & buildMsiDir Set objRS = CreateObject("ADODB.Recordset") objRS.ActiveConnection = objConn objRS.CursorType = 3 objRS.LockType = 2 sacomponents = Shell.ExpandEnvironmentStrings("%_NTPOSTBLD%") & "\sacomponents" ISMFile = buildMsiDir & "\sakit.ism" wscript.echo "Building ISM file: " & ISMFile wscript.echo "SAComponent source: " & sacomponents set m_ISWiProject=CreateObject("ISWiAutomation.ISWiProject") m_ISWiProject.OpenProject ISMFile Dim pComponent on error resume next for Each pComponent in m_ISWiProject.ISWiComponents objRS.Source = "Select * from Table3 where Component='" & pComponent.Name & "'" objRS.Open If Not objRS.EOF Then WScript.Echo pComponent.Name & ":" End If while NOT objRS.EOF 'Component is listed in database and has an associated registry file Dim strRegFile strRegFile = sacomponents & "\" & objRS("OAKSrc") & "\" & objRS("FileName") WScript.Echo " " & strRegFile objRS.MoveNext pComponent.ImportRegFile strRegFile,True If Err.number<>0 then WScript.Echo "ERROR: Can not find the registry file for: " & pComponent.Name Err.Clear end if wend objRS.Close Next m_ISWiProject.SaveProject()
<reponame>LaudateCorpus1/RosettaCodeData<gh_stars>1-10 shades = Array(".", ":", "!", "*", "o", "e", "&", "#", "%", "@") light = Array(30, 30, -50) Sub Normalize(v) length = Sqr(v(0)*v(0) + v(1)*v(1) + v(2)*v(2)) v(0) = v(0)/length : v(1) = v(1)/length : v(2) = v(2)/length End Sub Function Dot(x, y) d = x(0)*y(0) + x(1)*y(1) + x(2)*y(2) If d < 0 Then Dot = -d Else Dot = 0 End If End Function 'floor function is the Int function 'ceil function implementation Function Ceil(x) Ceil = Int(x) If Ceil <> x Then Ceil = Ceil + 1 End if End Function Sub DrawSphere(R, k, ambient) Dim i, j, intensity, inten, b, x, y Dim vec(3) For i = Int(-R) to Ceil(R) x = i + 0.5 line = "" For j = Int(-2*R) to Ceil(2*R) y = j / 2 + 0.5 If x * x + y * y <= R*R Then vec(0) = x vec(1) = y vec(2) = Sqr(R * R - x * x - y * y) Normalize vec b = dot(light, vec)^k + ambient intensity = Int((1 - b) * UBound(shades)) If intensity < 0 Then intensity = 0 End If If intensity >= UBound(shades) Then intensity = UBound(shades) End If line = line & shades(intensity) Else line = line & " " End If Next WScript.StdOut.WriteLine line Next End Sub Normalize light DrawSphere 20, 4, 0.1 DrawSphere 10,2,0.4
Function avg(what() As Variant) As Variant 'treats non-numeric strings as zero Dim L0 As Variant, total As Variant For L0 = LBound(what) To UBound(what) If IsNumeric(what(L0)) Then total = total + what(L0) Next avg = total / (1 + UBound(what) - LBound(what)) End Function Function standardDeviation(fp As Variant) As Variant Static list() As Variant Dim av As Variant, tmp As Variant, L0 As Variant 'add to sequence if numeric If IsNumeric(fp) Then On Error GoTo makeArr 'catch undimensioned list ReDim Preserve list(UBound(list) + 1) On Error GoTo 0 list(UBound(list)) = fp End If 'get average av = avg(list()) 'the actual work For L0 = 0 To UBound(list) tmp = tmp + ((list(L0) - av) ^ 2) Next tmp = Sqr(tmp / (UBound(list) + 1)) standardDeviation = tmp Exit Function makeArr: If 9 = Err.Number Then ReDim list(0) Else 'something's wrong Err.Raise Err.Number End If Resume Next End Function Sub tester() Dim x As Variant x = Array(2, 4, 4, 4, 5, 5, 7, 9) For L0 = 0 To UBound(x) Debug.Print standardDeviation(x(L0)) Next End Sub
<reponame>LaudateCorpus1/RosettaCodeData count = 0 firsteigth="" For i = 1 To 100 If IsHappy(CInt(i)) Then firsteight = firsteight & i & "," count = count + 1 End If If count = 8 Then Exit For End If Next WScript.Echo firsteight Function IsHappy(n) IsHappy = False m = 0 Do Until m = 60 sum = 0 For j = 1 To Len(n) sum = sum + (Mid(n,j,1))^2 Next If sum = 1 Then IsHappy = True Exit Do Else n = sum m = m + 1 End If Loop End Function
<filename>examples/QBasic_2.bas REM prints "Hello World!" one character at a time hello$ = "Hello World!" FOR i = 1 TO LEN(hello$) CLS PRINT LEFT$(hello$, i) _DELAY .5 NEXT i END
<gh_stars>10-100 on error resume next set objArgs = wscript.Arguments if objArgs.count < 2 then wscript.echo "Usage setDriveLetter volume <driveletter>:" wscript.quit(1) end if strVolume = Replace(objArgs(0), "\", "\\") strDriveLetter = objArgs(1) '// Get the volume strQuery = "select * from Win32_Volume where Name = '" & strVolume & "'" set VolumeSet = GetObject("winmgmts:").ExecQuery(strQuery) for each obj in VolumeSet set Volume = obj exit for next wscript.echo "Volume: " & Volume.Name wscript.echo "DriveLetter: " & strDriveLetter Volume.DriveLetter = strDriveLetter Volume.Put_ if Err.Number <> 0 then Set objLastError = CreateObject("wbemscripting.swbemlasterror") wscript.echo("Provider: " & objLastError.ProviderName) wscript.echo("Operation: " & objLastError.Operation) wscript.echo("Description: " & objLastError.Description) wscript.echo("StatusCode: 0x" & Hex(objLastError.StatusCode)) end if
Function greatest_element(arr) tmp_num = 0 For i = 0 To UBound(arr) If i = 0 Then tmp_num = arr(i) ElseIf arr(i) > tmp_num Then tmp_num = arr(i) End If Next greatest_element = tmp_num End Function WScript.Echo greatest_element(Array(1,2,3,44,5,6,8))
<reponame>npocmaka/Windows-Server-2003 '*************************************************************************** 'This script tests the enumeration of instances '*************************************************************************** On Error Resume Next Set Disks = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("CIM_LogicalDisk") WScript.Echo "There are", Disks.Count, " Disks" Set Disk = Disks("Win32_LogicalDisk.DeviceID=""C:""") WScript.Echo Disk.Path_.Path if Err <> 0 Then WScript.Echo Err.Description Err.Clear End if
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() On Error Resume Next Dim Locator As New SWbemLocator Dim Service As SWbemServices Set Service = Locator.ConnectServer("ludlow") Debug.Print "Service initial settings:" Debug.Print "Authentication: " & Service.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Service.Security_.ImpersonationLevel; "" Debug.Print "" Service.Security_.AuthenticationLevel = wbemAuthenticationLevelConnect Service.Security_.ImpersonationLevel = wbemImpersonationLevelIdentify Debug.Print "Service modified settings (expecting {2,2}):" Debug.Print "Authentication: " & Service.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Service.Security_.ImpersonationLevel; "" Debug.Print "" 'Now get a class Dim Class As SWbemObject Set Class = Service.Get("Win32_LogicalDisk") Debug.Print "Class initial settings (expecting {2,2}):" Debug.Print "Authentication: " & Class.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Class.Security_.ImpersonationLevel; "" Debug.Print "" Class.Security_.AuthenticationLevel = wbemAuthenticationLevelPktPrivacy Class.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate Debug.Print "Class modified settings (expecting {6,3}):" Debug.Print "Authentication: " & Class.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Class.Security_.ImpersonationLevel; "" Debug.Print "" 'Now get an enumeration from the object Dim Disks As SWbemObjectSet Set Disks = Class.Instances_ Debug.Print "Collection A initial settings (expecting {6,3}):" Debug.Print "Authentication: " & Disks.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Disks.Security_.ImpersonationLevel; "" Debug.Print "" 'For grins print them out Dim Disk As SWbemObject For Each Disk In Disks Debug.Print Disk.Path_.DisplayName Debug.Print Disk.Security_.AuthenticationLevel & ":" & Disk.Security_.ImpersonationLevel Next Debug.Print "" Disks.Security_.AuthenticationLevel = wbemAuthenticationLevelPkt Disks.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate Debug.Print "Collection A modified settings (expecting {4,1}):" Debug.Print "Authentication: " & Disks.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Disks.Security_.ImpersonationLevel; "" Debug.Print "" 'Now get an enumeration from the service Dim Services As SWbemObjectSet Set Services = Service.InstancesOf("Win32_service") Debug.Print "Collection B initial settings (expecting {2,2}):" Debug.Print "Authentication: " & Services.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Services.Security_.ImpersonationLevel; "" Debug.Print "" 'For grins print them out Dim MyService As SWbemObject For Each MyService In Services Debug.Print MyService.Path_.DisplayName Debug.Print MyService.Security_.AuthenticationLevel & ":" & MyService.Security_.ImpersonationLevel Next Debug.Print "" Services.Security_.AuthenticationLevel = wbemAuthenticationLevelCall Services.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate Debug.Print "Collection B modified settings (expecting {3,4} or {4,4}):" Debug.Print "Authentication: " & Services.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Services.Security_.ImpersonationLevel; "" Debug.Print "" 'Print out again as settings should have changed For Each MyService In Services Debug.Print MyService.Path_.DisplayName Debug.Print MyService.Security_.AuthenticationLevel & ":" & MyService.Security_.ImpersonationLevel Next Debug.Print "" 'Now get an event source Dim Events As SWbemEventSource Set Events = Service.ExecNotificationQuery _ ("select * from __instancecreationevent where targetinstance isa 'Win32_NTLogEvent'") Debug.Print "Event Source initial settings (expecting {2,3}):" Debug.Print "Authentication: " & Events.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Events.Security_.ImpersonationLevel; "" Debug.Print "" Events.Security_.AuthenticationLevel = wbemAuthenticationLevelPktIntegrity Events.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate Debug.Print "Event Source modified settings (expecting {5,4}):" Debug.Print "Authentication: " & Events.Security_.AuthenticationLevel Debug.Print "Impersonation: " & Events.Security_.ImpersonationLevel; "" Debug.Print "" 'Now generate an error from services On Error Resume Next Dim MyError As SWbemLastError Dim Class2 As SWbemObject Set Class2 = Service.Get("NoSuchClassss") If Err <> 0 Then Set MyError = New WbemScripting.SWbemLastError Debug.Print "ERROR: " & Err.Description & "," & Err.Number & "," & Err.Source Debug.Print MyError.Security_.AuthenticationLevel Debug.Print MyError.Security_.ImpersonationLevel Err.Clear End If Debug.Print "FINAL SETTINGS" Debug.Print "==============" Debug.Print "" Debug.Print "Service settings (expected {2,3}) = {" & Service.Security_.AuthenticationLevel _ & "," & Service.Security_.ImpersonationLevel & "}" Debug.Print "" Debug.Print "Class settings (expected {6,2}) = {" & Class.Security_.AuthenticationLevel _ & "," & Class.Security_.ImpersonationLevel & "}" Debug.Print "" Debug.Print "Collection A settings (expected {4,1}) = {" & Disks.Security_.AuthenticationLevel _ & "," & Disks.Security_.ImpersonationLevel & "}" Debug.Print "" Debug.Print "Collection B settings (expected {4,4} or {3,4}) = {" & Services.Security_.AuthenticationLevel _ & "," & Services.Security_.ImpersonationLevel & "}" Debug.Print "" Debug.Print "Event Source settings (expected {5,4}) = {" & Events.Security_.AuthenticationLevel _ & "," & Events.Security_.ImpersonationLevel & "}" If Err <> 0 Then Debug.Print "ERROR: " & Err.Description & "," & Err.Number & "," & Err.Source End If Debug.Print Services.Count & "+" & Disks.Count End Sub
class playingcard dim suit dim pips end class class carddeck private suitnames private pipnames private cardno private deck(52) private nTop sub class_initialize dim suit dim pips suitnames = split("H,D,C,S",",") pipnames = split("A,2,3,4,5,6,7,8,9,10,J,Q,K",",") cardno = 0 for suit = 1 to 4 for pips = 1 to 13 set deck(cardno) = new playingcard deck(cardno).suit = suitnames(suit-1) deck(cardno).pips = pipnames(pips-1) cardno = cardno + 1 next next nTop = 0 end sub public sub showdeck dim a redim a(51-nTop) for i = nTop to 51 a(i) = deck(i).pips & deck(i).suit next wscript.echo join( a, ", ") end sub public sub shuffle dim r randomize timer for i = nTop to 51 r = int( rnd * ( 52 - nTop ) ) if r <> i then objswap deck(i),deck(r) end if next end sub public function deal() set deal = deck( nTop ) nTop = nTop + 1 end function public property get cardsRemaining cardsRemaining = 52 - nTop end property private sub objswap( a, b ) dim tmp set tmp = a set a = b set b = tmp end sub end class
<gh_stars>10-100 Attribute VB_Name = "SizerIncludes" Option Explicit Public Enum DIMENSION_E DIM_MIN_E = 0 DIM_TOP_E = 0 DIM_LEFT_E = 1 DIM_HEIGHT_E = 2 DIM_WIDTH_E = 3 DIM_BOTTOM_E = 4 DIM_RIGHT_E = 5 DIM_MAX_E = 5 End Enum Public Enum OPERATION_E OP_ADD_E = 0 OP_MULTIPLY_E = 1 End Enum
'-------------------------------------------------------------------------------------- ' $Summary Place Schematic Port Object ' Copyright (c) 2004 by Altium Limited ' ' Enable Basic script For DXP 2004 SP2 '-------------------------------------------------------------------------------------- '-------------------------------------------------------------------------------------- Sub Main Call ResetParameters Call AddIntegerParameter("Location.X", 100 ) Call AddIntegerParameter("Location.Y", 100 ) Call AddIntegerParameter("Style" , 2 ) Call AddIntegerParameter("IOType" , 3 ) Call AddIntegerParameter("Alignment" , 0 ) Call AddIntegerParameter("Width" , 100 ) Call AddStringParameter ("Name" , "Test Port") Call AddLongIntParameter("AreaColor" , &HFFFFFF ) Call AddLongIntParameter("TextColor" , &H000000 ) Call RunProcess ("Sch:PlacePort" ) End Sub '--------------------------------------------------------------------------------------
on error resume next set objArgs = wscript.Arguments if objArgs.count < 1 then wscript.echo "Usage badParam volume" wscript.quit(1) end if strVolume = Replace(objArgs(0), "\", "\\") '// Get the volume strQuery = "select * from Win32_Volume where Name = '" & strVolume & "'" set VolumeSet = GetObject("winmgmts:").ExecQuery(strQuery) for each obj in VolumeSet set Volume = obj exit for next wscript.echo "Volume: " & Volume.Name Result = 0 wscript.echo "ScheduleAutoChk tests -------------------------------------" Result = Volume.ScheduleAutoChk(Null) rc = ReportIfErr(Err, "FAILED - ScheduleAutoChk") strMessage = MapErrorCode("Win32_Volume", "ScheduleAutoChk", Result) if Result <> 0 then wscript.echo "Volume.ScheduleAutoChk returned: " & Result & " : " & strMessage end if Result = 0 DIM aVolumes(1) aVolumes(0) = "BogusVolume1" aVolumes(1) = "BogusVolume2" Result = Volume.ScheduleAutoChk(aVolumes) rc = ReportIfErr(Err, "FAILED - ScheduleAutoChk") strMessage = MapErrorCode("Win32_Volume", "ScheduleAutoChk", Result) if Result <> 0 then wscript.echo "Volume.ScheduleAutoChk returned: " & Result & " : " & strMessage end if Result = 0 aVolumes(0) = "C:\" aVolumes(1) = "BogusVolume2" Result = Volume.ScheduleAutoChk(aVolumes) rc = ReportIfErr(Err, "FAILED - ScheduleAutoChk") strMessage = MapErrorCode("Win32_Volume", "ScheduleAutoChk", Result) if Result <> 0 then wscript.echo "Volume.ScheduleAutoChk returned: " & Result & " : " & strMessage end if Result = 0 wscript.echo "ExcludeFromAutoChk tests ----------------------------------" Result = Volume.ExcludeFromAutoChk(Null) rc = ReportIfErr(Err, "FAILED - ExcludeFromAutoChk") strMessage = MapErrorCode("Win32_Volume", "ExcludeFromAutoChk", Result) if Result <> 0 then wscript.echo "Volume.ExcludeFromAutoChk returned: " & Result & " : " & strMessage end if Result = 0 aVolumes(0) = "BogusVolume1" aVolumes(1) = "BogusVolume2" Result = Volume.ExcludeFromAutoChk(aVolumes) rc = ReportIfErr(Err, "FAILED - ExcludeFromAutoChk") strMessage = MapErrorCode("Win32_Volume", "ExcludeFromAutoChk", Result) if Result <> 0 then wscript.echo "Volume.ExcludeFromAutoChk returned: " & Result & " : " & strMessage end if Result = 0 aVolumes(0) = "C:\" aVolumes(1) = "BogusVolume2" Result = Volume.ExcludeFromAutoChk(aVolumes) rc = ReportIfErr(Err, "FAILED - ExcludeFromAutoChk") strMessage = MapErrorCode("Win32_Volume", "ExcludeFromAutoChk", Result) if Result <> 0 then wscript.echo "Volume.ExcludeFromAutoChk returned: " & Result & " : " & strMessage end if Result = 0 wscript.echo "Chkdsk tests ----------------------------------------------" Result = Volume.Chkdsk(Null,Null,Null,Null,Null,Null,Null) rc = ReportIfErr(Err, "FAILED - Chkdsk") strMessage = MapErrorCode("Win32_Volume", "Chkdsk", Result) if Result <> 0 then wscript.echo "Volume.Chkdsk returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.Chkdsk("this","is","not","a","boolean","type"," param") rc = ReportIfErr(Err, "FAILED - Chkdsk") strMessage = MapErrorCode("Win32_Volume", "Chkdsk", Result) if Result <> 0 then wscript.echo "Volume.Chkdsk returned: " & Result & " : " & strMessage end if Result = 0 wscript.echo "AddMountPoint tests ---------------------------------------" Result = Volume.AddMountPoint(Null) rc = ReportIfErr(Err, "FAILED - AddMountPoint") strMessage = MapErrorCode("Win32_Volume", "AddMountPoint", Result) if Result <> 0 then wscript.echo "Volume.AddMountPoint returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.AddMountPoint("This is a bogus directory") rc = ReportIfErr(Err, "FAILED - AddMountPoint") strMessage = MapErrorCode("Win32_Volume", "AddMountPoint", Result) if Result <> 0 then wscript.echo "Volume.AddMountPoint returned: " & Result & " : " & strMessage end if Result = 0 wscript.echo "Dismount tests --------------------------------------------" Result = Volume.Dismount(Null,Null) rc = ReportIfErr(Err, "FAILED - Dismount") strMessage = MapErrorCode("Win32_Volume", "Dismount", Result) if Result <> 0 then wscript.echo "Volume.Dismount returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.Dismount("bogus",-1) rc = ReportIfErr(Err, "FAILED - Dismount") strMessage = MapErrorCode("Win32_Volume", "Dismount", Result) if Result <> 0 then wscript.echo "Volume.Dismount returned: " & Result & " : " & strMessage end if Result = 0 wscript.echo "Defrag tests ----------------------------------------------" Result = Volume.Defrag(Null,Null) rc = ReportIfErr(Err, "FAILED - Defrag") strMessage = MapErrorCode("Win32_Volume", "Defrag", Result) if Result <> 0 then wscript.echo "Volume.Defrag returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.Defrag("non-boolean",Null) rc = ReportIfErr(Err, "FAILED - Defrag") strMessage = MapErrorCode("Win32_Volume", "Defrag", Result) if Result <> 0 then wscript.echo "Volume.Defrag returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.Defrag(True,"non obj") rc = ReportIfErr(Err, "FAILED - Defrag") strMessage = MapErrorCode("Win32_Volume", "Defrag", Result) if Result <> 0 then wscript.echo "Volume.Defrag returned: " & Result & " : " & strMessage end if Result = 0 wscript.echo "DefragAnalysis tests --------------------------------------" Result = Volume.DefragAnalysis(Null,Null) rc = ReportIfErr(Err, "FAILED - DefragAnalysis") strMessage = MapErrorCode("Win32_Volume", "DefragAnalysis", Result) if Result <> 0 then wscript.echo "Volume.DefragAnalysis returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.DefragAnalysis(boolType,"non obj") rc = ReportIfErr(Err, "FAILED - DefragAnalysis") strMessage = MapErrorCode("Win32_Volume", "DefragAnalysis", Result) if Result <> 0 then wscript.echo "Volume.DefragAnalysis returned: " & Result & " : " & strMessage end if Result = 0 wscript.echo "Format tests ----------------------------------------------" Result = Volume.Format(Null, Null, Null, Null, Null) rc = ReportIfErr(Err, "FAILED - Format") strMessage = MapErrorCode("Win32_Volume", "Format", Result) if Result <> 0 then wscript.echo "Volume.Format returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.Format("NTFS", "Non-boolean") rc = ReportIfErr(Err, "FAILED - Format") strMessage = MapErrorCode("Win32_Volume", "Format", Result) if Result <> 0 then wscript.echo "Volume.Format returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.Format("BogusFileSystem", True) rc = ReportIfErr(Err, "FAILED - Format") strMessage = MapErrorCode("Win32_Volume", "Format", Result) if Result <> 0 then wscript.echo "Volume.Format returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.Format("NTFS", True, 198743190374103410382) rc = ReportIfErr(Err, "FAILED - Format") strMessage = MapErrorCode("Win32_Volume", "Format", Result) if Result <> 0 then wscript.echo "Volume.Format returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.Format("NTFS", True, , "A Bogus Label That Is Too Long By A Wide Margin") rc = ReportIfErr(Err, "FAILED - Format") strMessage = MapErrorCode("Win32_Volume", "Format", Result) if Result <> 0 then wscript.echo "Volume.Format returned: " & Result & " : " & strMessage end if Result = 0 Result = Volume.Format("NTFS", True, , , "non-boolean-type") rc = ReportIfErr(Err, "FAILED - Format") strMessage = MapErrorCode("Win32_Volume", "Format", Result) if Result <> 0 then wscript.echo "Volume.Format returned: " & Result & " : " & strMessage end if Result = 0 Function MapErrorCode(ByRef strClass, ByRef strMethod, ByRef intCode) set objClass = GetObject("winmgmts:").Get(strClass, &h20000) set objMethod = objClass.methods_(strMethod) values = objMethod.qualifiers_("values") if ubound(values) < intCode then wscript.echo " FAILURE - no error message found for " & intCode & " : " & strClass & "." & strMethod MapErrorCode = "" else MapErrorCode = values(intCode) end if End Function Function ReportIfErr(ByRef objErr, ByRef strMessage) ReportIfErr = objErr.Number if objErr.Number <> 0 then strError = strMessage & " : " & Hex(objErr.Number) & " : " & objErr.Description wscript.echo (strError) objErr.Clear end if End Function
Option Explicit On Error Resume Next DIM strNamespace DIM MaxDiffSpace DIM objStorageSet DIM objStorage DIM objLastError strNamespace = "winmgmts://./root/cimv2" '// Pick a storage object (first one) set objStorageSet = GetObject(strNamespace).InstancesOf("Win32_ShadowStorage") for each objStorage in objStorageSet objStorage.MaxSpace = 50 objStorage.Put_ exit for next If Err.Number <> 0 Then Wscript.Echo("Unexpected Error 0x" & Hex(err.number) & " " & err.description) Set objLastError = CreateObject("wbemscripting.swbemlasterror") Wscript.Echo("Provider: " & objLastError.ProviderName) Wscript.Echo("Operation: " & objLastError.Operation) Wscript.Echo("Description: " & objLastError.Description) Wscript.Echo("StatusCode: 0x" & Hex(objLastError.StatusCode)) End If
<reponame>luisfabianobatista/Bulle_Game <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class FormBulle Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer '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() Me.components = New System.ComponentModel.Container() Me.ShapeContainer1 = New Microsoft.VisualBasic.PowerPacks.ShapeContainer() Me.LineShape1 = New Microsoft.VisualBasic.PowerPacks.LineShape() Me.CircleBlue = New Microsoft.VisualBasic.PowerPacks.OvalShape() Me.CircleGreen = New Microsoft.VisualBasic.PowerPacks.OvalShape() Me.CircleRed = New Microsoft.VisualBasic.PowerPacks.OvalShape() Me.BtnRestart = New System.Windows.Forms.Button() Me.Button1 = New System.Windows.Forms.Button() Me.Timer1 = New System.Windows.Forms.Timer(Me.components) Me.lblScore = New System.Windows.Forms.Label() Me.lblScoreValue = New System.Windows.Forms.Label() Me.lblGameOver = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'ShapeContainer1 ' Me.ShapeContainer1.Location = New System.Drawing.Point(0, 0) Me.ShapeContainer1.Margin = New System.Windows.Forms.Padding(0) Me.ShapeContainer1.Name = "ShapeContainer1" Me.ShapeContainer1.Shapes.AddRange(New Microsoft.VisualBasic.PowerPacks.Shape() {Me.LineShape1, Me.CircleBlue, Me.CircleGreen, Me.CircleRed}) Me.ShapeContainer1.Size = New System.Drawing.Size(914, 530) Me.ShapeContainer1.TabIndex = 0 Me.ShapeContainer1.TabStop = False ' 'LineShape1 ' Me.LineShape1.Name = "LineShape1" Me.LineShape1.X1 = 1 Me.LineShape1.X2 = 914 Me.LineShape1.Y1 = 487 Me.LineShape1.Y2 = 487 ' 'CircleBlue ' Me.CircleBlue.BackColor = System.Drawing.Color.Blue Me.CircleBlue.BackStyle = Microsoft.VisualBasic.PowerPacks.BackStyle.Opaque Me.CircleBlue.BorderColor = System.Drawing.Color.Blue Me.CircleBlue.FillGradientColor = System.Drawing.Color.Blue Me.CircleBlue.FillGradientStyle = Microsoft.VisualBasic.PowerPacks.FillGradientStyle.Central Me.CircleBlue.FillStyle = Microsoft.VisualBasic.PowerPacks.FillStyle.Solid Me.CircleBlue.Location = New System.Drawing.Point(832, 303) Me.CircleBlue.Name = "CircleBlue" Me.CircleBlue.Size = New System.Drawing.Size(81, 80) ' 'CircleGreen ' Me.CircleGreen.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer)) Me.CircleGreen.BackStyle = Microsoft.VisualBasic.PowerPacks.BackStyle.Opaque Me.CircleGreen.BorderColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer)) Me.CircleGreen.FillGradientColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer)) Me.CircleGreen.FillGradientStyle = Microsoft.VisualBasic.PowerPacks.FillGradientStyle.Central Me.CircleGreen.FillStyle = Microsoft.VisualBasic.PowerPacks.FillStyle.Solid Me.CircleGreen.Location = New System.Drawing.Point(139, 323) Me.CircleGreen.Name = "CircleGreen" Me.CircleGreen.Size = New System.Drawing.Size(81, 80) ' 'CircleRed ' Me.CircleRed.BackColor = System.Drawing.Color.Red Me.CircleRed.BackStyle = Microsoft.VisualBasic.PowerPacks.BackStyle.Opaque Me.CircleRed.BorderColor = System.Drawing.Color.Red Me.CircleRed.FillGradientColor = System.Drawing.Color.Red Me.CircleRed.FillGradientStyle = Microsoft.VisualBasic.PowerPacks.FillGradientStyle.Central Me.CircleRed.FillStyle = Microsoft.VisualBasic.PowerPacks.FillStyle.Solid Me.CircleRed.Location = New System.Drawing.Point(307, 318) Me.CircleRed.Name = "CircleRed" Me.CircleRed.Size = New System.Drawing.Size(81, 80) ' 'BtnRestart ' Me.BtnRestart.BackColor = System.Drawing.Color.Silver Me.BtnRestart.Location = New System.Drawing.Point(709, 494) Me.BtnRestart.Name = "BtnRestart" Me.BtnRestart.Size = New System.Drawing.Size(98, 33) Me.BtnRestart.TabIndex = 1 Me.BtnRestart.Text = "Restart" Me.BtnRestart.UseVisualStyleBackColor = False ' 'Button1 ' Me.Button1.BackColor = System.Drawing.Color.Silver Me.Button1.Location = New System.Drawing.Point(813, 494) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(98, 33) Me.Button1.TabIndex = 2 Me.Button1.Text = "Exit" Me.Button1.UseVisualStyleBackColor = False ' 'Timer1 ' Me.Timer1.Enabled = True ' 'lblScore ' Me.lblScore.AutoSize = True Me.lblScore.Font = New System.Drawing.Font("Verdana", 24.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblScore.Location = New System.Drawing.Point(3, 489) Me.lblScore.Name = "lblScore" Me.lblScore.Size = New System.Drawing.Size(131, 38) Me.lblScore.TabIndex = 3 Me.lblScore.Text = "Score:" ' 'lblScoreValue ' Me.lblScoreValue.AutoSize = True Me.lblScoreValue.Font = New System.Drawing.Font("Verdana", 24.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblScoreValue.Location = New System.Drawing.Point(132, 489) Me.lblScoreValue.Name = "lblScoreValue" Me.lblScoreValue.Size = New System.Drawing.Size(40, 38) Me.lblScoreValue.TabIndex = 4 Me.lblScoreValue.Text = "0" ' 'lblGameOver ' Me.lblGameOver.AutoSize = True Me.lblGameOver.Font = New System.Drawing.Font("Verdana", 24.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblGameOver.ForeColor = System.Drawing.Color.Red Me.lblGameOver.Location = New System.Drawing.Point(360, 489) Me.lblGameOver.Name = "lblGameOver" Me.lblGameOver.Size = New System.Drawing.Size(229, 38) Me.lblGameOver.TabIndex = 5 Me.lblGameOver.Text = "GAME OVER" Me.lblGameOver.Visible = False ' 'FormBulle ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoSize = True Me.BackColor = System.Drawing.Color.White Me.ClientSize = New System.Drawing.Size(914, 530) Me.Controls.Add(Me.lblGameOver) Me.Controls.Add(Me.lblScoreValue) Me.Controls.Add(Me.lblScore) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.BtnRestart) Me.Controls.Add(Me.ShapeContainer1) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "FormBulle" Me.ShowIcon = False Me.Text = "Bulle Game" Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents ShapeContainer1 As Microsoft.VisualBasic.PowerPacks.ShapeContainer Friend WithEvents CircleBlue As Microsoft.VisualBasic.PowerPacks.OvalShape Friend WithEvents CircleGreen As Microsoft.VisualBasic.PowerPacks.OvalShape Friend WithEvents CircleRed As Microsoft.VisualBasic.PowerPacks.OvalShape Friend WithEvents LineShape1 As Microsoft.VisualBasic.PowerPacks.LineShape Friend WithEvents BtnRestart As System.Windows.Forms.Button Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Timer1 As System.Windows.Forms.Timer Friend WithEvents lblScore As System.Windows.Forms.Label Friend WithEvents lblScoreValue As System.Windows.Forms.Label Friend WithEvents lblGameOver As System.Windows.Forms.Label End Class
<reponame>npocmaka/Windows-Server-2003 on error resume next while true 'First pass - on mutable object WScript.Echo "************************" WScript.Echo "PASS 1 - SWbemObjectPath" WScript.Echo "************************" WScript.Echo "" Set Path = CreateObject("WbemScripting.SWbemObjectPath") WScript.Echo "Expect """"" WScript.Echo """" & Path.DisplayName & """" WScript.Echo "" Path.DisplayName = "winmgmts:root/cimv2:Win32_Wibble.Name=10,Zip=7" WScript.Echo "Expect no security info" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{impersonationLevel=impersonate}!root/cimv2:Win32_Wibble.Name=10,Zip=7" WScript.Echo "Expect ""{impersonationLevel=impersonate}!""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{authenticationLevel=connect,impersonationLevel=impersonate}!root/cimv2:Win32_Wibble.Name=10,Zip=7" WScript.Echo "Expect ""{authenticationLevel=connect,impersonationLevel=impersonate}!""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{impersonationLevel=identify,authenticationLevel=call}!root/cimv2:Win32_Wibble.Name=10,Zip=7" WScript.Echo "Expect ""{authenticationLevel=call,impersonationLevel=identify}!""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{authenticationLevel=default}!root/cimv2:Win32_Wibble.Name=10,Zip=7" WScript.Echo "Expect ""{authenticationLevel=default}!""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{authenticationLevel=none}!" WScript.Echo "Expect ""{authenticationLevel=none}""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{authenticationLevel=call}" WScript.Echo "Expect ""{authenticationLevel=call}""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{authenticationLevel=pkt,impersonationLevel=delegate}!" WScript.Echo "Expect ""{authenticationLevel=pkt,impersonationLevel=delegate}""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{authenticationLevel=pktIntegrity,impersonationLevel=identify}" WScript.Echo "Expect ""{authenticationLevel=pktIntegrity,impersonationLevel=identify}""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{authenticationLevel=pktPrivacy,impersonationLevel=identify}!root/default" WScript.Echo "Expect ""{authenticationLevel=pktPrivacy,impersonationLevel=identify}""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{authenticationLevel=pktPrivacy,impersonationLevel=identify}!root/default:__Cimomidentification=@" WScript.Echo "Expect ""{authenticationLevel=pktPrivacy,impersonationLevel=identify}""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{impersonationLevel=anonymous}!" WScript.Echo "Expect ""{impersonationLevel=anonymous}""" WScript.Echo Path.DisplayName WScript.Echo "" Path.DisplayName = "winmgmts:{impersonationLevel=anonymous}" WScript.Echo "Expect ""{impersonationLevel=anonymous}""" WScript.Echo Path.DisplayName WScript.Echo "" 'Seconc pass - on object path WScript.Echo "**************************" WScript.Echo "PASS 2 - SWbemObject.Path_" WScript.Echo "**************************" WScript.Echo "" Set Object = GetObject("winmgmts:win32_logicaldisk") WScript.Echo "Expect ""{authenticationLevel=pktPrivacy,impersonationLevel=identify}""" WScript.Echo Object.Path_.DisplayName WScript.Echo "" Object.Security_.ImpersonationLevel = 3 WScript.Echo "Expect ""{authenticationLevel=pktPrivacy,impersonationLevel=impersonate}""" WScript.Echo Object.Path_.DisplayName if err <> 0 then WScript.Echo Err.Description, Err.Number, Err.Source end if wend
Public Sub LoopDoWhile() Dim value As Integer value = 0 Do value = value + 1 Debug.Print value; Loop While value Mod 6 <> 0 End Sub
<gh_stars>1-10 " Vimball Archiver by <NAME> UseVimball finish hello.vim [[[1 1 command! HelloWorld :echo "Hello World!"
<reponame>npocmaka/Windows-Server-2003 Imports System Imports System.Collections Imports System.Core Imports System.ComponentModel Imports System.Drawing Imports System.Data Imports System.WinForms Imports System.Management Namespace RemoteAccess Public Class Form1 Inherits System.WinForms.Form 'Required by the Win Form Designer Private components As System.ComponentModel.Container Private StatusLabel As System.WinForms.Label Private GroupBox5 As System.WinForms.GroupBox Private ConnectButton As System.WinForms.Button Private GroupBox4 As System.WinForms.GroupBox Private AuthorityText As System.WinForms.TextBox Private GroupBox3 As System.WinForms.GroupBox Private PasswordText As System.WinForms.TextBox Private UserText As System.WinForms.TextBox Private GroupBox2 As System.WinForms.GroupBox Private NamespaceText As System.WinForms.TextBox Private GroupBox1 As System.WinForms.GroupBox Public Sub New() MyBase.New() 'This call is required by the Win Form Designer. InitializeComponent() 'TODO: Add any initialization after the InitForm call End Sub 'Form overrides dispose to clean up the component list. Overrides Public Sub Dispose() MyBase.Dispose() components.Dispose() End Sub 'The main entry point for the application Shared Sub Main() System.WinForms.Application.Run(New Form1) End Sub 'NOTE: The following procedure is required by the Win Form Designer 'It can be modified using the Win Form Designer. 'Do not modify it using the code editor. Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Me.NamespaceText = New System.WinForms.TextBox Me.GroupBox2 = New System.WinForms.GroupBox Me.GroupBox1 = New System.WinForms.GroupBox Me.PasswordText = New System.WinForms.TextBox Me.GroupBox5 = New System.WinForms.GroupBox Me.GroupBox3 = New System.WinForms.GroupBox Me.StatusLabel = New System.WinForms.Label Me.AuthorityText = New System.WinForms.TextBox Me.ConnectButton = New System.WinForms.Button Me.UserText = New System.WinForms.TextBox Me.GroupBox4 = New System.WinForms.GroupBox NamespaceText.Location = New System.Drawing.Point(16, 16) NamespaceText.Text = "//./root/cimv2" NamespaceText.TabIndex = 0 NamespaceText.Size = New System.Drawing.Size(224, 20) GroupBox2.Location = New System.Drawing.Point(24, 80) GroupBox2.TabIndex = 1 GroupBox2.TabStop = False GroupBox2.Text = "User" GroupBox2.Size = New System.Drawing.Size(256, 48) GroupBox1.Location = New System.Drawing.Point(24, 16) GroupBox1.TabIndex = 0 GroupBox1.TabStop = False GroupBox1.Text = "Namespace" GroupBox1.Size = New System.Drawing.Size(256, 48) PasswordText.Location = New System.Drawing.Point(40, 160) PasswordText.Text = "" PasswordText.PasswordChar = CChar(42) PasswordText.TabIndex = 2 PasswordText.Size = New System.Drawing.Size(224, 20) GroupBox5.Location = New System.Drawing.Point(320, 104) GroupBox5.TabIndex = 7 GroupBox5.TabStop = False GroupBox5.Text = "Status" GroupBox5.Size = New System.Drawing.Size(208, 48) Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.Text = "Form1" '@design Me.TrayLargeIcon = True '@design Me.TrayHeight = 0 Me.ClientSize = New System.Drawing.Size(568, 277) GroupBox3.Location = New System.Drawing.Point(24, 144) GroupBox3.TabIndex = 3 GroupBox3.TabStop = False GroupBox3.Text = "Password" GroupBox3.Size = New System.Drawing.Size(256, 48) StatusLabel.Location = New System.Drawing.Point(16, 16) StatusLabel.Text = "Not Yet Connected" StatusLabel.Size = New System.Drawing.Size(168, 24) StatusLabel.TabIndex = 0 AuthorityText.Location = New System.Drawing.Point(40, 224) AuthorityText.Text = "" AuthorityText.TabIndex = 4 AuthorityText.Size = New System.Drawing.Size(224, 20) ConnectButton.Location = New System.Drawing.Point(328, 24) ConnectButton.Size = New System.Drawing.Size(152, 40) ConnectButton.TabIndex = 6 ConnectButton.Text = "Connect" ConnectButton.AddOnClick(New System.EventHandler(AddressOf Me.ConnectButton_Click)) UserText.Location = New System.Drawing.Point(40, 96) UserText.Text = "" UserText.TabIndex = 0 UserText.Size = New System.Drawing.Size(224, 20) GroupBox4.Location = New System.Drawing.Point(24, 208) GroupBox4.TabIndex = 5 GroupBox4.TabStop = False GroupBox4.Text = "Authority" GroupBox4.Size = New System.Drawing.Size(256, 48) GroupBox1.Controls.Add(NamespaceText) Me.Controls.Add(GroupBox5) Me.Controls.Add(ConnectButton) Me.Controls.Add(AuthorityText) Me.Controls.Add(PasswordText) Me.Controls.Add(GroupBox3) Me.Controls.Add(GroupBox1) Me.Controls.Add(UserText) Me.Controls.Add(GroupBox2) Me.Controls.Add(GroupBox4) GroupBox5.Controls.Add(StatusLabel) End Sub Protected Sub ConnectButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim scope As ManagementScope Dim options As New ConnectionOptions() StatusLabel.Text = "" If Len(UserText.Text) > 0 Then options.Username = UserText.Text End If If Len(PasswordText.Text) > 0 Then options.Password = PasswordText.Text End If If Len(AuthorityText.Text) > 0 Then options.Authority = AuthorityText.Text End If scope = New ManagementScope(NamespaceText.Text, options) Dim sc As ManagementClass sc = New ManagementClass(scope, New ManagementPath("__SystemClass"), Nothing) ' Attempt a connection Try sc.Get() StatusLabel.Text = "Succeeded" Catch ex As ManagementException StatusLabel.Text = ex.Message Catch ex2 As Exception StatusLabel.Text = ex2.Message End Try End Sub End Class End Namespace
<reponame>npocmaka/Windows-Server-2003 ' ' test6.vbs ' ' enumerate all setup classes ' Dim WshSHell Dim DevCon Dim SetupClasses Dim SetupClass SET WshShell = WScript.CreateObject("WScript.Shell") SET DevCon = WScript.CreateObject("DevCon.DeviceConsole") SET SetupClasses = DevCon.SetupClasses() FOR EACH SetupClass IN SetupClasses WScript.Echo "Class " + SetupClass.Name + " " + SetupClass.Guid + " : " + SetupClass.Description NEXT
<reponame>mullikine/RosettaCodeData Option Base 1 Private Sub pascal_triangle(n As Integer) Dim odd() As String Dim eve() As String ReDim odd(1) ReDim eve(2) odd(1) = " 1" For i = 1 To n If i Mod 2 = 1 Then Debug.Print String$(2 * n - 2 * i, " ") & Join(odd, " ") eve(1) = " 1" ReDim Preserve eve(i + 1) For j = 2 To i eve(j) = Format(CStr(Val(odd(j - 1)) + Val(odd(j))), "@@@") Next j eve(i + 1) = " 1" Else Debug.Print String$(2 * n - 2 * i, " ") & Join(eve, " ") odd(1) = " 1" ReDim Preserve odd(i + 1) For j = 2 To i odd(j) = Format(CStr(Val(eve(j - 1)) + Val(eve(j))), "@@@") Next j odd(i + 1) = " 1" End If Next i End Sub Public Sub main() pascal_triangle 13 End Sub
VERSION 5.00 Begin VB.Form frmPause BorderStyle = 3 'Fixed Dialog Caption = "Pausing..." ClientHeight = 1215 ClientLeft = 45 ClientTop = 330 ClientWidth = 3135 Icon = "frmPause.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1215 ScaleWidth = 3135 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner Begin VB.Timer Timer1 Interval = 5000 Left = 2640 Top = 120 End Begin VB.CommandButton Command1 Cancel = -1 'True Caption = "Stop the Test" Default = -1 'True BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 555 Left = 240 TabIndex = 1 Top = 600 Width = 2655 End Begin VB.Label Label1 Alignment = 2 'Center AutoSize = -1 'True Caption = "Pausing for 5 seconds..." BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 60 TabIndex = 0 Top = 120 Width = 3045 End End Attribute VB_Name = "frmPause" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub Command1_Click() frmMain.canceled = True Unload Me End Sub Private Sub Timer1_Timer() Unload Me End Sub
<filename>Task/Jump-anywhere/VBA/jump-anywhere.vba Public Sub jump() Debug.Print "VBA only allows" GoTo 1 Debug.Print "no global jumps" 1: Debug.Print "jumps in procedures with GoTo" Debug.Print "However," On 2 GoSub one, two Debug.Print "named in the list after 'GoSub'" Debug.Print "and execution will continue on the next line" On 1 GoTo one, two Debug.Print "For On Error, see Exceptions" one: Debug.Print "On <n> GoTo let you jump to the n-th label" Debug.Print "and won't let you continue." Exit Sub two: Debug.Print "On <n> GoSub let you jump to the n-th label": Return End Sub
<filename>admin/pchealth/helpctr/service/searchenginelib/unittest/setest.vbs<gh_stars>10-100 Function EngMgrOnComplete(lSucceeded) wscript.echo "EngMgrOnComplete Succeeded :" & lSucceeded end Function Function WrapperOnProgress(lDone, lTotal) wscript.echo "WrapperOnProgress Done :" & lDone & " Total : " & lTotal end Function Function WrapperOnComplete(lSucceeded) wscript.echo "WrapperOnComplete Succeeded :" & lSucceeded end Function Dim objSEMgr ' ' Create the object ' set objSEMgr = wscript.CreateObject("Semgr.PCHSEManager") ' ' Call Init ' objSEMgr.Init() ' ' Set up the variables ' objSeMgr.sNumResult = 10 objSeMgr.bstrQueryString = "This is a test query string" ' ' Set up the callback function for the search engine manager ' objSeMgr.OnComplete = EngMgrOnComplete ' ' Set up the callback functions for the wrappers ' set objSECollection = objSEMgr.EnumEngine for each objSE in objSECollection objSE.OnComplete = WrapperOnComplete objSE.OnProgress = WrapperOnProgress next ' ' Execute the query ' objSeMgr.ExecuteAsynchQuery ' ' Loop through and get the results ' for each objSE in objSECollection wscript.echo "Search Engine Name :" & objSE.bstrName wscript.echo "Search Engine Description :" & objSE.bstrDescription set objResult = objSE.Result for each objItem in objResult wscript.echo " bstrImageURL :" & objItem.bstrImageURL wscript.echo " bstrTaxonomy :" & objItem.bstrTaxonomy wscript.echo " bstrTitle :" & objItem.bstrTitle wscript.echo " URI :" & objItem.bstrURI wscript.echo " dRank :" & objItem.dRank wscript.echo " sHits :" & objItem.sHits wscript.echo " sIndex :" & objItem.sIndex wscript.echo " sType :" & objItem.sType wscript.echo "" next next
<reponame>djgoku/RosettaCodeData 'This Prints to the Debug-Window! Dim i As Integer Dim ii As Integer Dim x As Integer Dim out As String output = "" For i = 1 To 5 For ii = 1 To i out = out + "*" Next ii Debug.Print (out) out = "" Next i
'*************************************************************************** 'This script tests the inspection of empty arrays on properties, qualifiers 'and value sets '*************************************************************************** On Error Resume Next Set Service = GetObject("winmgmts:root/default") Set MyClass = Service.Get MyClass.Path_.Class = "EMPTYARRAYTEST00" '************************* 'CASE 1: Property values '************************* Set Property = MyClass.Properties_.Add ("p1", 2, true) Property.Value = Array value = MyClass.Properties_("p1").Value WScript.Echo "Array upper bound for property value is [-1]:", UBound(value) WScript.Echo "Base CIM property type is [2]", Property.CIMType WScript.Echo if Err <> 0 Then WScript.Echo Err.Number, Err.Description, Err.Source Err.Clear End if '************************* 'CASE 2: Qualifier values '************************* MyClass.Qualifiers_.Add "q1", Array value = MyClass.Qualifiers_("q1").Value WScript.Echo "Array upper bound for qualifier value is [-1]:", UBound(value) WScript.Echo MyClass.Put_ 'Now read them back and assign "real values" Set MyClass = Service.Get("EMPTYARRAYTEST00") MyClass.Properties_("p1").Value = Array (12, 34, 56) value = MyClass.Properties_("p1").Value WScript.Echo "Array upper bound for property value is [2]:", UBound(value) WScript.Echo "Base CIM property type is [2]", Property.CIMType WScript.Echo MyClass.Properties_("p1").Value = Array value = MyClass.Properties_("p1").Value WScript.Echo "Array upper bound for property value is [-1]:", UBound(value) WScript.Echo "Base CIM property type is [2]", Property.CIMType WScript.Echo MyClass.Qualifiers_("q1").Value = Array ("Hello", "World") value = MyClass.Qualifiers_("q1").Value WScript.Echo "Array upper bound for qualifier value is [1]:", UBound(value) MyClass.Qualifiers_("q1").Value = Array value = MyClass.Qualifiers_("q1").Value WScript.Echo "Array upper bound for qualifier value is [-1]:", UBound(value) WScript.Echo MyClass.Put_ '************************* 'CASE 3:Named Values '************************* Set NValueSet = CreateObject("WbemScripting.SWbemNamedValueSet") Set NValue = NValueSet.Add ("Foo", Array) value = NValueSet("Foo").Value WScript.Echo "Array upper bound for context value is [-1]:", UBound(value) if Err <> 0 Then WScript.Echo Err.Number, Err.Description, Err.Source Err.Clear End if
Gosub start Const one = 1 Common a As Integer Dim b As Integer DIM AS STRING str dim as string c(20), d="a", e dim shared as string g dim as string ptr h dim as string * 4096 i dim j as string="Export_GIR_FULL_"+mid(date,7)+","+mid(date,1,2)+""+mid(date,4,2)+".csv" dim as string k="Export_GIR_FULL_"+mid(date(),"(")+","+mid(date,1,2)+""+mid(date,4,2)+".csv", l Type test a As Integer b As Integer End Type Function f() a = 3 End Function start: f() Return
<filename>admin/wmi/wbem/scripting/test/vbscript/property.vbs Set Service = GetObject("winmgmts:") On Error Resume Next Set aClass = Service.Get("Win32_BaseService") for each Property in aClass.Properties_ if VarType(Property) = vbNull then WScript.Echo Property.Name, Property.Origin, Property.IsLocal, Property.IsArray else WScript.Echo Property.Name, Property, Property.Origin, Property.IsLocal, Property.IsArray end if for each Qualifier in Property.Qualifiers_ if IsArray(Qualifier) then Dim strArrayContents V = Qualifier strArrayContents = " " & Qualifier.Name & " {" For x =0 to UBound(V) if x <> 0 Then strArrayContents = strArrayContents & ", " ENd If strArrayContents = strArrayContents & V(x) If Err <> 0 Then WScript.Echo Err.Description Err.Clear End If Next strArrayContents = strArrayContents & "}" WScript.Echo strArrayContents else WScript.Echo " ", Qualifier.Name, Qualifier end if Next Next
REM REM LOCALIZATION REM L_SWITCH_OPERATION = "-t" L_SWITCH_SERVER = "-s" L_SWITCH_INSTANCE_ID = "-v" L_SWITCH_USERNAME = "-u" L_SWITCH_IPADDRESS = "-i" L_OP_ENUMERATE = "e" L_OP_DELETE = "d" L_OP_DELETE_ALL = "a" L_DESC_PROGRAM = "rsess - Manipulate NNTP server sessions" L_DESC_ENUMERATE = "enumerate current sessions" L_DESC_DELETE = "delete a session (must specify -u or -i)" L_DESC_DELETE_ALL = "delete all sessions" L_DESC_OPERATIONS = "<operations>" L_DESC_SERVER = "<server> Specify computer to configure" L_DESC_INSTANCE_ID = "<virtual server id> Specify virtual server id" L_DESC_USERNAME = "<username> Username to delete" L_DESC_IPADDRESS = "<IP Address> IP Address to delete" L_DESC_EXAMPLES = "Examples:" L_DESC_EXAMPLE1 = "rsess.vbs -t e -v 1" L_DESC_EXAMPLE2 = "rsess.vbs -t d -u bad_user" L_DESC_EXAMPLE3 = "rsess.vbs -t a" L_STR_SESSION_NAME = "Username:" L_STR_SESSION_IPADDRESS = "IP Address:" L_STR_SESSION_START_TIME = "Connect time:" L_STR_NUM_SESSIONS = "Number of sessions:" L_ERR_MUST_ENTER_USER_OR_IP = "Error: You must enter either a username or an IP address." REM REM END LOCALIZATION REM REM REM --- Globals --- REM dim g_dictParms dim g_admin set g_dictParms = CreateObject ( "Scripting.Dictionary" ) set g_admin = CreateObject ( "NntpAdm.Sessions" ) REM REM --- Set argument defaults --- REM g_dictParms(L_SWITCH_OPERATION) = "" g_dictParms(L_SWITCH_SERVER) = "" g_dictParms(L_SWITCH_INSTANCE_ID) = "1" g_dictParms(L_SWITCH_USERNAME) = "" g_dictParms(L_SWITCH_IPADDRESS) = "" REM REM --- Begin Main Program --- REM if NOT ParseCommandLine ( g_dictParms, WScript.Arguments ) then usage WScript.Quit ( 0 ) end if dim cSessions dim i dim id dim index REM REM Debug: print out command line arguments: REM REM switches = g_dictParms.keys REM args = g_dictParms.items REM REM REM for i = 0 to g_dictParms.Count - 1 REM WScript.echo switches(i) & " = " & args(i) REM next REM g_admin.Server = g_dictParms(L_SWITCH_SERVER) g_admin.ServiceInstance = g_dictParms(L_SWITCH_INSTANCE_ID) On Error Resume Next g_admin.Enumerate if ( Err.Number <> 0 ) then WScript.echo " Error Enumeration Sessions: " & Err.Description & "(" & Err.Number & ")" end if select case g_dictParms(L_SWITCH_OPERATION) case L_OP_ENUMERATE REM REM List the existing expiration policies: REM cSessions = g_admin.Count WScript.Echo L_STR_NUM_SESSIONS & " " & cSessions for i = 0 to cSessions - 1 On Error Resume Next g_admin.GetNth i if ( Err.Number <> 0 ) then WScript.echo " Error gettomg Session: " & Err.Description & "(" & Err.Number & ")" else PrintSession g_admin end if REM WScript.Echo REM PrintSession g_admin next case L_OP_DELETE REM REM Delete specific current sessions REM g_admin.Username = g_dictParms ( L_SWITCH_USERNAME ) g_admin.IPAddress = g_dictParms ( L_SWITCH_IPADDRESS ) if g_admin.Username = "" AND g_admin.IPAddress = "" then WScript.Echo L_ERR_MUST_ENTER_USER_OR_IP WScript.Quit 0 end if On Error Resume Next g_admin.Terminate if ( Err.Number <> 0 ) then WScript.echo " Error Termination Session: " & Err.Description & "(" & Err.Number & ")" else PrintSession g_admin end if case L_OP_DELETE_ALL REM REM Delete all current sessions REM On Error Resume Next g_admin.TerminateAll if ( Err.Number <> 0 ) then WScript.echo " Error Termination All Sessions: " & Err.Description & "(" & Err.Number & ")" else PrintSession g_admin end if case else usage end select WScript.Quit 0 REM REM --- End Main Program --- REM REM REM ParseCommandLine ( dictParameters, cmdline ) REM Parses the command line parameters into the given dictionary REM REM Arguments: REM dictParameters - A dictionary containing the global parameters REM cmdline - Collection of command line arguments REM REM Returns - Success code REM Function ParseCommandLine ( dictParameters, cmdline ) dim fRet dim cArgs dim i dim strSwitch dim strArgument fRet = TRUE cArgs = cmdline.Count i = 0 do while (i < cArgs) REM REM Parse the switch and its argument REM if i + 1 >= cArgs then REM REM Not enough command line arguments - Fail REM fRet = FALSE exit do end if strSwitch = cmdline(i) i = i + 1 strArgument = cmdline(i) i = i + 1 REM REM Add the switch,argument pair to the dictionary REM if NOT dictParameters.Exists ( strSwitch ) then REM REM Bad switch - Fail REM fRet = FALSE exit do end if dictParameters(strSwitch) = strArgument loop ParseCommandLine = fRet end function REM REM Usage () REM prints out the description of the command line arguments REM Sub Usage WScript.Echo L_DESC_PROGRAM WScript.Echo vbTab & L_SWITCH_OPERATION & " " & L_DESC_OPERATIONS WScript.Echo vbTab & vbTab & L_OP_ENUMERATE & vbTab & L_DESC_ENUMERATE WScript.Echo vbTab & vbTab & L_OP_DELETE & vbTab & L_DESC_DELETE WScript.Echo vbTab & vbTab & L_OP_DELETE_ALL & vbTab & L_DESC_DELETE_ALL WScript.Echo vbTab & L_SWITCH_SERVER & " " & L_DESC_SERVER WScript.Echo vbTab & L_SWITCH_INSTANCE_ID & " " & L_DESC_INSTANCE_ID WScript.Echo vbTab & L_SWITCH_USERNAME & " " & L_DESC_USERNAME WScript.Echo vbTab & L_SWITCH_IPADDRESS & " " & L_DESC_IPADDRESS WScript.Echo WScript.Echo L_DESC_EXAMPLES WScript.Echo L_DESC_EXAMPLE1 WScript.Echo L_DESC_EXAMPLE2 WScript.Echo L_DESC_EXAMPLE3 end sub Sub PrintSession ( admobj ) WScript.Echo L_STR_SESSION_NAME & " " & admobj.Username WScript.Echo L_STR_SESSION_IPADDRESS & " " & admobj.IPAddress WScript.Echo L_STR_SESSION_START_TIME & " " & admobj.StartTime end sub
Option Explicit Sub DeleteFileOrDirectory() Dim myPath As String myPath = "C:\Users\surname.name\Desktop\Docs" 'delete file Kill myPath & "\input.txt" 'delete Directory RmDir myPath End Sub
Public Class Form1 Inherits System.Windows.Forms.Form Private t As New System.Timers.Timer(2000) Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load AddHandler t.Elapsed, AddressOf TimerFired End Sub Private Sub btnStart_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnStart.Click t.Enabled = True End Sub Private Sub btnStop_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnStop.Click t.Enabled = False End Sub Public Sub TimerFired(ByVal sender As Object, _ ByVal e As System.Timers.ElapsedEventArgs) Label1.Text = "Signal Time = " & e.SignalTime.ToString End Sub End Class
<reponame>LaudateCorpus1/RosettaCodeData<gh_stars>1-10 function pangram( s ) dim i dim sKey dim sChar dim nOffset sKey = "<KEY>" for i = 1 to len( s ) sChar = lcase(mid(s,i,1)) if sChar <> " " then if instr(sKey, sChar) then nOffset = asc( sChar ) - asc("a") + 1 if nOffset > 1 then sKey = left(sKey, nOffset - 1) & " " & mid( sKey, nOffset + 1) else sKey = " " & mid( sKey, nOffset + 1) end if end if end if next pangram = ( ltrim(sKey) = vbnullstring ) end function function eef( bCond, exp1, exp2 ) if bCond then eef = exp1 else eef = exp2 end if end function
Imports System Imports System.Collections Imports System.Core Imports System.ComponentModel Imports System.Drawing Imports System.Data Imports System.WinForms Namespace processId Public Class Form1 Inherits System.WinForms.Form 'Required by the Win Form Designer Private components As System.ComponentModel.Container Public Sub New() MyBase.New 'This call is required by the Win Form Designer. InitializeComponent 'TODO: Add any initialization after the InitForm call End Sub 'Form overrides dispose to clean up the component list. Overrides Public Sub Dispose() MyBase.Dispose components.Dispose End Sub 'The main entry point for the application Shared Sub Main() System.WinForms.Application.Run(New Form1) End Sub 'NOTE: The following procedure is required by the Win Form Designer 'It can be modified using the Win Form Designer. 'Do not modify it using the code editor. Private Sub InitializeComponent() components = New System.ComponentModel.Container End Sub End Class End Namespace
<filename>Task/Textonyms/VBScript/textonyms.vb Set objFSO = CreateObject("Scripting.FileSystemObject") Set objInFile = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_ "\unixdict.txt",1) Set objKeyMap = CreateObject("Scripting.Dictionary") With objKeyMap .Add "ABC", "2" : .Add "DEF", "3" : .Add "GHI", "4" : .Add "JKL", "5" .Add "MNO", "6" : .Add "PQRS", "7" : .Add "TUV", "8" : .Add "WXYZ", "9" End With 'Instantiate or Intialize Counters TotalWords = 0 UniqueCombinations = 0 Set objUniqueWords = CreateObject("Scripting.Dictionary") Set objMoreThanOneWord = CreateObject("Scripting.Dictionary") Do Until objInFile.AtEndOfStream Word = objInFile.ReadLine c = 0 Num = "" If Word <> "" Then For i = 1 To Len(Word) For Each Key In objKeyMap.Keys If InStr(1,Key,Mid(Word,i,1),1) > 0 Then Num = Num & objKeyMap.Item(Key) c = c + 1 End If Next Next If c = Len(Word) Then TotalWords = TotalWords + 1 If objUniqueWords.Exists(Num) = False Then objUniqueWords.Add Num, "" UniqueCombinations = UniqueCombinations + 1 Else If objMoreThanOneWord.Exists(Num) = False Then objMoreThanOneWord.Add Num, "" End If End If End If End If Loop WScript.Echo "There are " & TotalWords & " words in ""unixdict.txt"" which can be represented by the digit key mapping." & vbCrLf &_ "They require " & UniqueCombinations & " digit combinations to represent them." & vbCrLf &_ objMoreThanOneWord.Count & " digit combinations represent Textonyms." objInFile.Close
<filename>admin/activec/test/script/application.vbs ' L_Welcome_MsgBox_Message_Text = "This script demonstrates how to manipulate MMC Application visibility." L_Welcome_MsgBox_Title_Text = "Windows Scripting Host Sample" Call Welcome() ' ******************************************************************************** Dim mmc set mmc = wscript.CreateObject("MMC20.Application") bVisible = mmc.Visible For i = 0 To 10 Step 1 If bVisible Then ' If UserControl == True, below hide will fail mmc.Hide Else mmc.Show End If If mmc.UserControl Then mmc.UserControl = False mmc.Hide Else mmc.UserControl = True End If bVisible = mmc.Visible Next set mmc = Nothing ' ******************************************************************************** ' * ' * Welcome ' * Sub Welcome() Dim intDoIt intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _ vbOKCancel + vbInformation, _ L_Welcome_MsgBox_Title_Text ) If intDoIt = vbCancel Then WScript.Quit End If End Sub
<reponame>npocmaka/Windows-Server-2003 OPTION EXPLICIT '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----Windows Script Host script to generate components needed to run HTA '-----under Windows PE. '-----Copyright 2001, Microsoft Corporation '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----DIM, DEFINE VARIABLES, SET SOME GLOBAL OBJECTS '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' DIM strCmdArg, strCmdSwitch, arg, strCmdArray, CDDriveCollection, CDDrive, CDSource, FSO, Folder, HDDColl DIM HDD, FirstHDD, strAppend, WSHShell, strDesktop, strOptDest, strDestFolder DIM FILE, strCMDExpand, strCMDMid, strJobTitle, strNeedCD, iAmPlatform, iArchDir DIM iAmQuiet,iHaveSource, iHaveDest, iWillBrowse, WshSysEnv, strOSVer, strWantToView, strFolderName, intOneMore DIM strCMDado, strCMDmsadc, strCMDOle_db, strIDir, strSysDir Const ForAppending = 8 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----OFFER/TAKE CMDLINE PARAMETERS '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 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" THEN iHaveSource = 1 CDSource = TRIM(strCmdArray(1)) END IF IF lcase(strCmdArray(0)) = "/d" or lcase(strCmdArray(0)) = "-d" THEN iHaveDest = 1 strOptDest = 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&_ "/S:C:\"&vbCRLF&_ "-s:Z:\"&vbCRLF&_ "or"&vbCRLF&_ "-S:\\Myserver\Myshare"&vbCRLF&vbCRLF&_ "The script will still attempt to verify the presence of Windows XP files."&vbCrLF&vbCrLF&_ "/D - Destination. Opposite of CD - specifies build destination. Otherwise placed on desktop."&vbCRLF&vbCRLF&_ "/64 - build for Itanium. Generates scripts for Windows on the Itanium Processor Family."&vbCRLF&vbCRLF&_ "/Q - run without any dialog. This will not confirm success, will notify on failure."&vbCRLF&vbCRLF&_ "/E - explore completed files. Navigate to the created files when completed.", 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 Next ELSE iHaveSource = 0 END IF IF strOptDest = "" THEN iHaveDest = 0 ELSEIF INSTR(UCASE(strOptDest), "I386\") <> 0 OR INSTR(UCASE(strOptDest), "IA64\") <> 0 OR INSTR(UCASE(strOptDest), "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 ""I386"" or ""System32""", vbCritical, "Destination Path Incorrect" WScript.Quit END IF IF iAmQuiet <> 1 THEN iAmQuiet = 0 END IF IF iAmPlatform <> "Itanium" THEN iAmPlatform = "x86" END IF IF Right(strOptDest, 1) = "\" THEN strOptDest = Left(strOptDest, LEN(strOptDest)-1) END IF IF Right(CDSource, 1) = "\" THEN CDSource = Left(CDSource, LEN(CDSource)-1) END IF IF iAmPlatform = "Itanium" THEN iArchDir = "ia64" ELSEIF iAmPlatform = "x86" THEN iArchDir = "i386" END IF strJobTitle = "HTA 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 2000 OR HIGHER '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' strOSVer = WshSysEnv("OS") IF strOSVer <> "Windows_NT" THEN MsgBox "This script must be run on Windows 2000 or Windows XP", vbCritical, "Incorrect Windows Version" 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 <= 0 THEN MsgBox "No CD-ROM drives found. Exiting Script.", vbCritical, "No CD-ROM drive found" WScript.Quit END IF FOR EACH CDDrive IN CDDriveCollection CDSource = CDDrive.Drive(0) EXIT FOR NEXT END IF '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----PROMPT FOR WINDOWS CD - QUIT IF CANCELLED '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' IF iAmQuiet = 0 THEN strNeedCD = MsgBox("This script will place a folder on your desktop containing all necessary files needed to "&_ "install HTA (HTML Applications) support under Windows PE."&vbCrLF&vbCrLF&"Please ensure that your "&_ "Windows XP Professional CD or Windows XP Professional binaries are available now on: "&vbCrLF&CDSource&vbCrLF&vbCrLF&"This script is only designed to be used with Windows PE/Windows XP RC1 "&_ "or newer.", 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. PUT NEW FOLDER THERE. APPEND TIMESTAMP IF THE FOLDER '-----ALREADY EXISTS. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' strDesktop = WshShell.SpecialFolders("Desktop") strFolderName = "HTA Build Files ("&iArchDir&")" IF iHaveDest = 0 THEN strDestFolder = strDesktop&"\"&strFolderName IF FSO.FolderExists(strDestFolder) THEN GetUnique() strDestFolder = strDestFolder&strAppend strFolderName = strFolderName&strAppend END IF FSO.CreateFolder(strDestFolder) ELSE strDestFolder = strOptDest IF NOT FSO.FolderExists(strDestFolder) THEN FSO.CreateFolder(strDestFolder) END IF END IF IF iHaveDest = 1 THEN strIDir = strDestFolder&"\"&iArchDir strSysDir = strDestFolder&"\"&iArchDir&"\System32" strDestFolder = strSysDir END IF IF FSO.FileExists(strDestFolder&"\autoexec.cmd") THEN SET FILE = FSO.OpenTextFile(strDestFolder&"\autoexec.cmd", ForAppending, true) FILE.WriteLine("call HTA.bat") FILE.Close() END IF '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----SET COMMON VARIABLES SO THE STRINGS AREN'T SO LARGE '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' strCMDExpand = "EXPAND """&CDSource&"\"&iArchDir&"\" strCMDMid = """ """&strDestFolder&"\" '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----SHELL OUT THE EXPANSION OF core HTA Files. (EXE, TLB, DLL, OCX) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 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&"mlang.dl_"&strCMDMid&"mlang.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&"\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&"\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 = ""{3050F3B2-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 = ""{5AAF51B2-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 = ""{AAD093B2-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 = ""{B2F87B84-26A6-11D0-B50A-00A024488F73}""") FILE.WriteLine("CLSID_ProtoviewTreeView = ""{B283E214-2CB3-11D0-ADA6-00400520799C}""") FILE.WriteLine("CLSID_ActiveEarthTime = ""{9590092D-8811-11CF-8075-444553540000}""") FILE.WriteLine("CLSID_LeadControl = ""{00080000-B1BA-11CE-ABC6-F5B2E79D9E3F}""") 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 = ""{78A9B22E-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 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----CREATE THE SAMPLE HTA SCRIPT . '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' SET FILE = fso.CreateTextFile(strDestFolder&"\test.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 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----CREATE the BATS THAT WILL INSTALL THE HTA ENVIRONMENT. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' SET FILE = fso.CreateTextFile(strDestFolder&"\HTA.bat", True) FILE.WriteLine ("@ECHO OFF") FILE.WriteLine ("START ""Installing HTA"" /MIN HTA2.bat") FILE.Close SET FILE = fso.CreateTextFile(strDestFolder&"\HTA2.bat", True) 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 ("Regsvr32 %SystemRoot%\System32\mlang.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\pngfilt.dll /s") FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\rsaenh.dll /s") FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\sendmail.dll /s") FILE.WriteLine ("Regsvr32 %SystemRoot%\System32\urlmon.dll /s") FILE.WriteLine ("") FILE.WriteLine ("REM - INSTALL FILE ASSOCIATIONS FOR HTA") FILE.WriteLine ("%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 HTA.inf") FILE.WriteLine ("EXIT") FILE.Close '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----FILES READY - ASK IF THE USER WANTS TO EXPLORE TO THEM. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' IF iAmQuiet = 0 THEN strWantToView = MsgBox("This script has successfully retrieved all necessary files needed to "&_ "install HTA on Windows PE. The files have been placed on your desktop in a directory named """&strFolderName&"""."&vbCrLF&vbCrLF&_ "In order to install the HTA components within Windows PE, place the contents of this folder (not the folder itself) into the I386\System32 or IA64\System32 directory "&_ "of your Windows PE CD, Hard drive install, or RIS Server installation, and modify your startnet.cmd to run the file ""HTA.bat"" (without quotes)."&vbCrLF&vbCrLF&_ "Sample scripts named test.vbs (for WSH) and test.hta (for HTA) that you can use to verify installation have been provided as well. You can remove these for your production version of Windows PE."&vbCrLF&vbCrLF&_ "Would you like to open this folder now?", 36, 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 Professional CD in drive "&CDSource&" before continuing.", vbCritical, "No CD in drive "&CDSource&"" WScript.Quit ELSE IF CDDrive.DriveIntegrity(0) = FALSE THEN MsgBox "Could not read files from the CD in drive "&CDSource&".", vbCritical, "CD in drive "&CDSource&" 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(CDSource&"\"&a&"") TestForFolder(CDSource&"\DOCS") TestForFolder(CDSource&"\SUPPORT") TestForFolder(CDSource&"\VALUEADD") TestForFile(CDSource&"\"&a&"\System32\smss.exe") TestForFile(CDSource&"\"&a&"\System32\ntdll.dll") TestForFile(CDSource&"\"&a&"\winnt32.exe") TestForFile(CDSource&"\setup.exe") TestForANDFile CDSource&"\WIN51.B2", CDSource&"\WIN51.RC1", CDSource&"\WIN51.RC1" TestForANDFile CDSource&"\WIN51IP.B2", CDSource&"\WIN51IP.RC1", CDSource&"\WIN51MP.RC1" '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----TEST TO INSURE THAT THEY AREN'T TRYING TO INSTALL FROM Windows PE CD ITSELF '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Set Folder = FSO.GetFolder(CDSource&"\"&a&"\System32") IF Folder.Files.Count > 10 THEN FailOut() END IF END SUB '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----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 TestForANDFile(a,b,c) IF NOT FSO.FileExists(a) AND NOT FSO.FileExists(b) AND NOT FSO.FileExists(c) THEN FailOut() END IF END FUNCTION FUNCTION TestNoFile(a) IF FSO.FileExists(a) THEN FailOut() END IF END FUNCTION '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '-----GENERIC ERROR IF WE FAIL MEDIA RECOGNITION. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' SUB FailOut() MsgBox"The CD in drive "&CDSource&" does not appear to be a valid Windows XP Professional CD.", vbCritical, "Invalid CD in Drive "&CDSource WScript.Quit 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
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_ "\readings.txt",1) Set objDateStamp = CreateObject("Scripting.Dictionary") Total_Records = 0 Valid_Records = 0 Duplicate_TimeStamps = "" Do Until objFile.AtEndOfStream line = objFile.ReadLine If line <> "" Then token = Split(line,vbTab) If objDateStamp.Exists(token(0)) = False Then objDateStamp.Add token(0),"" Total_Records = Total_Records + 1 If IsValid(token) Then Valid_Records = Valid_Records + 1 End If Else Duplicate_TimeStamps = Duplicate_TimeStamps & token(0) & vbCrLf Total_Records = Total_Records + 1 End If End If Loop Function IsValid(arr) IsValid = True Bad_Readings = 0 n = 1 Do While n <= UBound(arr) If n + 1 <= UBound(arr) Then If CInt(arr(n+1)) < 1 Then Bad_Readings = Bad_Readings + 1 End If End If n = n + 2 Loop If Bad_Readings > 0 Then IsValid = False End If End Function WScript.StdOut.Write "Total Number of Records = " & Total_Records WScript.StdOut.WriteLine WScript.StdOut.Write "Total Valid Records = " & Valid_Records WScript.StdOut.WriteLine WScript.StdOut.Write "Duplicate Timestamps:" WScript.StdOut.WriteLine WScript.StdOut.Write Duplicate_TimeStamps WScript.StdOut.WriteLine objFile.Close Set objFSO = Nothing
' Windows Installer utility to generate a transform from two databases ' For use with Windows Scripting Host, CScript.exe or WScript.exe ' Copyright (c) Microsoft Corporation. All rights reserved. ' Demonstrates use of Database.GenerateTransform and MsiDatabaseGenerateTransform ' Option Explicit Const msiOpenDatabaseModeReadOnly = 0 Const msiOpenDatabaseModeTransact = 1 Const msiOpenDatabaseModeCreate = 3 If Wscript.Arguments.Count < 2 Then Wscript.Echo "Windows Installer database tranform generation utility" &_ vbNewLine & " 1st argument is the path to the original installer database" &_ vbNewLine & " 2nd argument is the path to the updated installer database" &_ vbNewLine & " 3rd argument is the path to the transform file to generate" &_ vbNewLine & " If the 3rd argument is omitted, the databases are only compared" &_ vbNewLine &_ vbNewLine & "Copyright (C) Microsoft Corporation. All rights reserved." Wscript.Quit 1 End If ' Connect to Windows Installer object On Error Resume Next Dim installer : Set installer = Nothing Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError ' Open databases and generate transform Dim database1 : Set database1 = installer.OpenDatabase(Wscript.Arguments(0), msiOpenDatabaseModeReadOnly) : CheckError Dim database2 : Set database2 = installer.OpenDatabase(Wscript.Arguments(1), msiOpenDatabaseModeReadOnly) : CheckError Dim transform:transform = "" 'Simply compare if no output transform file supplied If Wscript.Arguments.Count >= 3 Then transform = Wscript.Arguments(2) Dim different:different = Database2.GenerateTransform(Database1, transform) : CheckError If Not different Then Wscript.Echo "Databases are identical" Else If transform = Empty Then Wscript.Echo "Databases are different" Sub CheckError Dim message, errRec If Err = 0 Then Exit Sub message = Err.Source & " " & Hex(Err) & ": " & Err.Description If Not installer Is Nothing Then Set errRec = installer.LastErrorRecord If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText End If Wscript.Echo message Wscript.Quit 2 End Sub
<reponame>mullikine/RosettaCodeData Public Function Leap_year(year As Integer) As Boolean Leap_year = (Month(DateSerial(year, 2, 29)) = 2) End Function
Function LeftTrim(s) Set regex = New RegExp With regex .Pattern = "^\s*" If .Test(s) Then LeftTrim = .Replace(s,"") Else LeftTrim = s End If End With End Function Function RightTrim(s) Set regex = New RegExp With regex .Pattern = "\s*$" If .Test(s) Then RightTrim = .Replace(s,"") Else RightTrim = s End If End With End Function 'testing the functions WScript.StdOut.WriteLine LeftTrim(" RosettaCode") WScript.StdOut.WriteLine RightTrim("RosettaCode ") WScript.StdOut.WriteLine LeftTrim(RightTrim(" RosettaCode "))
Private Function Factors(x As Long) As String Application.Volatile Dim i As Long Dim cooresponding_factors As String Factors = 1 corresponding_factors = x For i = 2 To Sqr(x) If x Mod i = 0 Then Factors = Factors & ", " & i If i <> x / i Then corresponding_factors = x / i & ", " & corresponding_factors End If Next i If x <> 1 Then Factors = Factors & ", " & corresponding_factors End Function Private Function is_perfect(n As Long) fs = Split(Factors(n), ", ") Dim f() As Long ReDim f(UBound(fs)) For i = 0 To UBound(fs) f(i) = Val(fs(i)) Next i is_perfect = WorksheetFunction.Sum(f) - n = n End Function Public Sub main() Dim i As Long For i = 2 To 100000 If is_perfect(i) Then Debug.Print i Next i End Sub
<gh_stars>1-10 Option Base 1 Private Sub digital_root(n As Variant) Dim s As String, t() As Integer s = CStr(n) ReDim t(Len(s)) For i = 1 To Len(s) t(i) = Mid(s, i, 1) Next i Do dr = WorksheetFunction.Sum(t) s = CStr(dr) ReDim t(Len(s)) For i = 1 To Len(s) t(i) = Mid(s, i, 1) Next i persistence = persistence + 1 Loop Until Len(s) = 1 Debug.Print n; "has additive persistence"; persistence; "and digital root of "; dr & ";" End Sub Public Sub main() digital_root 627615 digital_root 39390 digital_root 588225 digital_root 393900588225# End Sub
<reponame>LaudateCorpus1/RosettaCodeData Public Sub box_the_compass() Dim compass_point As Integer Dim compass_points_all As New Collection Dim test_points_all As New Collection Dim compass_points(8) As Variant Dim test_points(3) As Variant compass_points(1) = [{ "North", "North by east", "North-northeast", "Northeast by north"}] compass_points(2) = [{ "Northeast", "Northeast by east", "East-northeast", "East by north"}] compass_points(3) = [{ "East", "East by south", "East-southeast", "Southeast by east"}] compass_points(4) = [{ "Southeast", "Southeast by south", "South-southeast", "South by east"}] compass_points(5) = [{ "South", "South by west", "South-southwest", "Southwest by south"}] compass_points(6) = [{ "Southwest", "Southwest by west", "West-southwest", "West by south"}] compass_points(7) = [{ "West", "West by north", "West-northwest", "Northwest by west"}] compass_points(8) = [{ "Northwest", "Northwest by north", "North-northwest", "North by west"}] test_points(1) = [{ 0.0, 16.87, 16.88, 33.75, 50.62, 50.63, 67.5, 84.37, 84.38, 101.25, 118.12}] test_points(2) = [{ 118.13, 135.0, 151.87, 151.88, 168.75, 185.62, 185.63, 202.5, 219.37, 219.38, 236.25}] test_points(3) = [{ 253.12, 253.13, 270.0, 286.87, 286.88, 303.75, 320.62, 320.63, 337.5, 354.37, 354.38}] For i = 1 To 3 For Each t In test_points(i) test_points_all.Add t Next t Next i For i = 1 To 8 For Each c In compass_points(i) compass_points_all.Add c Next c Next i For i = 1 To test_points_all.Count compass_point = (WorksheetFunction.Floor(test_points_all(i) * 32 / 360 + 0.5, 1) Mod 32) + 1 Debug.Print Format(compass_point, "@@"); " "; compass_points_all(compass_point); Debug.Print String$(20 - Len(compass_points_all(compass_point)), " "); Debug.Print test_points_all(i) Next i End Sub
"HELLO, WORLD!"
<gh_stars>1-10 Private Function a(i As Variant) As Boolean Debug.Print "a: "; i = 1, a = i End Function Private Function b(j As Variant) As Boolean Debug.Print "b: "; j = 1; b = j End Function Public Sub short_circuit() Dim x As Boolean, y As Boolean 'Dim p As Boolean, q As Boolean Debug.Print "=====AND=====" & vbCrLf For p = 0 To 1 For q = 0 To 1 If a(p) Then x = b(q) End If Debug.Print " = x" Next q Debug.Print Next p Debug.Print "======OR=====" & vbCrLf For p = 0 To 1 For q = 0 To 1 If Not a(p) Then x = b(q) End If Debug.Print " = x" Next q Debug.Print Next p Debug.Print End Sub
<filename>Task/Fibonacci-sequence/Visual-Basic/fibonacci-sequence.vb Sub fibonacci() Const n = 139 Dim i As Integer Dim f1 As Variant, f2 As Variant, f3 As Variant 'for Decimal f1 = CDec(0): f2 = CDec(1) 'for Decimal setting Debug.Print "fibo("; 0; ")="; f1 Debug.Print "fibo("; 1; ")="; f2 For i = 2 To n f3 = f1 + f2 Debug.Print "fibo("; i; ")="; f3 f1 = f2 f2 = f3 Next i End Sub 'fibonacci
<reponame>npocmaka/Windows-Server-2003<filename>net/qos/psched/pslog/tbc.vbs<gh_stars>10-100 ' Macro for Analyzing the TokenBucketConformer ' -------------------------------------------- ' ' Author ' ------ ' <NAME> (<EMAIL>) ' ' Description ' ----------- ' This macro can be used to analyze the conformance time of packets sent out on a flow. It can be used ' to determine the rate at which the app submits packets and the rate at which they get sent out. ' ' Instructions ' ------------ ' * Install a checked psched ' * Run pslog -m0x4000 -l10. This sets the psched logs to start collecting per packet data for the ' TokenBucketConformer ' * Run pslog -f > dumpfile to clear current contents of the log. ' * Begin test; send data for some time and stop the test. ' * Run pslog -f > schedlogfile to collect per packet details ' * Run tbc.vbs <fullpath>\schedlogfile outputfile.xls. This creates an XL spreadsheet with following columns ' ' ' 1st: Arrival Time ' 2nd: Conformance Time ' 3rd: Packet Size ' 4th: Normalized Arrival Time ' 5th: Normalized Conformance Time ' 6th: Overall Rate of arrival (i.e BytesSentSoFar / CurrentTime) ' 7th: Overall Conformance Rate (i.e. BytesSentSoFar/CurrentConformanceTime) ' 8th: Last packet rate (LastPacketSize/(CurrentTime - LastSubmitTime)) ' 9th: Last conformance Rate (LastPacketSize/(CurrentConformanceTime-LastConformanceTime)) ' ' ' --------------------------------------------------------------------------------------------------------------- ' Force variable declaration. Helps us because there are so many variables! Option Explicit ' ' Globals for TBC ' Dim TbcVcArray(500) Dim TbcFirstTime Dim TbcColsPerVc TbcColsPerVc = 7 TbcFirstTime = 0 ProcessPslog Wscript.echo "Done processing the logs!" Wscript.Quit Function Usage wscript.echo "USAGE: psched.vbs <input pslog filename> <output excel filename>" & _ "[DRR_DELAY | DRR_PKTCNT]" wscript.quit End Function '****************************************************************************** '* '* The Main Function that parses the pslog file '* '****************************************************************************** Function ProcessPsLog Dim LastTime Dim EnqueueVc(500), DequeueVc(500) Dim objXL, objTargetXL Dim objWorkbookXL, objWorkbookTargetXL Dim colArgs Dim rowIndex Dim VCcount Dim SchedArray(500) Dim VcPtr, SchedPtr Dim Schedcount, gSchedCount, VCDict, SchedDICT Set objXL = WScript.CreateObject("Excel.Application") Set objTargetXL = WScript.CreateObject("Excel.Application") Set colArgs = WScript.Arguments 'If no command line argumen If colArgs.Count < 2 Then Usage end if Set objWorkBookXL = objXL.WorkBooks.Open(colArgs(0), , , 6, , , , , ":") Set objWorkbookTargetXL = objTargetXL.WorkBooks.Add objXL.Visible = FALSE objTargetXL.Visible = TRUE Set VCDict = CreateObject("Scripting.Dictionary") Set SchedDict = CreateObject("Scripting.Dictionary") rowIndex = 1 gSchedCount = 1 do while objXl.Cells(rowIndex, 1) <> "DONE" if objXl.Cells(rowIndex, 1) = "SCHED" then ' ' see if its a known scheduling component. If so, get the associated ' number for the scheduling component, else allocate a new number. ' We create one sheet per scheduling component, and the number is ' used as a key for the same. ' SchedPtr = objXl.Cells(rowIndex,2) if SchedDict.Exists(SchedPtr) then schedCount = SchedDict.Item(SchedPtr) else ' Store this scheduling component and its count in the sched ' dictionary. Increment the global sched count schedCount = gSchedCount SchedDict.Add SchedPtr, gschedCount gSchedCount = gSchedCount + 1 end if ' See if it is a new VC or an existing one. If it's a new Vc, ' we get a Vc Count and store the VC in the VC Dictionary. ' If it is an existing Vc, we just get the count from the ' dictionary. The count is used to seperate VCs in the output ' sheet. VcPtr = objXL.Cells(rowIndex, 3) if VCDict.Exists(VcPtr) then VcCount = VCDict.Item(VcPtr) else VcCount = SchedArray(schedCount) + 1 SchedArray(schedCount) = VcCount VCDict.Add VcPtr, VcCount end if ' ' Call the Process function of the correct scheduling component ' Select Case SchedPtr case "TB CONFORMER" TbcProcess schedCount, objXL, _ rowIndex, objWorkBookTargetXL,_ TbcVcArray, VcCount, TbcColsPerVc end select end if rowindex = rowindex + 1 loop TbcDone SchedDict, objWorkBookTargetXl, TbcColsPerVc, SchedArray objWorkBookXL.Close if colArgs(1) <> "" then objWorkBookTargetXL.SaveAs(colArgs(1)) end if End Function ' ***************************************************************************** ' * ' * Functions for the TokenBucket Conformer ' * ' ***************************************************************************** ' ' Prints a header for the TBC workbook ' Function TbcDone(schedDict, tWB, ColsPerVc, SchedArray) Dim SchedCount Dim Vc SchedCount = SchedDict.Item("TB CONFORMER") if schedCount <> 0 then tWB.WorkSheets(schedCount).Rows(1).Insert tWB.WorkSheets(schedCount).Name = "TBC" for vc = 1 to SchedArray(schedCount) tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc) = "VC" & vc & "(A)" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc).AddComment tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc).Comment.Visible = FALSE tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc).Comment.Text "Arrival Time" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+1) = "VC" & vc & "(C)" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+1).AddComment tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+1).Comment.Visible = FALSE tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+1).Comment.Text "Conformance Time" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+2) = "VC" & vc & "(PS)" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+2).AddComment tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+2).Comment.Visible = FALSE tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+2).Comment.Text "Packet Size" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+3) = "VC" & vc & "(NA)" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+3).AddComment tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+3).Comment.Visible = FALSE tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+3).Comment.Text "Normalized Arrival Time" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+4) = "VC" & vc & "(NC)" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+4).AddComment tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+4).Comment.Visible = FALSE tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+4).Comment.Text "Normalized Conformance Time" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+5) = "VC" & vc & "(overall rate)" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+5).AddComment tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+5).Comment.Visible = FALSE tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+5).Comment.Text _ "Overall submit rate : BytesSentSoFar/CurrentTime" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+6) = "VC" & vc & "(overall rate)" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+6).AddComment tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+6).Comment.Visible = FALSE tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+6).Comment.Text _ "Overall conformance rate : BytesSentSoFar/CurrentConformanceTime" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+7) = "VC" & vc & "(packet rate)" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+7).AddComment tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+7).Comment.Visible = FALSE tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+7).Comment.Text _ "Last Packet rate: (LastPacketSize/(CurrentTime - LastSubmitTime))" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+8) = "VC" & vc & "(last packet rate)" tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+8).AddComment tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+8).Comment.Visible = FALSE tWB.WorkSheets(schedCount).Cells(1, (vc-1)*ColsPerVc +vc+8).Comment.Text _ "Last Conformance rate: (LastPacketSize/(CurrentConformanceTime - LastConformanceTime))" next end if End Function ' ' This function parses the XL file and prints data related to the Token ' Bucket Conformer. We print arrival time, packet size and conformance time ' Function TbcProcess(schedCount, sXL, rowIndex, tWB, VcRowArray, _ VcCount, ColsPerVc) Dim PacketSize, EnqueueTime, DequeueTime ' Get the Arrival and Conformance Time and print it in the output file PacketSize = sXL.Cells(rowIndex, 5) EnqueueTime = sXL.Cells(rowIndex, 8) DequeueTime = sXL.Cells(rowIndex, 10) if TbcFirstTime = 0 then TbcFirstTime = EnqueueTime VcRowArray(VcCount) = VcRowArray(VcCount) + 1 ' ' Arrival Time ' tWB.WorkSheets(schedCount).Cells(VcRowArray(VcCount), (VcCount-1)*ColsPerVc + VcCount) = EnqueueTime ' ' Conformance Time ' tWB.WorkSheets(schedCount).Cells(VcRowArray(VcCount), (VcCount-1)*ColsPerVc + VcCount+1) = DequeueTime ' ' Packet Size ' tWB.WorkSheets(schedCount).Cells(VcRowArray(VcCount), (VcCount-1)*ColsPerVc + VcCount+2) = PacketSize ' ' Normalized Arrival Time ' tWB.WorkSheets(schedCount).Cells(VcRowArray(VcCount), (VcCount-1)*ColsPerVc + VcCount+3).Formula = _ "=(RC[-3]-" & TbcFirstTime & ")/10000" ' ' Normalized Conformance Time ' tWB.WorkSheets(schedCount).Cells(VcRowArray(VcCount), (VcCount-1)*ColsPerVc + VcCount+4).Formula = _ "=(RC[-3]-" & TbcFirstTime & ")/10000" ' ' Overall submit rate : BytesSentSoFar/(CurrentTime) ' tWB.WorkSheets(schedCount).Cells(VcRowArray(VcCount), (VcCount-1)*ColsPerVc + VcCount+5).Formula = _ "=SUM(R1C[-3]:RC[-3])" & "/ (RC[-2]/1000)" ' ' Overall conformance rate : BytesSentSoFar/(CurrentConformanceTime) ' tWB.WorkSheets(schedCount).Cells(VcRowArray(VcCount), (VcCount-1)*ColsPerVc + VcCount+6).Formula = _ "=SUM(R1C[-4]:RC[-4])" & "/ (RC[-2]/1000)" ' ' Last Packet rate: (LastPacketSize/(CurrentTime - LastSubmitTime)) ' tWB.WorkSheets(schedCount).Cells(VcRowArray(VcCount), (VcCount-1)*ColsPerVc + VcCount+7).Formula = _ "=(RC[-5])/((RC[-4]-R[-1]C[-4])/1000)" ' ' Last Conformance rate: (LastPacketSize/(CurrentConformanceTime - LastConformanceTime)) ' tWB.WorkSheets(schedCount).Cells(VcRowArray(VcCount), (VcCount-1)*ColsPerVc + VcCount+8).Formula = _ "=(RC[-6])/((RC[-4]-R[-1]C[-4])/1000)" end Function
<gh_stars>10-100 on error resume next const wbemPrivilegeSecurity = 7 const wbemPrivilegeDebug = 19 const wbemPrivilegeUndock = 24 set locator = CreateObject("WbemScripting.SWbemLocator") locator.Security_.Privileges.Add wbemPrivilegeSecurity locator.Security_.Privileges.Add wbemPrivilegeUndock Set Privilege = locator.Security_.Privileges(wbemPrivilegeSecurity) WScript.Echo Privilege.Name locator.Security_.Privileges.Add 6535 if err <> 0 then WScript.Echo Err.Number, Err.Description, Err.Source err.clear end if locator.Security_.Privileges.Add wbemPrivilegeDebug for each Privilege in locator.Security_.Privileges Wscript.Echo "" WScript.Echo Privilege.DisplayName WScript.Echo Privilege.Identifier, Privilege.Name, Privilege.IsEnabled next locator.Security_.Privileges(wbemPrivilegeDebug).IsEnabled = false for each Privilege in locator.Security_.Privileges Wscript.Echo "" WScript.Echo Privilege.DisplayName WScript.Echo Privilege.Identifier, Privilege.Name, Privilege.IsEnabled next if err <> 0 then WScript.Echo Err.Number, Err.Description, Err.Source end if
Option Base 1 Function degree(p As Variant) For i = UBound(p) To 1 Step -1 If p(i) <> 0 Then degree = i Exit Function End If Next i degree = -1 End Function Function poly_div(ByVal n As Variant, ByVal d As Variant) As Variant If UBound(d) < UBound(n) Then ReDim Preserve d(UBound(n)) End If Dim dn As Integer: dn = degree(n) Dim dd As Integer: dd = degree(d) If dd < 0 Then poly_div = CVErr(xlErrDiv0) Exit Function End If Dim quot() As Integer ReDim quot(dn) Do While dn >= dd Dim k As Integer: k = dn - dd Dim qk As Integer: qk = n(dn) / d(dd) quot(k + 1) = qk Dim d2() As Variant d2 = d ReDim Preserve d2(UBound(d) - k) For i = 1 To UBound(d2) n(UBound(n) + 1 - i) = n(UBound(n) + 1 - i) - d2(UBound(d2) + 1 - i) * qk Next i dn = degree(n) Loop poly_div = Array(quot, n) '-- (n is now the remainder) End Function Function poly(si As Variant) As String '-- display helper Dim r As String For t = UBound(si) To 1 Step -1 Dim sit As Integer: sit = si(t) If sit <> 0 Then If sit = 1 And t > 1 Then r = r & IIf(r = "", "", " + ") Else If sit = -1 And t > 1 Then r = r & IIf(r = "", "-", " - ") Else If r <> "" Then r = r & IIf(sit < 0, " - ", " + ") sit = Abs(sit) End If r = r & CStr(sit) End If End If r = r & IIf(t > 1, "x" & IIf(t > 2, t - 1, ""), "") End If Next t If r = "" Then r = "0" poly = r End Function Function polyn(s As Variant) As String Dim t() As String ReDim t(2 * UBound(s)) For i = 1 To 2 * UBound(s) Step 2 t(i) = poly(s((i + 1) / 2)) Next i t(1) = String$(45 - Len(t(1)) - Len(t(3)), " ") & t(1) t(2) = "/" t(4) = "=" t(6) = "rem" polyn = Join(t, " ") End Function Public Sub main() Dim tests(7) As Variant tests(1) = Array(Array(-42, 0, -12, 1), Array(-3, 1)) tests(2) = Array(Array(-3, 1), Array(-42, 0, -12, 1)) tests(3) = Array(Array(-42, 0, -12, 1), Array(-3, 1, 1)) tests(4) = Array(Array(2, 3, 1), Array(1, 1)) tests(5) = Array(Array(3, 5, 6, -4, 1), Array(1, 2, 1)) tests(6) = Array(Array(3, 0, 7, 0, 0, 0, 0, 0, 3, 0, 0, 1), Array(1, 0, 0, 5, 0, 0, 0, 1)) tests(7) = Array(Array(-56, 87, -94, -55, 22, -7), Array(2, 0, 1)) Dim num As Variant, denom As Variant, quot As Variant, rmdr As Variant For i = 1 To 7 num = tests(i)(1) denom = tests(i)(2) tmp = poly_div(num, denom) quot = tmp(1) rmdr = tmp(2) Debug.Print polyn(Array(num, denom, quot, rmdr)) Next i End Sub
<filename>Task/Combinations/VBA/combinations-1.vba Option Explicit Option Base 0 'Option Base 1 Private ArrResult Sub test() 'compute Main_Combine 5, 3 'return Dim j As Long, i As Long, temp As String For i = LBound(ArrResult, 1) To UBound(ArrResult, 1) temp = vbNullString For j = LBound(ArrResult, 2) To UBound(ArrResult, 2) temp = temp & " " & ArrResult(i, j) Next Debug.Print temp Next Erase ArrResult End Sub Private Sub Main_Combine(M As Long, N As Long) Dim MyArr, i As Long ReDim MyArr(M - 1) If LBound(MyArr) > 0 Then ReDim MyArr(M) 'Case Option Base 1 For i = LBound(MyArr) To UBound(MyArr) MyArr(i) = i Next i i = IIf(LBound(MyArr) > 0, N, N - 1) ReDim ArrResult(i, LBound(MyArr)) Combine MyArr, N, LBound(MyArr), LBound(MyArr) ReDim Preserve ArrResult(UBound(ArrResult, 1), UBound(ArrResult, 2) - 1) 'In VBA Excel we can use Application.Transpose instead of personal Function Transposition ArrResult = Transposition(ArrResult) End Sub Private Sub Combine(MyArr As Variant, Nb As Long, Deb As Long, Ind As Long) Dim i As Long, j As Long, N As Long For i = Deb To UBound(MyArr, 1) ArrResult(Ind, UBound(ArrResult, 2)) = MyArr(i) N = IIf(LBound(ArrResult, 1) = 0, Nb - 1, Nb) If Ind = N Then ReDim Preserve ArrResult(UBound(ArrResult, 1), UBound(ArrResult, 2) + 1) For j = LBound(ArrResult, 1) To UBound(ArrResult, 1) ArrResult(j, UBound(ArrResult, 2)) = ArrResult(j, UBound(ArrResult, 2) - 1) Next j Else Call Combine(MyArr, Nb, i + 1, Ind + 1) End If Next i End Sub Private Function Transposition(ByRef MyArr As Variant) As Variant Dim T, i As Long, j As Long ReDim T(LBound(MyArr, 2) To UBound(MyArr, 2), LBound(MyArr, 1) To UBound(MyArr, 1)) For i = LBound(MyArr, 1) To UBound(MyArr, 1) For j = LBound(MyArr, 2) To UBound(MyArr, 2) T(j, i) = MyArr(i, j) Next j Next i Transposition = T Erase T End Function
WScript.Echo " " WScript.Echo "Testing brp_sysfinfo values" WScript.Echo " " Set oSysInfo = CreateObject("PCHealth.BugRepSysInfo") if Err.number <> 0 then WScript.Echo "Error occured ",Err.number WScript.Echo " ",Err.description else WScript.Echo "OS Ver ",oSysInfo.GetOSVersionString WScript.Echo "OS Language ID ",oSysInfo.GetLanguageID WScript.Echo "OS Lang User LCID ",oSysInfo.GetUserDefaultLCID WScript.Echo "OS Lang Active CP ",oSysInfo.GetActiveCP end if