Create new file in current Finder location

Hi all,

I'm trying to find/modify a script that allows me to create a new file (docx, txt, xlsx, etc) quickly at the
location I'm currently working on (Like the app Easy New Files).

I found this script which does exactly what I was looking for:

Although it works, every time I run it, it required my authentication either with my password, touchID, or apple watch, which adds additional friction to the process. I'm curious if this is hardwired, or is there a way that I can disable it.

Thanks all!

I just tried the same macro. It doesn't ask me for permissions. I'm guessing that this is a permissions issue for the folder you are trying to write to. Are you able to copy new files manually from a Terminal window into the same folder? Try that out. I have a hunch that may not work either, which means we know what the problem is. As for a solution, I'm not sure yet.

You're right, I tried it in another folder and it worked without authorisation.
It seems authorisation is only required when using this macro to create files on the desktop. I wonder why is that.

Try creating a file from the Terminal into that folder. If you get an error, you will narrow the problem even further. In that case, the problem occurs outside of your macro, and that will make it easier to understand or fix.

hmmm, I just tried mkdir to create a folder on my Desktop with terminal. It didn't ask for authentication, so does it mean it is an issue with the macro?

update: Just tried to copy a file from the templates folder to my desktop with cp, didn't ask for authorisation either.

This is what pops up (Just tried clicking cancel, the macro still worked, weird:
Screenshot 2023-11-08 at 01.55.23@2x

What we must do is check that your test is identical to what the KM macro is doing. I'm not yet convinced you tested the right thing.

Therefore what I think you should do is insert a Breakpoint action just before the statement that fails.

Then run your macro, and the Debugger will pop up just before you reach the statement that gives you the error. Then you can examine the statement that fails, including any variables that it's going to use in its execution. Once you collect that information, you can be certain that your test with Terminal will be a perfect equivalent to the action.

Do you know how to examine variables using the Debugger? There's a small X in the debugger window that you have to press, if you haven't already pressed it.