[Webchange-list] Search and Replace

Vince M Hudd vince at softrock.co.uk
Wed Mar 16 17:11:57 GMT 2011


Tim Hill <tim at timil.com> wrote:
> On 15 Mar in mail.tim at timil.com, Vince M Hudd <vince at softrock.co.uk>
> wrote:

> > At least, that's my guess as to the problem - I won't be anywhere near
> > my RISC OS machine to check until early tomorrow evening, and then I'll
> > only have a brief chance to look.
 
> I hope you get the chance: both the _1 variables names you suggest throw
> up a 1004 error: unknown.

Gah! A combination of me misreading and misremembering - and possibly
programming bugs into the latest version(s). I'll decide that last bit in a
moment!

The variables you originally used were:

  FileReplace.ChangeFrom and FileReplace.ChangeTo

And the process:
 
  Content.FileReplace

What I cunningly didn't notice was the 'File' part (ie that you were doing a
search and replace using data contained in other files as the material to
use). I just copied and pasted the variables to suggest the addition of the
_1 - which was wrong.

The variables and process should indeed be what you used, as above.

Looking at the part of the source code that recognises the variables and
processes so that WebChange can do what it needs to do, they are there - so
if it's throwing a wobbly, this does suggest a bug.

Except that the relevat bit of code does look correct. :|

And a quick test with this script works here:

WebChange.Script
FileReplace.CaseSensitive = "No"
FileReplace.ChangeFrom = "RAM::RamDisc0.$.search"
FileReplace.ChangeTo = "RAM::RamDisc0.$.replace"
Prompt FileReplace.ChangeFrom

What happens here is that a "WebChange (back end)" prompt appears with
cancel and okay buttons when the Prompt line is reached, with the text
"RAM::Ramdisc0.$.search" displayed. By reaching that line it must have
passed the two lines causing problems for you - and that it displays the
contents of the first of those two variables shows that line to have been
correctly dealt with. Clicking either cancel or okay then allows the script
to reach its natural end.

Are you using the most recent version? (2.95.22) If not, that might explain
your choices being in the wrong place ref the other thread. Having said
that, the history doesn't mention this apparent bug being fixed - yet it's
working here with the latest version - so it shouldn't solve this problem
anwyay. :(

I keep looking at the script in your post to see if there are typos that I'm
just not spotting, but I'm sure there aren't.

I've also just tried putting trailing spaces on the lines, extra spaces
between the = sign and the variable names and strings, in case anything like
that throws up problems - but still it works here!

The closest I can get to your problem is to put both the errant lines on a
single line - separated by spaces - but then the error is:

     Error 1004: Unrecognised command, process or variable (=)

Which isn't quite what you're getting.

GAH!

It might help if you could send me the actual script file (to me, rather
than the list) as an attached text file, rather than pasted into a message.
Maybe there is something bizarre about the file that's confusing WebChange.

-- 
Soft Rock Software:                   http://www.softrock.co.uk
Vince M Hudd:                         http://misc.vinceh.com/about-vinceh/

Bristol RISC OS Users second meeting: http://www.riscository.com/?p=147
South West Show report:               http://www.riscository.com/?p=169



More information about the Webchange-list mailing list