This macro hopefully helps someone new of how to have a referenced for a file path that may change as you move the location. I have hundreds of dropbox paths and over the years the path has had to change and it has been tedious changing all the paths of those macros. You can reference them with a single macro. I have chosen not to make it a Local or Instance Variable so that if I don't include the reference it still works as long as the path has been changed once.
The second part of this macro I had to make so when I am on Dropbox on my laptop since it is running a beta version of MacOS it will not stick in the new Apple Storage location but instead in the user. I can press a keyboard shortcut and have it update the path to the computer I am on.
Very nice, and yes, variables for paths are great timesavers. Here are a couple suggestions for your macro:
You can use tokens to automate the path based on which Mac you're using. There are a number that could work, depending on what you want to do. As one example, %MacName% returns the current Mac's name.
Tokens are incredibly useful, as they can return a lot of information you'd otherwise have to go find and dig out yourself. If you don't like using the name of the Mac, there are tokens for the Mac's UUID or its IP address, too.
Whatever you use, put your code into a Case action, based on the Mac name, something like this:
You can then set the macro to have a trigger "at engine launch," and it will run when the Keyboard Maestro engine launches (typically at login), or you can run it manually.
You've doubled-up on your "Switch/Case" action. You only need to "Switch" once -- you put the various options in as "Case"s:
It doesn't (this time, but see below) change how the macro works but it's a bit more efficient and, importantly, a lot easier to understand.
The way you've written it works because your cases are mutually exclusive. If they weren't you will get confusing results. The "Switch/Case" action ends on first match, working down the list, so is often used like this:
...so a score of 80 will fail the first case, match the second, end end there with Local_grade set to B -- the third and fourth cases are never reached.
Splitting them as you have done would result in every Local_grade being either C or U (depending on how you handle scores less than 50), even when Local_score is 100, because each "Switch" would happen regardless of what had happened earlier.
With an "either/or" like this you are better using an "If... Then... Else" action. The logic is more obvious and, less importantly in these days of personal supercomputers, only a single test means it's more efficient.
Thank you that is very helpful, I was actually thinking about that today that there has got to be a way to bypass the dialog and return something unique about each computer like if path exists or something. I really need to dive into tokens and explore those more. Thanks for the link and picture as an example.
I couldn't quite replicate that and find what macro that was it kind of looked like Assert that Conditions are Met macro. I got it with this though and it works great, so thank you! Of course only works if you have two computers.
There are many things I would have done different knowing this and not used only on this computer and tweaked as needed, so thank you for that tip!
Thanks for the example and tip, wild how many variables you can put in things to get the results you want. I finally just dived into a couple courses of RegEx and was going to start using that to filter things I was after, this look very handy and my mind feels like it is going burst knowing what the best solution is for so many problems but at least there are multiple solutions with good, better, best.