I've been messing around with HTA's lately and was trying some font manipulation within the vbscript part of my code however, I'm having a hard time understanding the syntax of it. I have some if then statements with coresponding messages mixed with variables and text fields. For instance, I would like the output of this line to come out green on my script:
I read you could use the following code to color your output...I tried it several ways and could't get it to work:
I thought I would try easier font styles like bold around a variable like this and it works although I still don't understand how to surround the entire line with the code:
If the above works, why doesn't the code below work? I thought it was because of the double quotes so I tried char(34) with no luck.
Here is the entire HTA:
Code:
strHTML = strHTML & disUser & " folder was renamed on " & folPath & "<br>"
I read you could use the following code to color your output...I tried it several ways and could't get it to work:
Code:
<font color="red" face="Times New Roman" size="3">Your text goes here</font>
I thought I would try easier font styles like bold around a variable like this and it works although I still don't understand how to surround the entire line with the code:
Code:
"<b>" & variable & "</b>"
If the above works, why doesn't the code below work? I thought it was because of the double quotes so I tried char(34) with no luck.
Code:
"<font color="red" face="Times New Roman" size="3">" & variable & "</font>"
Here is the entire HTA:
Code:
<head>
<title>HTA Test</title>
<HTA:APPLICATION
APPLICATIONNAME="Test Folder Rename"
SCROLL="yes"
SINGLEINSTANCE="yes"
>
</head>
<script language="VBScript">
sub renamefolders
disuser = "doej"
Set objFSO = CreateObject("Scripting.FileSystemObject")
arrPath = Array("\\houfiler\tsprofiles$\", "\\swn.com\remotedata\swn-di\", "\\houfiler\rootdrv$\", _
"\\fayfiler\rootdrv$\", "\\fayfiler\nrtsprofile$\", "\\houfiler\home$\", _
"\\fayfiler\home$\")
For Each folPath In arrPath
If objFSO.FolderExists(folPath & disuser) Then
objFSO.MoveFolder folPath & disUser , folPath & "_" & disUser
If Err.Number = 0 Then
[b]strHTML = strHTML & disUser & " folder was renamed on " & folPath & "<br>"[/b]
Else
[b]strHTML = strHTML & "Move folder error #: " & Err.Number & " Err Desc: " & Err.Description & "<br>"[/b]
End If
Else
[b]strHTML = strHTML & folPath & " didn't exist so it wasn't moved." & "<br>"[/b]
End If
err.clear
Next
DataArea.InnerHTML = strHTML
end sub
</script>
<body>
<input type="button" value="Rename Folders" name="run_button" onClick="renamefolders">
<p>
<span id = "DataArea"></span>
</body>