Pass a file to read, write, or search and replace actions

The read, write, and search and replace actions appear to require a static file path. Is there a way to pass the file specification to the action from a select file prompt?

Certainly. See this sample macro for details, but essentially, you need to set the path of a selected file to a variable, then use that variable in the read/write/search-and-replace action you want to use.

1 Like

Thanks, I tried it on a whim first, then saw your confirmation. I was looking for token triangles such as those in actions such as Prompt for User Input, etc. Maybe I would make that a feature request.

1 Like

Almost every action text field accepts tokens (and numeric fields accept calculations).

When you click in the field, the [T] badge shows up to indicate tokens are accepted.

But not every field can have a popup menu, it would be too cluttered.

You can use Type Completion or Edit ➤ Insert Token menus.

Maybe so, but I think it might be helpful for the [T] badge to appear wherever a token does, including the text field.

The T badge appears in the text field whenever you are editing it. To appear in all fields all the time would be too much noise.

I initially failed to grasp the meaning of the badge, thinking that it was a widget, and trying to make it do something. What about making the badge appear while the cursor is over the token text as part of a pop-up help system which could be turned on and off so that novices are better able to observe that the badge is associated with tokens?

If I ever figure out how to do that, I’ll do it.

Perhaps after you've used KM for just a bit, it will make more sense. :wink:

As @peternlewis said:

So really, we don't much need any indicator. If it is TEXT field, then you can use a TOKEN.

Well, certainly that's true, but it's just that I keep asking myself why I've spent as much time in it as I have without more of it making better sense to me. Twenty years with QuicKeys, five alongside Keyboard Maestro, may be part of the answer. Part of it may be like the Emo Philips joke about getting older and how being forgetful isn't always bad because if you go to the kitchen to make coffee, then discover you've already made some, it's sort of like having a butler. But some of it is because this little token badge thing appears without anything to relate it to in the interface. I even wondered if seeing it next to the Token item in the Edit menu might help.

I suspect it's a big part. Keyboard Maestro operates very differently to Quickeys. People coming from Quickeys seem to have a lot of trouble adjusting, most trouble than folks starting fresh.

Maybe. As @JMichaelTX noted, it's general easy: just assume all text fields are token fields, and all numeric fields are calculation fields, and you'll rarely be wrong. The badge is just an extra confirmation.

The primary exception is triggers - triggers don't do any evaluation since the values can change over time which is not helpful for a trigger to be effective, consistent and efficient.