Forum Replies Created

  • kschipan

    Reply To: Application.CancelOpenDocument not working

    Participants 0
    Replies 1
    Last Activity 8 years, 9 months ago

    That workaround even works with version 5.5 of XMetaL.
    I just had to put the given macros into a new file within the “StatUp” directory.

    “Please try moving your macros into a new MCR file inside the Startup folder. They should be inside an MCR file that loads after this file: __xmau_services.mcr These files are loaded in alphabetical order, so that file should be loading first (the underscore characters sort higher than “A”). As long as your filename starts with a letter it should load later.” – thank you for that hint, Derek.

    Note: My first try was to use the existing file “Macrosxmetal.mcr”, but I got a “Run-Time Error” message:
    Line 87, Column 4
    Description: The Object doesn't support that property or method.

    Reply

    kschipan

    Reply To: Application.CancelOpenDocument not working

    Participants 0
    Replies 1
    Last Activity 8 years, 10 months ago

    I have faced the same problem and just contacted the XMetaL support.

    I implemented the macro “On_Application_Before_Document_Open” in order to check if the opening file is a ZIP archive: getPlugin.isZipFile(Application.OpenFileName)
    Within our “Plugin” the containing XML files are extracted and opened instead: getPlugin.openSozdokFilesFromZipArchive(Application.OpenFileName)
    This really works fantastic.
    Since an ZIP file cannot be edited itself with XMetaL, I want to stop the process of opening that file: Application.CancelOpenDocument = True
    Unfortunately XMetaL doesn’t  care about this changed property as expected.

    This is my macro code:


                    MsgBox “Sozdok:On_Application_Before_Document_Open:” & Application.OpenFileName & ” Cancel = ” & Application.CancelOpenDocument, , “SozDok Debug”
                   
                    If (getPlugin.isZipFile(Application.OpenFileName)) Then
                                  getPlugin.openSozdokFilesFromZipArchive(Application.OpenFileName)
                                  Application.CancelOpenDocument = True
                    End If                 MsgBox “Sozdok:On_Application_Before_Document_Open:” & Application.OpenFileName & ” Cancel = ” & Application.CancelOpenDocument, , “SozDok Debug”
    ]]>

    I also tried the simple thing: Just stopping each opening – it doesn’t seem to work.

                    MsgBox “Sozdok:On_Application_Before_Document_Open:” & Application.OpenFileName & ” Cancel = ” & Application.CancelOpenDocument, , “SozDok Debug”
                   
                    Application.CancelOpenDocument = True
                   
                    MsgBox “Sozdok:On_Application_Before_Document_Open:” & Application.OpenFileName & ” Cancel = ” & Application.CancelOpenDocument, , “SozDok Debug”
    ]]>

    How can I manage that task?

    Reply

Products
Downloads
Support