General XMetaL Discussion
amy.kidd September 23, 2013 at 3:07 pm
How to write a macro to batch validate multiple documentsSeptember 23, 2013 at 3:07 pmParticipants 4Replies 5Last Activity 9 years, 4 months ago
I'm using XMetaL Author Enterprise 7.0.
I know I can validate one document at a time by pressing F9 with my document open.
I'd love to be able to validate all the documetns in a directory using the Cross-File Operation. Alternately, I'd like to use a new macro that runs F9 validate function on all my documents at once and produce a log file. I want to do this without publishing the document. Xmetal is almost there with the validate links Cross-File Operation, but I'd like to just validate the XML.
Can you point me in the right direction?
Many Thanks!Derek Read September 24, 2013 at 10:05 pm
Reply to: How to write a macro to batch validate multiple documentsSeptember 24, 2013 at 10:05 pm
This functionality is still experimental for implementing your own scripts but I'm attaching a demo that may give you what you are looking for.
To try it out unzip the file I'm attaching and place ValidateDocuments.js into the subfolder in your XMetaL Author Essential or XMetaL Author Enterprise installation here:
C:Program FilesXMetaL 7.0AuthorXMDKMFOServiceservicecustomScripts
– or –
C:Program FilesXMetaL 8.0AuthorXMDKMFOServiceservicecustomScripts
You will need to restart XMetaL Author to have it load. A new Cross-File Operation will then be available named “Validate Documents”.
I've tested this with XMetaL Author Enterprise 8.0.1.041. Please let me know if there are issues with your version.
We've taken a guess at what you want to display in the Results panel. Please provide feedback.amy.kidd October 4, 2013 at 1:05 pm
Reply to: How to write a macro to batch validate multiple documentsOctober 4, 2013 at 1:05 pm
Thank you so very much for sharing this script!
On Xmetal 7.0, it appears to only work for files with the .xml extension. It did let me know one file in my test directory did not validate (that was correct).
However, I mostly use files with the .dita extension. Can the script be fixed easily with a simple change into recognize .dita files as the same as .xml files?
Also, I did try it in a Xmetal 8 trial version and it seems to process all the files with dita or xml extension, but it says they are all correct but I have one file I know has an error in it.
That might simply be a result of my not setting something up correctly with my custom DTDs.
Nevertheless, I only need it for Xmetal 7 at this point.
Thanks Again!amy.kidd October 4, 2013 at 3:24 pm
Reply to: How to write a macro to batch validate multiple documentsOctober 4, 2013 at 3:24 pm
After running other cross file operations and using the spell-check in files feature in XMetaL Author 7.0 Enterprise Edition and XMetaL Author 8.0 (trial version), it appears that in my version of Xmetal 7.0, none of the cross file operations recognize the files with the .dita file extension. XMetal 8.0, however, does recognize the .dita files.
Is there anything I can change in the Xmetal Author 7.0 settings currently to make this work for me now?Derek Read October 4, 2013 at 10:36 pm
Reply to: How to write a macro to batch validate multiple documentsOctober 4, 2013 at 10:36 pm
In 7.0 do this:
2. Select “Multiple File Operation Services”.
3. Click “Extended Info”.
4. Check to see that “dita” is listed (it should be if this is XMetaL Author Enterprise).
5. Click “Done”.
The dialog populates itself with “dita” as a filetype to search, but the default configuration file used by the cross files operations did not include it. When you click “Done” the dialog writes out a new copy of the config file used by the CFO feature. You can add other file types here as well.amy.kidd October 9, 2013 at 6:08 pm
Reply to: How to write a macro to batch validate multiple documentsOctober 9, 2013 at 6:08 pm
IMPORTANT! When you view/update the list of file extensions in the Multiple-File Operation Preferences, ensure the list ends with a file extension and not a semicolon.
For example, my default settings were as follows:
As a result of this setting, the multiple-file operations were not recognizing my files with a .dita extension.
I changed the settings to this:
When I removed the ending semicolon, and restarted Xmetal (just for good measure), it works like a charm.
- You must be logged in to reply to this topic.