-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc-LVA-libcmd-1.0.2.html
123 lines (121 loc) · 6.58 KB
/
doc-LVA-libcmd-1.0.2.html
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>libutil API</title>
<style type="text/css">
<!--
.style11 {font-size: 12px}
.style14 {
font-size: 12px;
font-family: "Courier New", Courier, mono;
}
.style19 {font-family: "Times New Roman", Times, serif}
.style20 {font-size: 14px; }
-->
</style>
</head>
<body>
<table width="740" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h1 class="style19">Framework: Load other VBScripts as APIs </h1>
<h2 class="style19">libutil-1.0.0.vbs</h2>
<p><span class="style20">In order to promote </span><span class="style14">libutil-1.0.0.vbs</span> <span class="style20">is a VBScript Component that assembles the most commonly used routine for software deployment scripting. This document will demonstration some practical usage for the methods that are available in this script API.</span></p>
<ul><li class="style11"><a href="#settings">Basic setting (log, WScript object, etc...)</a></li>
<li class="style11"><a href="#instance">Create an instance in your script</a></li>
<li class="style11"><span class="style11"><a href="#">Built-in Methods</a>:
</span>
<ul>
<li class="style11"><a href="#">checkPath(...)</a></li>
<li class="style11"><a href="#">copyFile(...)</a></li>
<li class="style11"><a href="#">copyFolder(...)</a></li>
<li class="style11"><a href="#">deleteFile(...)</a></li>
<li class="style11"><a href="#">deleteFolder(...)</a></li>
<li class="style11"><a href="#">fileVer(...)</a></li>
<li class="style11"><a href="#">getCDSAppId()</a></li>
<li class="style11"><a href="#">getCDSGroundupId()</a></li>
<li class="style11"><a href="#">getDate()</a></li>
<li class="style11"><a href="#">getEnvar(...)</a></li>
<li class="style11"><a href="#">getOSType()</a></li>
<li class="style11"><a href="#">getOSVersion()</a></li>
<li class="style11"><a href="#">getTime()</a></li>
<li class="style11"><a href="#">logger(...)</a></li>
<li class="style11"><a href="#">msgLog(...)</a></li>
<li class="style11"><a href="#">removeEnvar(...)</a></li>
<li class="style11"><a href="#">regDelete(...)</a></li>
<li class="style11"><a href="#">regRead(...)</a></li>
<li class="style11"><a href="#">regWrite(...)</a></li>
<li class="style11"><a href="#">runCommand(...)</a></li>
<li class="style11"><a href="#">service(...)</a></li>
<li class="style11"><a href="#">setEnvar(...)</a></li>
<li class="style11"><a href="#">setRunOnce(...)</a></li>
<li class="style11"><a href="#">setWSH(...)</a></li>
</ul>
</li>
</ul>
<h2 id="settings">Basic settings for your script file </h2>
<p class="style20">The following is an example of basic settings you can use to implement your script while using the common-tasks-1.2.wsc component. </p>
<blockquote>
<table width="640" border="0" cellspacing="0" cellpadding="1">
<tr>
<td bgcolor="#999999"><table width="640" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr>
<td><p class="style14"><br>
'*******************************************************************<br>
'* File: <scriptname>.vbs <br>
'* Author: <myname> <br>
'* Date: <created> <br>
'* Purpose: <major task perform by this script> <br>
'* <br>
'* Rev-Info: <date>/<author>, <bugfix> <br>
'*******************************************************************<br>
OPTION EXPLICIT<br>
<br>
(1) dim task : set task = GetObject("script:"&getCurrentPath()&"\common-tasks-1.2.wsc")<br>
(2) task.logger "C:\Program Files\DS\LOGS\my.log" <br>
<br>
<br>
<YOUR SCRIPT GOES HERE> <br>
<br>
<br>
(3) Function getCurrentPath()<br>
dim pathstr:pathstr=wscript.scriptfullname<br>
getCurrentPath=left(pathstr,len(pathstr)-len(wscript.scriptname)-1)<br>
End Function<br>
<br>
</p>
</td>
</tr>
</table></td>
</tr>
</table>
</blockquote>
<ol>
<li class="style20"> To create an instance object of common-task-1.2.wsc component which, in this example, is located in the same directory where my script file is located. </li>
<li class="style20"> To create a log file to log every important action that occurs in my script and also to log the component behavior. </li>
<li class="style20"> The function getCurrentPath() returns the current directory where this script was launched. </li>
</ol>
<h2 id="instance">Create an instance in your script </h2>
<p class="style20">One advantage with VBScript over Batch scripting is that it supports object-oriented programming features. </p>
<blockquote>
<table width="640" border="0" cellspacing="0" cellpadding="1">
<tr>
<td bgcolor="#999999"><table width="640" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr>
<td><p class="style14"><br>
dim task<br>
set task = GetObject("script:"&getCurrentDir&"\common-tasks-1.2.wsc")<br>
<br>
</p>
</td>
</tr>
</table></td>
</tr>
</table>
</blockquote>
<p class="style20">Voila, now you have a task object that is able to perform all routines that are available within the component. </p></td>
</tr>
</table>
</body>
</html>