Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


RE: Read things in File

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: Read things in File
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
 RE: Read things in File - 6/16/2008 10:09:26 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
Hmm...
May you could change the Code anyway?
I think I made a mistake putting in that Stream-thing...


Sirect

BTW::

your solution works!
May you could put this in my code?
Pleeeeeeease

(Yours looks more complicated, so its better for showing ;)

< Message edited by Sirect -- 6/16/2008 10:21:51 PM >

(in reply to Sirect)
 
 
Post #: 21
 
 RE: Read things in File - 6/16/2008 10:59:22 PM   
  ehvbs

 

Posts: 2077
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
I don't know what your code is.

(in reply to Sirect)
 
 
Post #: 22
 
 RE: Read things in File - 6/16/2008 11:06:00 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
Hmm my skill is higher than i thought!
I got it alone, and im sorry for asking... (I was lazy...)

Anyway : Heres my Code, XXX represents things I cant post here


      

(in reply to ehvbs)
 
 
Post #: 23
 
 RE: Read things in File - 6/16/2008 11:30:46 PM   
  ehvbs

 

Posts: 2077
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Sirect,

congratulations! Some food for thought:

(1) Consider to use Option Explicit

(2) Just one FileSystemObject is enough

(3) If you can't give specific reasons for lines like "Set xxx = Nothing" they are not needed
       (and "Set fso = Nothing" would be fatal in regard to (2))

(4) I still think

        oRE.Pattern   = "^((.*" & sTextValue & ".*)|(.*" & sTextValue & ".*))$\n^.*$\n^.*$"

      could be made simpler/less errorprone.


Good luck!

ehvbs

(in reply to Sirect)
 
 
Post #: 24
 
 RE: Read things in File - 6/17/2008 8:24:10 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
Rofl, I think my Problems will never end!

I need to read Line 6 of the Output , whether an Error Occured.
Is it possible to do that without opening it again?
To read it after writing?
I need to look whether the Output Contains : " Result: The task completed with an exit code of (0)."...
Could you help me again?
I don't get it   -.-

(in reply to ehvbs)
 
 
Post #: 25
 
 RE: Read things in File - 6/17/2008 8:37:26 PM   
  ehvbs

 

Posts: 2077
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Sirect,

when you write the data to the output file:

  Else
    oTS.WriteLine oMTS( 0 ).Value 
    oTS.WriteLine oMTS( 1 ).Value
End If

you have line 6 in oMTS( 1 ).Value. So just use Instr() or a RegExp
to look if oMTS( 1 ).Value contains (a significant part of)

   " Result: The task completed with an exit code of (0)."

Good luck!

ehvbs

(in reply to Sirect)
 
 
Post #: 26
 
 RE: Read things in File - 6/17/2008 8:49:35 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline

      

Is not Working.

Wrong numer of Arguments : "Value"

< Message edited by Sirect -- 6/17/2008 8:51:56 PM >

(in reply to Sirect)
 
 
Post #: 27
 
 RE: Read things in File - 6/17/2008 8:56:41 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline

      

no two matches, but line 6 contains it!

(in reply to Sirect)
 
 
Post #: 28
 
 RE: Read things in File - 6/17/2008 9:25:17 PM   
  ehvbs

 

Posts: 2077
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Sirect,

your first attempt: assigning something to oMTS( 1 ).Value makes no sense; you
want to check if it contains "code of (0)".

your second attempt: oMTS( 1 ).Value may well contain this exit code line, but
not two further lines as you requested with the pattern

   oRE1.Pattern   = "^((.*exit code of (0).*))$\n^.*$\n^.*$"

The best/simplest way is to look for "code of (0)" just after writing:

  Else
    oTS.WriteLine oMTS( 0 ).Value 
    oTS.WriteLine oMTS( 1 ).Value
   If 0 < Instr( oMTS( 1 ).Value, "code of (0)" ) Then
       WScript.Echo "no error"
   Else
       WScript.Echo "no no error"
   End If
End If

Good luck!

ehvbs

(in reply to Sirect)
 
 
Post #: 29
 
 RE: Read things in File - 6/17/2008 10:14:56 PM   
  Sirect

 

Posts: 25
Score: 0
Joined: 6/12/2008
Status: offline
Works!
Great!
Thanks!
Danke!


;)


Sirect

(in reply to ehvbs)
 
 
Post #: 30
 
 
Page:  <<   < prev  1 [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 >> RE: Read things in File Page: <<   < prev  1 [2]
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