Re: ACT scripting

From: sunil (sunil.madamsetty_at_gmail.com)
Date: 09/24/04


Date: 24 Sep 2004 11:58:28 -0700

Hi Ganesh,

Thanks again for ur precious time. I really appriciate your help

While executing the the script send by you..I am getting the following
error.

---------------------------------------------
ScriptError,Object required: 'WScript'(13,1)
---------------------------------------------

Here is my actual requirement

In a file,

Viewstate="dgfeefc%%$^@!#(!(#!@*#!@)#!@#*@!#)!#!@#@#*((**)()JHJYGV@#@#@#&uc=24"

I have to replace the contents whtever after 'Viewstate=' and before
first '&' with '&strviewstate'. This has to be done in the whole
file(i,e) untill the end of the file.

Thanks again in advance,

Sunil

"ganesh" <sganesh80@gmail.com> wrote in message news:<1095963098.423106.84950@h37g2000oda.googlegroups.com>...
> 1) Assuming the pattern you are looking for is unique in the file, the
> following VBScript should work:
>
> Dim oFso , oTextFile
>
> Set oFso = CreateObject("scripting.filesystemobject")
> 'file name
> strFile = "C:\test.txt"
> 'string to search
> strSearch = "Appointment"
> 'string to insert
> strInsert = "testing only"
>
> FileContents = ""
>
> Set oTextFile = oFso.OpenTextFile (strFile,1)
>
> Do Until oTextFile.AtEndOfStream
> sLine = oTextFile.ReadLine
> FileContents = FileContents & sLine & vbcrlf
> If InStr (1,sLine,strSearch,1) Then
> FileContents = FileContents & strInsert & vbcrlf
> End if
> Loop
>
> Set oTextFile = oFso.OpenTextFile (strFile,2)
> oTextFile.Write FileContents
>
>
> 2) One of the best ways to get around pattern searches is to use the
> Regular Expressions. For details check out:
>
> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/reconbuildregularexpression.asp>
>
> In fact you can use Regular Expression in (1) too.
> Hope this helps
> Ganesh



Relevant Pages

  • Re: Perl script to extract data from webpage? (knucklehead newbie).
    ... Your $& is a special perl variable that represents the string matched by ... the last successful pattern match...which in the case of your example ... I have this running now using a script I found elsewhere, ...
    (comp.lang.perl)
  • Re: what is the quickest way to find out whether a string contains another string?
    ... Why would anyone want to use regular expressions to look for a plain ... Regular expressions are a tool for deciding whether a String or ... searching is a trivial degeneration of the problem addressed by regular ... input string into a pattern that matches only itself is the first task. ...
    (comp.lang.java.programmer)
  • Re: Pattern Match
    ... Is there any way to get them in one pattern? ... Here's a demo program I use to test out regular expressions. ... quotes if the expression has spaces) and a string to test (again ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: A character string matches a hex numeric pattern
    ... In an awk script I have a pattern ... that the string "Note:" should not have matched the ... I repeat: anchor the pattern to the beginning of the string: ...
    (comp.lang.awk)
  • Re: BInding operator fails
    ... you're looking for $rdns inside of $result. ... looking for any of the whitespace in your pattern. ... you have no reason to be using regular expressions. ... If you just want to see if one string is ...
    (perl.beginners)