Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Problem with a script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,66681
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Problem with a script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Problem with a script - 11/19/2008 3:08:28 AM   
  Charles Costa

 

Posts: 2
Score: 0
Joined: 11/19/2008
Status: offline
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...
 
 
Post #: 1
 
 RE: Problem with a script - 11/19/2008 5:33:54 AM   
  chiltz

 

Posts: 76
Score: 0
Joined: 6/13/2007
Status: offline
"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?

(in reply to Charles Costa)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Problem with a script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts