Problem with "on Save" macro

Problem with "on Save" macro

5
NewbieNewbie
5

    Jan 01, 2006#1

    Hi all,

    I have a little problem:
    I have a macro that modifies a file ... Whe I run the macro normally (CTRL-M) all works fine.
    Now I set this macro to "on Save" (Macro/macro to load and save file..., sorry, I have the german version) and nothing happens when I save the file.

    I think, the problem ist the "IfExtIs" command... without this, the macro works on save...
    But I don't want it on all files, only on .php....

    Here ist the macro:
    InsertMode
    ColumnModeOff
    HexOff
    UnixReOff
    IfExtIs "php"
    PlayMacro 1 "onSave php"
    EndIf
    cu

    Frank

    6,675585
    Grand MasterGrand Master
    6,675585

      Jan 01, 2006#2

      Have you tried to put the macro command IfExtIs "php" with it's EndIf inside the real macro "onSave php" and specify the onSave macro as macro for running on each save?

      Of course your method should also work and the IfExtIs command is according to help also the prefered method for running the macro only on certain files on each save.

      Do you have also a macro file specified for auto load and is this macro file a different file as the macro file with the macros for each load and save operation?
      That could be a problem, but I have not tested it.

      Note: All macros which should run on file load and save must be in the same macro file!

      Last tip: If possible avoid spaces in names (always and anywhere). Use the underscore character. The space is here not the problem, but nevertheless it should be avoided in names.
      Best regards from an UC/UE/UES for Windows user from Austria

      5
      NewbieNewbie
      5

        Jan 01, 2006#3

        Hi Mofi,

        I have this already tested. When I eliminate the IfExtIs then the ato Save works. When I insert this, nothing happens....
        I have no auotoLoad-Macros defined.

        cu
        Frank
        cu
        Frank

        6,675585
        Grand MasterGrand Master
        6,675585

          Jan 01, 2006#4

          Open again the dialog where to specify the macro to run on save.

          Check if the # of Times to run the macro on save has the value 1. If the value is 0, the macro is not executed on save.

          I have tested now the IfExtIs command in the macro for save and it works perfectly with v11.20a.
          Best regards from an UC/UE/UES for Windows user from Austria

          5
          NewbieNewbie
          5

            Jan 01, 2006#5

            Hi Mofi,

            # of Times is 1 !!

            ooops, I have 11.00b+

            Must check with 11.20a.

              Jan 01, 2006#6

              I have it !!

              The PlayMacro works not, If in "onSave" macros :cry:

              I have the IfExtIs now in the macro, that I call on Save, and it works, but all PlayMacro-commands are ignored :x
              cu
              Frank

              6,675585
              Grand MasterGrand Master
              6,675585

                Re: Problem with

                Jan 01, 2006#7

                Maybe PlayMacro does not work, because only the macro defined for execution on save is loaded from the macro file and the other macros not. So the PlayMacro command fails because the other macros are not available. You have to ask IDM support by email to clarify this. I think, they have done it with this method (only the macro specified is loaded and executed) to avoid conflicts with existing macros recorded at current UltraEdit session or loaded via auto load.

                As workaround, you could set this macro file as auto load. Then all macros from within the macro file are available and maybe the PlayMacro command then works.
                Best regards from an UC/UE/UES for Windows user from Austria

                5
                NewbieNewbie
                5

                  Jan 01, 2006#8

                  Hi Mofi,

                  the macro-file is on auto-load...
                  cu
                  Frank

                  6,675585
                  Grand MasterGrand Master
                  6,675585

                    Jan 04, 2006#9

                    Yes, you are right. The PlayMacro command simply does not work during macro execution for file open or save. Either this is an undocumented restriction of the PlayMacro command or a bug of UltraEdit. Ask IDM support by email.

                    If possible (i.e. no nested loops) try to put all codes of the macros to a single macro.

                    Perhaps as workaround it would be better to assign CTRL+S or an other hot key to the onSave macro, set the macro file with the macros to auto load and use always this hot key to save php files.
                    Best regards from an UC/UE/UES for Windows user from Austria