REORDER: Subroutine Parameters

Although I don't do this task often, this macro is really helpful when needed. Thank you!


@noisneil noted above...

Changes to the order of a subroutine's input parameters will also change their order in any existing subroutine callers. Be sure to update these callers so that their parameters and values correspond.

To address this issue, I created two macros that can be used after using Reorder Subroutine Parameters:

Download: After Reorder Update Execute a Subroutine action.kmmacros (77 KB)

Usage:

  1. Navigate to a calling macro.
  2. Select the corresponding Execute a Subroutine action.
  3. Trigger this macro. The selected action will not be changed; instead a new Execute a Subroutine action, with parameter values correspondingly reordered, will be inserted immediately above the selected action.
  4. After confirming that the new action is as expected, manually delete the original Execute a Subroutine action.
  5. Repeat this process for all calls to the reordered subroutine.

Download: Purge Subroutine Reorder Information.kmmacros (73 KB)

Usage:

After addressing all callers, trigger this macro. A dialog like the following will appear.

Use the Purge checkbox to delete any reorder information that no longer needed.


If you'd like to test the reorder process, here's a file that contains two subroutine macros (Sub_Example1; Sub_Example2) and two callers (Sub_Example1 𝘤𝘢𝘭𝘭𝘦𝘳; Sub_Example2 𝘤𝘢𝘭𝘭𝘦𝘳) .

Examples.kmmacros (117.8 KB)


IMPORTANT NOTE

The latest version of Reorder Subroutine Parameters is required; it saves the reorder information in a dictionary that is used in the two macros above.

2 Likes