[Webchange-list] Search and Replace

Vince M Hudd vince at softrock.co.uk
Mon Mar 14 17:02:49 GMT 2011

Tim Hill <tim at timil.com> wrote:

> I have a replace string too long for the writable icon so though a
> file-based script would be a good idea, so created this text file:
> WebChange.Script
> Set FileReplace.CaseSensitive To "No"
> Set FileReplace.ChangeFrom To "RAM::RamDisc0.$.search"
> Set FileReplace.ChangeTo To "RAM::RamDisc0.$.replace"
> RunProcess Content.FileReplace

> I then dragged the Path directory and the Script to the icons in the
> WebChange Pro dialogue but when I select Run it throws up "Error 1004:
> unrecognised command, process or variable (set)".
> Obviously, I am doing something wrong! Help!

You are indeed - but only because of as yet undocumented changes to the
script language: That script would be fine under the old system, but not
under the new.

The essential differences that will stop that script working are:

Firstly, there is no longer a Set/To command. It's now just
<varname>=<value> (let <varname>=<value> might also be valid, but I can't
remember offhand.

Secondly, IIRC, there is also no longer a RunProcess command - so that line
would also give the same error (except it would say 'runprocess' in the
brackets. Instead, now you just need to specify the process.

So, by the power of greyskull, the revised script becomes:

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

I've got 'so far' with a script manual - because changes to the language are
pretty much impossible to intuit, unlike changes to the front-end - but
nowhere near far enough to make it available yet.

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