blob: d962b73d5d6afc41d964d76ee95a6629237a0982 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
rem VBScript examples
' Various constants of different types
const someText = "some " & """text"""
const someInt = 123
const someHex = &h3110c0d3
const someFloat = 123.45e-67
const someDate = #1/2/2016#
const someTime = #12:34:56 AM#
const someBool = vbTrue ' -1
' Do some math.
radius = 1.e2
area = radius ^ 2 * 3.1315
a = 17 : b = 23
c = sqr(a ^2 + b ^ 2)
' Write 10 files.
For i = 1 to 10
createFile( i )
Next
Public Sub createFile(a)
Dim fso, TargetFile
TargetPath = "C:\some_" & a & ".tmp"
Set fso = CreateObject("Scripting.FileSystemObject")
Set TargetFile = fso.CreateTextFile(TargetPath)
TargetFile.WriteLine("Hello " & vbCrLf & "world!")
TargetFile.Close
End Sub
' Define a class with a property.
Class Customer
Private m_CustomerName
Private Sub Class_Initialize
m_CustomerName = ""
End Sub
' CustomerName property.
Public Property Get CustomerName
CustomerName = m_CustomerName
End Property
Public Property Let CustomerName(custname)
m_CustomerName = custname
End Property
End Class
' Special constructs
Option Explicit
On Error Resume Next
On Error Goto 0
' Comment without terminating CR/LF.
|