Highlighted

Find and Replace Operations on .dita files

Explorer ,
Mar 16, 2018

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

TOPICS
Scripting

Views

233

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Find and Replace Operations on .dita files

Explorer ,
Mar 16, 2018

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

TOPICS
Scripting

Views

234

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 16, 2018 0
Advocate ,
Mar 16, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 16, 2018 0
Explorer ,
Mar 16, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 16, 2018 0
Adobe Community Professional ,
Mar 16, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 16, 2018 0
Explorer ,
Mar 19, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 19, 2018 0
Adobe Community Professional ,
Mar 19, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 19, 2018 0