Copy folder between devices, and add date/time stamp

Then you have typed the wrong quotes manually, I guess.

In general, when writing scripts/code you always use straight, typewriter quotes ('', ""), never the quotes you use in prose (‘’, “”).

1 Like

I did some tests with size 72 font. When I insert one quote, it is straight. As soon as I type another quote or a space, the quote automatically converts to normal (aka typographic) single quotes, which suggests that it is some kind of automatic correction in my system. I will look into it. thanks again.

I found the solution and tested it. It works.
Thank you for finding the problem: it was certainly not obvious !
Below is the solution in system preferences.
If using textedit, you have to change the preferences.

Are you saying, with the smart things enabled in the Preference Pane, but disabled in KM Editor’s Edit menu > Substitutions, you are getting “smart” quotes in KM Editor?

1 Like

I did some tests.
You are right, but there is another problem.
I system pref - keyboard - text - quote are checked , and disabled in KM Editor’s Edit menu > Substitutions are UNchecked, you are right, quotes are straight.
The problem is that as far as I understand, the KM Editor’s Edit menu > Substitutions resets itself for each macro. It’s as if KM Editor’s Edit menu > Substitutions has to be unchecked every time I create a macro, which is strange. When I click on other macros in my library the substitutions are checked (quotes and smart paste).

That is correct.

Each time you enter the field, the setting of the Edit ➤ Substitutions ➤ Smart Quotes is set, by the system, to whatever your system preference is. You can turn it on or off, but only for as long as you stay in that field.

Note that scripts are forced to have this setting off. But you are not in a script action field, you are in the Set Variable to Text action field, and so it honours your system preference.

This seems like the correct behaviour (well, IMHO, the correct behaviour would be to never have any Smart stuff turned on, but given that it is system supported and at the user’s control, it is not something that it is appropriate for Keyboard Maestro to override).

1 Like

Hello Peter,
Thank you for your answer.
If I understand correctly, if I uncheck smart quotes in system pref, KBM will uncheck smart quotes for any new macro I edit ? For the older macros, the quotes are set to what system pref were at the time ?

While Smart Quotes can be disabled systemwide, this is not true for Smart Copy/Paste – as far as I know.

This means, when you add a new action in KM Smart Copy/Paste is always enabled (except for script actions).

####This can have nasty side effects:

1⁠. Let’s say, you have this:

2⁠. Now you decide to change the variable name:

3⁠. You now double-click the variable name and press ⌘C:

4⁠. You select the old variable name in the second action and press ⌘V:

You’ll get this:

Smart Copy/Paste has added a space :open_mouth:, because it sees the % as word boundary or something like that.

The variable will work nevertheless, because KM is generously gobbling that space. But it isn’t nice to have spaces in the variable name.
(And if you use the abbreviated form – just %varName%, without the %Variable% part – it won’t work with a space in it.)

####To avoid this, you can do either of two things:

A. Disabling Smart Copy/Paste for each new action again (File > Substitutions > uncheck Smart Copy/Paste), or…

B. Not selecting the name by double-clicking. Instead of double-clicking place the cursor in the field and press ⌘A, then copy:

(Alternatively you can select the word by dragging the cursor over the whole word with the left mouse button down.)

If you select like this (⌘A or dragging) Smart Copy/Paste will not kick in and you won’t get the spurious space when pasting.

Already 10 years ago Gruber has written a nice article about that: When ‘Smart’ Cut/Copy/Paste Attacks.

1 Like

No. If you uncheck smart quotes in the system prefs, then the system will uncheck smart quotes in Keyboard Maestro for each field you enter.

Any smart quotes you have in existing macros will be unaffected, but any editing that adds quotes will not smart-ify them.

1 Like

very interesting. thank you.