$KMVAR not recognized (I think) SOLVED!

Hello All,

I am brand new to KBM but my mind is agog with its potential!

After much reading and searching of topics on this forum I am trying my hand at my first macro. Despite reading the topics I could find and piecing together the attached macro, I cannot create a new folder.

Would anyone be kind enough to point out where I am going wrong? Any help would be appreciated tremendously.

Thanks!
Beem

Create client folders.kmmacros (3.8 KB)

Here are some factors I found that could explain why your macro isn't working as intended:

  1. The macro was in a group that only works when Finder is the frontmost application. This means that even if the macro is flawless, it won't do what you want unless you are actually in Finder when you run it. As the point of a macro like this seems to be the ability to create new folders regardless of what else you're doing, making it part of a global macro group seems like it would work better for your purposes.

  2. The variable you were using for client names was actually called "Variable," and you were using "ClientName" as its default value. This would only have produced a variable called "Variable" whose contents were "ClientName." I believe what you wanted to do was create a variable called "ClientName" and have its contents be the actual client name in question.

  3. While you can of course use a shell script to make a new folder, you don't have to, as KM has a native "make new folder" action, which makes it considerably easier to make use of KM variables and tokens.

  4. You were using a For Each action based on the Finder's current selection, which is both error-prone and unnecessary.

  5. The "Execute Shell Script" action was deactivated, so even if it was working perfectly (though unfortunately, it wouldn't have because it was trying to use a "ClientName" variable that didn't actually exist, since the variable you were actually creating was inadvertently named "Variable") it would never have functioned as intended as long as it was deactivated.

I've gone ahead and edited your macro with the fixes I suggested here, and changed its behavior to open the new folder's parent folder after the new folder has been created rather than before. Try this out and see if it does what you want. And welcome to KBM!

Create client folders 1.0.kmmacros (2.7 KB)

2 Likes

Hi @gglick,

thank you so much for the detailed reply! Some of the points I have covered but I am going to work through each of them and will let you know which one was the solution.

Thanks again!

@gglick, thank you it worked! I really appreciate the time you took to explain it so thoroughly and thank you for the warm welcome. I hope to be able to contribute to this forum as well in future, once I have accumulated your level of expertise.

Lastly, at the risk of pushing my luck: Should I use the same approach if I wish to then add several subfolders to the client folder that was just created?

EDIT: I used the same approach for adding subfolders and it did work. Thank you very much.

Enjoy the rest of your weekend.

2 Likes

Glad I could help, @Beemerang! I was in your exact position years ago when I was first getting started with KM myself and asking the members of the precursor to this forum for help with my own macros, so it’s great to be able to pay that forward now :slight_smile:

Please don’t hesitate to post here again if you have more questions. The less time you spend banging your head against the wall is more time you can save learning how to make more efficient use of your Mac (and of course, use the time saved from that for all sorts of other things). Cheers!

1 Like