I'm having trouble figuring out how to accomplish something that seems like it should be simple. I want to change 15000000 to 15,000,000 for me. Additionally, I'd like it to check how many digits are in the number, and if there are nine digits, like in the case of 123000000, I would like it to change the number to 123,000,000. Any assistance with this would be greatly appreciated.
@JimmyHartington has the right idea. But unlike him, I am at my computer, so I made a little example to show you how formatting works. You basically just hashtags in place of integers, and whatever formatting you wish, such as comma separators and decimal points. You can even use more hashtags than necessary, as KM will automatically format it according to how many digits the integer has.
Thank you to both of you. All I needed was to set a variable to itself and change the format according to your instructions. It would be great if Keyboard Maestro could allow user input for defining variables. For example, if I enter 49,000,000 for the first value and 23,000,000 for 2nd value in the user input field, I cannot add two values together.
Hi Peter, I appreciate your response; however, I’m afraid that won’t work for me as I’ve always separated money with commas. For now, I’ll set a variable to itself and change the format using pound signs.
Sure! Technically, there’s no such thing as a “debug” variable... there are global, local and instance variables (See the Variables Wiki entry for more info). But global variables are the only kind that persist after a macro has done executing. This is valuable when building, modifying or debugging a macro because it allows you to see the variable’s value even after the macro is done executing, unlike the other two kinds.
However, most of the time, I don’t need to see these variables once the macro is completely built and reliable. Since I, 1) don’t want to see a massive list of variables in my KM preferences window, and 2) global variables seem to slow down macro executions compared to local and instance variables, I like to convert all of my global variables to local or instance once I’ve finished building, modifying or debugging the macro.
But until that time, I sometimes use that AppleScript to delete those debug variables at the end of the macro, particularly when I’m sharing macros on the forum, because I don’t want to clutter up other people’s systems with these global variables. Prepending debug__ to them just makes it easier to make sure I get them all deleted and don’t miss any.
Just saw this part of your comment... no, debug__ variables aren’t deleted automatically, because they’re actually global variables (see the first paragraph of my initial comment).
The whole debug__ part is just something I use to prepend a global variable for easy identification... it’s nothing intrinsic to KM itself. I also use other formats to prepend variables for other purposes... for instance:
for generic variables I want to save permanently, I use DND__ (as do many others here)
For other variables I want to save permanently, but are used for specific cases, I’ll use things like:
LB__ (for my job)
Music__ (for music related things)
Finder__ (for macros that work in Finder only) etc.