PDA

View Full Version : Replace in File: disabling vbscript parser for search / replace expressions?


Rogier
09-20-2011, 09:53 AM
I want to replace some string within file A with the contents of another file B, using the "Replace in File" step.

To do so, I've entered this as the 'replace' contents:

[vbld_FSO.OpenTextFile("FileB").ReadAll]

Problem: when file B (which is to be inserted into A) contains stuff between square brackets [like this], I'm getting random "invalid expression" errors - apparently the vbscript parser interprets the result of the above expression as well. I've already enabled "Tread all characters as literals (no regexp)", that didn't solve it.

Is there a way to literally get a file's contents as search or replace pattern, and have VBP use that without parsing that content for vbscript? And I guess same goes for stuff %between percentage marks% because that would be interpreted as a macro.

Basically I'm looking for a way to insert a file "binary", without any parsing whatsoever. Suggestions?

kinook
09-20-2011, 12:16 PM
See the vbld_GetFileContents system script function or vbld_EscapeString.
http://www.kinook.com/VisBuildPro/Manual/sysscriptfile.htm
http://www.kinook.com/VisBuildPro/Manual/sysscriptmisc.htm

Rogier
09-20-2011, 03:22 PM
Excellent, thanks!