Copy link to clipboard
Copied
Hi All,
I am new to scripting.
But I would have dita maps that point to an absolute destination for each of the xml and dita files and I would like to change these to relative addressing.
I figure that a script might be the right way to do this.
Any alternate suggestions are welcome.
Appreciate it,
Myko
Thanks Jang,
I have to confess that since I put this question in writing I remembered that I had "GrepWin" on my pc and when I tried it it was able to find and replace the text in all the dita files in the present folder and sub-folders in one go. Now I can port it to my local drive and operate without any trouble... as yet.
Myko
Copy link to clipboard
Copied
Hello Myko,
If you have DITA maps you should look into XSLT. That will be much easier than scripting. You could even load the map in FrameMaker XML view and do a search and replace there if the pattern you are replacing is easy enough. In the XML view you can also run an XSLT.
Jang
Copy link to clipboard
Copied
Thanks Jang,
I have to confess that since I put this question in writing I remembered that I had "GrepWin" on my pc and when I tried it it was able to find and replace the text in all the dita files in the present folder and sub-folders in one go. Now I can port it to my local drive and operate without any trouble... as yet.
Myko
Copy link to clipboard
Copied
ExtendScript has a File object and Regular Expressions so you could do this within FrameMaker as well if it is more convenient.
Copy link to clipboard
Copied
Hi Frameexpert,
I do remember that you and I had a conversation where you said we could make a a script for this function. I would still like to learn how to do that. If it is simple enough would you be willing to post it here?
Thanks,
Mike
Copy link to clipboard
Copied
Hi Mike, I am busy with production work so I can't do this for free. I would suggest that you look at the documentation (Help > JavaScript Tools Guide CC) and look at the File System Access chapter. Basically, you want to read the file into a string and then apply the regular expression to update the paths. Then you write the string back to the file. -Rick