|
Posted by Al Dunbar on 11/29/05 06:45
"Highlander" <tron9901@msn.com> wrote in message
news:1133209896.037785.269910@o13g2000cwo.googlegroups.com...
> Hello. As a novice in both VBScript and HTML, I usually find code
> snippets, tweak 'em to my specifications, then bolt 'em all together to
> accomplish what I need. Like in this case. The following script works
> fine, but I'm sure it can be streamlined, corrected, and the redundancy
> removed.
>
> This HTA will be used to "change the database" of a remote server,
> which involves 3 major tasks:
>
> A. Make specific changes to the Registry (using .REG files)
> B. Copy a specific Configuration.xml file
> C. Restart IIS
<snip>
> Sub Window_Onload
> self.Focus()
> self.ResizeTo 600,500
> self.MoveTo 200,50
>
> ' Clear all variables in order for the
> ' "Enable Change Database button" IF statement to work
Would not be as much of an issue if you avoided using global variables.
> strCMD = "notepad"
recommend using "notepad.exe" instead.
> If strServer = "" Then
> strServer = cboServerSelection.Value
> strVersionFile = "\\" & strServer & "\D$\Program Files\Adss\Patch
> Level\Version.ini"
> Set objWshScriptExec = objShell.Exec (strCMD & " " & strVersionFile)
> Else
> strVersionFile = "\\" & strServer & "\D$\Program Files\Adss\Patch
> Level\Version.ini"
> Set objWshScriptExec = objShell.Exec (strCMD & " " & strVersionFile)
> End If
Suggest extracting the common code from the true and false blocks above,
like this:
> If strServer = "" Then
> strServer = cboServerSelection.Value
> end if
> strVersionFile = "\\" & strServer & "\D$\Program Files\Adss\Patch
> Level\Version.ini"
> Set objWshScriptExec = objShell.Exec (strCMD & " " & strVersionFile)
/Al
Navigation:
[Reply to this message]
|