ErrorLINE1CHAR1
Programmer
Ok guys i have searched your forums for a while and trolled search results off of here so often that i might as well join and just ask for help..
All im trying to do is create a script that when the user clicks the button, the info from the Text field is submited to a log file. it sounds SUPER easy and everything but, this is like my 3rd redo on the script build becasue i keep finding other procedures for logging, but im most comfortable with this one now. i got it to log the now() func. but any thing else is hopeless, i.e. ive tried:
DIM etc, etc, etc
strTEXT = TESTER.VALUE
etc = etc
sub TESTER_changed()
If (TESTER.value) < "" THEN
get(strTEXT) THEN
objLogfile.writeline now()
strTEXT
objlogfile.close
End If
End sub
'**********************************************************
'* None of the above work I thought it would be able to *
'* know that if the value was greater than nothing to *
'* GET that value and Log it..? *
'* So heres my last hope, ill keep updating with what I *
'* find but im a new guy to VBScript.. *
'**********************************************************
<html>
<head>
<HTA:APPLICATION
APPLICATIONNAME="Log File Testing"
SCROLL="No"
SINGLEINSTANCE="Yes"
borderstyle="Thin"
minimizebutton="No"
maximizebutton="No"/>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Log Tester of HF31SCCITMU</title>
<body>
<div>Computer Name: <input type="text" maxlength="20" size="30" name="txt_computername" readonly onfocus="txt_computername.blur()"></div>
<div>Output Log Test: <input type="text" tabindex="1" value="Test Text Here" maxlength="20" size="40" name="TESTER" onfocus="TESTER.value=''"></div>
<div><button type="submit" value="Submit" onclick="VBScript:">Submit to log</button></div>
<script language="vbscript">
SUB Window_OnLoad
SET objNetwork = CreateObject("WScript.Network")
txt_computername.Value = objNetwork.ComputerName
END SUB
Function BigTest
CONST ADS_SCOPE_SUBTREE = 2
CONST ADS_SECURE_AUTHENTICATION = 1
CONST HKEY_LOCAL_MACHINE = &H80000002
CONST ForReading = 1, ForWriting = 2, ForAppending = 8
CONST TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
DIM strAdsPath
DIM fPath
SET WshShell = WScript.CreateObject("Wscript.Shell")
SET objFSO = CreateObject("Scripting.FileSystemObject")
strLogDir = "E:\DHazeleX\tester" & ".log"
strComputer = (txt_computername.value)
strTEXT = (TESTER.value)
IF (TESTER.value) = "" THEN
MsgBox "Please enter Text"
TESTER.Focus
ELSE
ON ERROR RESUME NEXT
END IF
IF objFSO.FileExists(strLogDir) THEN
SET objFile = objFspenTextFile(strLogDir,ForAppending, false)
objFile.WriteLine "Primary Log Started : " & Now()
objFile.WriteLine
strTEXT
objFile.Writeline "Primary Log Ended :" & Now()
objFile.close
ELSE
fPath = strLogDir
SET objFile = objFso.CreateTextFile (fPath,ForAppending,TRUE)
objFile.WriteLine "2ndary Log Start : " & Now()
objFile.WriteLine
strTEXT
objFile.Writeline "2ndary Log Finish :" & Now()
objFile.close
END IF
END Function
</script>
</head>
</body>
</html>
The Final Script will be in a different program this is just the easiest was of building stuff for me, gotta love HTA's, dont forget to create a log file or it wont do it, i dont know how to do that either..
All im trying to do is create a script that when the user clicks the button, the info from the Text field is submited to a log file. it sounds SUPER easy and everything but, this is like my 3rd redo on the script build becasue i keep finding other procedures for logging, but im most comfortable with this one now. i got it to log the now() func. but any thing else is hopeless, i.e. ive tried:
DIM etc, etc, etc
strTEXT = TESTER.VALUE
etc = etc
sub TESTER_changed()
If (TESTER.value) < "" THEN
get(strTEXT) THEN
objLogfile.writeline now()
strTEXT
objlogfile.close
End If
End sub
'**********************************************************
'* None of the above work I thought it would be able to *
'* know that if the value was greater than nothing to *
'* GET that value and Log it..? *
'* So heres my last hope, ill keep updating with what I *
'* find but im a new guy to VBScript.. *
'**********************************************************
<html>
<head>
<HTA:APPLICATION
APPLICATIONNAME="Log File Testing"
SCROLL="No"
SINGLEINSTANCE="Yes"
borderstyle="Thin"
minimizebutton="No"
maximizebutton="No"/>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Log Tester of HF31SCCITMU</title>
<body>
<div>Computer Name: <input type="text" maxlength="20" size="30" name="txt_computername" readonly onfocus="txt_computername.blur()"></div>
<div>Output Log Test: <input type="text" tabindex="1" value="Test Text Here" maxlength="20" size="40" name="TESTER" onfocus="TESTER.value=''"></div>
<div><button type="submit" value="Submit" onclick="VBScript:">Submit to log</button></div>
<script language="vbscript">
SUB Window_OnLoad
SET objNetwork = CreateObject("WScript.Network")
txt_computername.Value = objNetwork.ComputerName
END SUB
Function BigTest
CONST ADS_SCOPE_SUBTREE = 2
CONST ADS_SECURE_AUTHENTICATION = 1
CONST HKEY_LOCAL_MACHINE = &H80000002
CONST ForReading = 1, ForWriting = 2, ForAppending = 8
CONST TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
DIM strAdsPath
DIM fPath
SET WshShell = WScript.CreateObject("Wscript.Shell")
SET objFSO = CreateObject("Scripting.FileSystemObject")
strLogDir = "E:\DHazeleX\tester" & ".log"
strComputer = (txt_computername.value)
strTEXT = (TESTER.value)
IF (TESTER.value) = "" THEN
MsgBox "Please enter Text"
TESTER.Focus
ELSE
ON ERROR RESUME NEXT
END IF
IF objFSO.FileExists(strLogDir) THEN
SET objFile = objFspenTextFile(strLogDir,ForAppending, false)
objFile.WriteLine "Primary Log Started : " & Now()
objFile.WriteLine
strTEXT
objFile.Writeline "Primary Log Ended :" & Now()
objFile.close
ELSE
fPath = strLogDir
SET objFile = objFso.CreateTextFile (fPath,ForAppending,TRUE)
objFile.WriteLine "2ndary Log Start : " & Now()
objFile.WriteLine
strTEXT
objFile.Writeline "2ndary Log Finish :" & Now()
objFile.close
END IF
END Function
</script>
</head>
</body>
</html>
The Final Script will be in a different program this is just the easiest was of building stuff for me, gotta love HTA's, dont forget to create a log file or it wont do it, i dont know how to do that either..