DITA and XMetaL Discussion

XMetaL Community Forum DITA and XMetaL Discussion launching shell scripts.

  • PlabanGhosh

    launching shell scripts.

    Participants 3
    Replies 4
    Last Activity 10 years, 8 months ago

    Hello Friends .. I was checking the Windows help & support center in XP. In support documents, it contained steps to do certain tasks .. but it also had an option like a macro or shell commnd which could do the intended task.

    Example: It states that the Device manager has to be opened. So the steps are like:

    1. Click Start, and the select Run.
    2. In the Open box, type: devmgmt.msc and then click OK..

    But in line 1, it also had a launcher that would open the Device Manager when clicked.

    I want to know if this option is available in X-metal, and if yes, how to use the option?

    Thanx in advance.


    Derek Read

    Reply to: launching shell scripts.

    Can I assume your question is this?
    “How do I allow my authors, while editing in XMetaL Author, to run an external process?”

    To do this you need to build an MCR file that contains a macro that will instantiate the standard Windows control “WScript.Shell” to run the process you want to run. If you know how to create an MCR file and how to script then all of the answers you need should be in this thread: http://forums.xmetal.com/index.php/topic,1096.0.html

    If you don't know how to build an MCR file then you should read the XMetaL Developer Programmers Guide and Customization Guide.

    What that thread does not discuss is how to connect your macro (script) to a toolbar button or menu item. However, that is basically answered in the XMetaL Developer Programmers Guide and Customization Guide as well, provided you have a look at some of the demo customizations that ship with XMetaL Author Essential or Enterprise. For this particular case I would suggest the DocBook demo.

    If your question is about something else please provide more details.

    If what you are building is going to be used in conjunction with the DITA authoring functionality keep in mind that we generally don't support extending that solution by adding macros of this type. It is very easy to break the customization that makes up the DITA authoring solution by adding additional script code (naming conflicts, problems with event timing, etc). There are specific points in the code you can extend the DITA authoring functionality but they do not include this type of thing.



    Reply to: launching shell scripts.

    Thanks for the reply Derek. Honestly I am a novice with Xmetal author 4.6 which my company uses. I use it primarily to make technical support documents. So what I intednd to do is:

    1. Write support steps in the xml body. (say the steps to open Device Manager.)
    2. Just beside the steps, I intend to place a button, which when clicked will actaully open the Device Manager automatically.

    If you open Help & Support in a Windows computer, and serch for how to open device manager, you will be able to understand what I am looking for.

    Sorry, for not being able to reply in technical terms.


    Derek Read

    Reply to: launching shell scripts.

    I see. What you mean is that you want the functionality you are seeing in the Windows help files to be in your final output, say a CHM, HTML or perhaps a PDF or other type of output?

    I was answering as if you wanted to customize XMetaL Author to provide this functionality while authoring (this type of question is very common as we have many developers on the forum that manage large groups of “authors” and need to give them additional authoring capabilities not built into the product).

    You have not said which document type your are authoring to, but since you have posted in this board, which is about DITA and XMetaL I assume you are authoring DITA documents. Since you have XMetaL Author 4.6 that would also mean you have the (very very old and very simplistic DITA authoring functionality) “XMetaL 4.6 Author DITA Edition” which was an add-on to XMetaL Author 4.6.

    Since I'm guessing a little bit here, I'll break this into two sections for clarity:

    1. You ARE authoring DITA documents:

    DITA it has no standardized way to code this type of thing into the XML markup that the DITA Open Toolkit can use to generate the required code in the output to enable this.

    Here's the strategy I would use to begin working on this:

    1. Pick apart and have a look at the code in a particular output format that has this functionality so you know what needs to be in your output to do the same thing.
    2. Generate output in the same output format and then hand code something similar to what you found in step 1 and test to see that functionality works.
    3. Decide what you will put into your DITA XML to support modifications to the DITA OT that will generate the right code in the output.
    4. Modify the DITA OT to generate the right code.
    Note that 3 and 4 will likely be done at the same time as they feed into each other.
    Also note that you might be able to get away with using a regular DITA either by recognizing the file type that is being referenced and adding code to do that into the DITA OT, or perhaps by adding additional standard markup such as a special value for @outputclass you can use to trigger off of.

    2. You are NOT authoring DITA documents and are using some other schema:

    This means you are probably using a publishing system that does not use the DITA Open Toolkit to generate your output. Check with the people that built this system to see if they can add this functionality for you. You will need to work with them to decide on the markup that needs to be inserted into your XML to support this functionality in the output.


    Derek Read

    Reply to: launching shell scripts.

    A little bit of research shows that (for a CHM file) your HTML needs to contain something like the following:


    Basically, assuming your question was about producing a CHM file, I was pretty much completely wrong in my previous post. Forgive me though, since I was (and still am) making a lot of assumptions here. I've pursued this because the subject seemed interesting. Hopefully this is in fact what you are getting at.

    If you are working with DITA, and you are using the DITA OT to generate output, and your output is CHM, then there is a solution. If any of these things are not true then part of the following might still apply but you would need to adapt it to your schema and the tool that generates your output, assuming it produces CHM.

    If you aren't producing CHM then I need more detail.

    If you are not using DITA or the DITA Open Toolkit to generate output but you are generating CHM then you just need to get whoever built your publishing system to build a similar feature into it so that the right CHM markup is created.

    What I have listed above is pretty much the minimum markup required to launch an app from a CHM. I built it using the wizard included in HTML Help Workshop. Once I found that it was using I realized that the DITA OT can generate that and did some further testing. DITA supports an element andchild elements and when you generate output to HTML-based formats it is basically just passed straight through to the HTML unchanged. So, to generate the output above, all you really need to do is put the right values into the DITA so that it produces the andelements that the CHM needs, and that's easy to figure out since the values are identical.

    See attached DITA topic file. It contains an example of the DITA markup required and an explanation of how to generate a CHM file that will use them to create a button that will launch notepad.exe as a test.

    The file example_chm.gif is a screenshot of the resulting CHM file open in hh.exe (the HTML Help Viewer) with the button circled in red.

    One thing you might need to worry about is the case where Windows can't find your executable using the values listed in its system variables. In that case you might need to provide a full path. Because notepad.exe is usually in the Windows %system% folder Windows can find it if you just specify “notepad.exe” here. This is probably true for anything else that ships with a standard Windows install.


  • You must be logged in to reply to this topic.

Lost Your Password?