Forum: Poser Python Scripting


Subject: Replace a multiline XML string between two delimiters

HartyBart opened this issue on Sep 08, 2021 ยท 7 posts


HartyBart posted Wed, 08 September 2021 at 8:19 PM

This script is working with Poser 11, and is a Python 2.7 script to replace a string of multiline text between two named delimiters. In this case the delimiters are imaginary XML tags, and the replacement that is being made between them is a multiline block. The script shows how to correctly format this block in Python, so as to replace the existing block without mangling the XML indenting and line-wrapping.

working--replace-between.jpg

Does not appear to work on XML that is live and in use by Poser, as that has probably already been taken up into memory.

Not tested on other types of file, but I expect it may work on various Poser formats that are really only text files and are not actively in use and in-memory inside Poser.



Learn the Secrets of Poser 11 and Line-art Filters.