General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Override the File> Open menu command

  • wongsk27

    Override the File> Open menu command

    Participants 6
    Replies 7
    Last Activity 13 years, 8 months ago

    Hi all,

    I am currently trying to overwrite the File Open behaviour in XMetaL 5.5 . I would like to
    replace the File > Open menu and create another open menu item to perform some macro functions.

    I have so far successfully removed the Open menu item from the File menu, however, the Ctrl+O
    shortcut behaviour still exist even though the menu item is removed.

    Does anyone know how to overwrite or remove a keyboard shortcut behaviour for builtin menu item in XMetaL?

    Regards

    -Brian

    Reply

    Derek Read

    Reply to: Override the File> Open menu command

    You should be able to override any built-in shortcut by specifying the same shortcut on your own macro. There is a field specifically for this in the Macro editor's properties window. When the resulting MCR file is built it will contain the following:

    [code]…etc…[/code]

    File operation event macros:
    You may be interested in the event macros XMetaL Author provides for overriding the standard file operations. They may be useful here because they avoid the need to remove and recreate menu items. You simply create an event macro with one of these specific names and the corresponding functionality (exposed anywhere in the standard UI) is overridden by your own script. These events include:

    Command    Macro    COM equivalent   
    Open    File_Open    None   
    New (menu item)    File_Open_Template    Documents.OpenTemplate();   
    New.New (toolbar)    File_New    Documents.Add(false);   
    Save    File_Save    ActiveDocument.Save();   
    Save As    File_SaveAs    ActiveDocument.SaveAs();   
    Save All    File_SaveAll    Documents.Save();   
    Close    File_Close    ActiveDocument.Close();   
    Close All    File_CloseAll    Documents.Close();   
    Exit    File_Exit    Application.Quit(0);
       

    See the Programmers Guide topic called “File operations” for details.

    Note that you must define all behaviors you wish to occur including anything that would normally happen by default. So, if you override “Save” you are responsible for saving the document, either using the ActiveDocument.Save() method, or some other means (such as FSO, ADODB Stream, your own control, etc).

    Reply

    Polly Poon

    Reply to: Override the File> Open menu command

    Thanks for the comment.

    I am now able to override the File_Open and File_SaveAs built in macros. However for some reason I cannot override the File_Open_Template and File_New macro. For testing, I have set up 2 macros as follows :

       
      MsgBox "File_Open_Template is called"
       
    ]]>

    and

       
      MsgBox "File_New is called"
       
    ]]>

    I found that, the File_Open_Tempalate and File_New macros were only override when i use the shortcut key. However, when i go through the menu item and the command button, the built-in Macros weren't override. These debug messages didn't popped up at all.

    I have also tried to leave the Key value empty but still didn't work.

    Any ideas?

    Reply

    Derek Read

    Reply to: Override the File> Open menu command

    This sounds likely to be a version-specific limitation. Which version are you running?

    Reply

    Derek Read

    Reply to: Override the File> Open menu command

    OK. I now see that this functionality appears to be broken in XMetaL Author Enterprise 5.5, possibly due to work we've done to support DITA or possibly CMS integrations. If I get some more information I'll try to remember to post it here. We're submitting a defect report with the dev team nonetheless. It might be necessary to wait for a future release before being able to get File_New and File_Open_Template working again, or we may never address this as XMetaL Author Enterprise might not be able to support these.

    The recommended option at this time would be to use XMetaL Essential 5.5 instead of XMetaL Author Enterprise. XMetaL Essential does not include any of the DITA, Reviewer or Connector (CMS integration) functionality and would not suffer from this limitation. If you are not working with DITA and do not require CMS connectivity, nor XMetaL Reviewer support, and do not need the DITA Open Toolkit nor a licensed copy of RenderX XEP installed I would recommend this as the best fix at this time.

    Reply

    Polly Poon

    Reply to: Override the File> Open menu command

    Hi Derek,

    Thank you for your response.

    I have gone to create some Macro to test it on XMetaL Essential to test the File_Open_Template and File_New with my testing Macro.

    The macros works correctly with the short cut keys Ctrl+T and Ctrtl+N. However, the function for the menu button and command bar buttons are still not override.

    Is JustSystems going to provide a patch to enable overriding of File_New and File_Open_Template for the menu and command bar buttons? If so, when do you expect this would be available?

    Thanks,
    Polly

    Reply

    Derek Read

    Reply to: Override the File> Open menu command

    Looks like we missed this (but good news at the end of my long explanation…)

    The idea behind XMetaL Essential was to deliver a “clean slate” version of XMetaL Author without any of the DITA, Reviewer or Connector scripts to get in the way of anything customizers such as yourself are trying to do (basically providing you with a product as similar to our pre-DITA versions as possible —  but with all the benefits of any new APIs and UI functionality added for the 5.x releases). The DITA, Reviewer and Connector functionality is mostly implemented in additional script files added on top of XMetaL Author (basically as app-level customizations). However, we still deliver some supporting scripts that we refer to internally as the “XMDK” (this may one day be fully documented in a similar manner as our other APIs once we've nailed it down entirely). It is one of these that is interfering here.

    I've asked dev to look into correcting this for a future release.

    In the meantime you can tweak this file (if that is an acceptable fix for you):

    C:Program FilesXMetaL 5.5AuthorStartUp__xmau_services.mcr

    Alter this event's name so that it does not fire:

    • Old: "On_Application_Before_Document_New"
    • New: "On_Application_Before_Document_New DISABLED"

    This .mcr file is delivered in an identical form (to keep things standardized) for both Enterprise and Essential. Enterprise uses it to do file redirection at open (to force maps to open in the Map Editor). There are no features in Essential that rely on this macro.

    Reply

    Polly Poon

    Reply to: Override the File> Open menu command

    Hi Derek,

    We have added the “DISABLED” keyword to the On_Application_Before_Document_New macro. It appears that we are now able to override the standard XMetaL macro for creating new files from template.

    We have run into another issue. We have created a customized macro to override the built-in XMetaL SaveAs feature. However our customized macro is not fired at all.

    Any ideas?

    Regards,
    Polly

    Reply

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

Lost Your Password?

Products
Downloads
Support