Variable Naming Conventions?

Great question!

I too like to use naming conventions.
Here is what I do:

  • Local
  • No special convention
  • just name to reflect usage
  • All "local" variables are deleted at end of macro (see my macro below)
  • Global
  • The only sense of "global" is have is if I need to reuse the contents of a variable in either another execution of the same macro, or by other macros
  • For these variables, I use a prefix of "DND__", meaning "Do Not Delete".
  • But you could just was well use "g__" for Global.
  • There are two underscores at the end of the prefix. This is so that if I use it in a "Prompt for Input" Action, the prefix does NOT show in the label.
  • But if you want to specify use for a particular macro (or set of macros), then you could use a prefix that denotes that macro.
    • For example, suppose I have a macro that uses an author list for scripts I clip. I might name the author selection list "SCPT__Author_List"
  • Parameters
  • Not using anything special now (maybe I should)
  • The "parameter" variable is deleted at the end of the main macro
  • IF I did have a prefix, it would be "p__", again with two underscores at the end.
  • Since you can pass a parameter with KM7, you may not need a special parameter variable.
    .

I use this sub-macro at the end of my main macro to delete all variables:

I also have posted this macro to "clean out" your current, not needed, variables:

Good luck, and please feel free to provide any feedback on my thoughts, as well as to post your final decision on naming conventions.