Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 strSearchWord = "used" Dim SERIAL dim scmd
Set objNet = CreateObject("WScript.NetWork") Set objFSO = CreateObject("Scripting.FileSystemObject") set WshShell =createobject("Wscript.shell") scmd = session.property ("SOURCEPATH") 'msgbox scmd
Set objFile = objFSO.OpenTextFile(scmd,ForReading) strText = objFile.ReadAll objFile.Close Set objFile = objFSO.OpenTextFile(scmd,ForReading) Do While not objFile.AtEndOfStream Do strLine = objFile.ReadLine Loop While Not IsNumeric(strLine)
' Wscript.Echo strLine 'If the match does not occurs then it returns zero,goes into IF loop If InStr(strLine,isnumeric(strSearchWord)) = 0 Then 'msgbox "Inside first IF" SERIAL=strline
Exit Do
end if Loop objFile.Close 'msgbox SERIAL 'try = int(SERIAL) Session.Property ("PIDKEY") = SERIAL Str = objnet.computername SERIAL1=SERIAL & str 'msgbox SERIAL1 WshShell.RegWrite "HKLM\SOFTWARE\ACL Software\ACL 9\Information",SERIAL1 strNewText = replace(strText,SERIAL,SERIAL1) Set objFile = objFSO.OpenTextFile(scmd, ForWriting) objFile.WriteLine strNewText objFile.Close
I need that this script read letters and numbers but he only reads numbers...
"If InStr(strLine,isnumeric(strSearchWord)) = 0 Then "
Your telling it to compare the varialble to another variable that is required to be a number(isnumberic). If that comparison does not = 0...then it won't do anything.
Also, this script has so much redundancy I don't know where to begin.....
This code flows a little better keeping with what you had....but needs some else statements to tel it what to do if the number is numberic. Also inside the "IF" statement....what should the code do if "strline" does not = 0?