okn
March 5, 2025, 9:16pm
1
Similarly to getting the browser URL and Path, I'm looking for a macro for a TextEdit/ BBEdit file which is foremost to get its name and the path.
In KM there is ”Get File Name to Variable "VarName"” not much more.
The intention is write a list from the foremost active text file window into another file.
Here you go:
TextEdit - Get Title and Path.kmmacros (43 KB)
Macro screenshot
1 Like
okn
March 5, 2025, 10:02pm
3
This is fantastic!
Now I only set the results to ”Insert text by pasting”
and chose the file where to put the results,
but how does one get the variable results into a specific file, which action?
/okn
Airy
March 5, 2025, 10:08pm
4
I'm not sure I understand the question, but if you want to add the contents of a variable to the end of a file, use this action:
Just use the correct variable name and the correct file name in the correct boxes.
1 Like
Here's what you asked for, but it's always a good idea to state your ultimate aim in order to avoid XY Problems .
TextEdit - Write Title and Path to File.kmmacros (43 KB)
Macro screenshot
1 Like
Airy
March 6, 2025, 12:33am
6
A few days ago people were asking me what good the LineFeed token was, and you have just provided a good example.
1 Like
okn
March 6, 2025, 8:44am
7
Works perfectly and looks good, too
(At first I thought to add a \n with a line -- Local__FilePath =
Local__FileName =
Local__FilePath =
Local__FileName =
Local__FilePath =
Local__FileName =
)
and this happened even here on the forum page!
I don't want to do any alternation sLocal__FilePath =
Local__FileName =
to the macro. I only wan tLocal__FilePath =
Local__FileName =
to know what the LineFeed does.
In the Wiki only:
Local__FilePath =
Local__FileName =
Sorry, is there a question in there somewhere?
1 Like
okn
March 6, 2025, 9:05am
9
Also sorry, something weird is happening here.
I thought it has to do with a snippet from a snippet App where when I type L, IN, allÅÅ then these things appear almost anywhere thought it has to do with the line feed thing. New paragraph when I press the back button, the delete button these weird things are written automatically not by myself.
No, I pressed the back button:Local__FilePath =
/Users/okn/Library/Mobile Documents/com~apple~TextEdit/Documents/Untitled 3.rtf
Local__FileName =
Untitled 3 and that's what I get. I don't know where it comes from.
I cannot use the back button in any text app anymore,
okn:
"it" has to do
What has to do ?
What is the topic here ?
What is the problem that you are trying to solve ?
1 Like
okn
March 6, 2025, 9:20am
11
The problem is that I must not press the back or delete key otherwise I get this thing above there - in the image.
It started when I wanted to ADD at the end of the macro after line feed a \n then a line with dashes, as so - - - - - ,
which I have as a snippet in a snippet app. This snippet has been deactivated and I also quit the Karabiner app. A reboot now. (did not help)
In the image, this is what I get when I press the delete button.
okn
March 6, 2025, 9:27am
12
Still happening after a reboot.
I dont have a delete button anymore.
okn
March 6, 2025, 9:35am
13
Disabled all steps in the Macro, quit Karabiner.
No success.
(The reverse delete key is ok).
Have you inadvertently set a macro trigger as the backspace key?
1 Like
okn
March 6, 2025, 9:44am
15
No, still the original CTRL - OPT - F8
okn
March 6, 2025, 10:18am
16
okn:
It started when I wanted to ADD at the end of the macro after line feed a \n then a line with dashes, as so - - - - - ,
which I have as a snippet in a snippet app.
and this snippet is expanded with the letters: linå .
The 1st three letters are l i n , if this can be the cause?
okn
March 6, 2025, 12:06pm
17
= : SOLVED!
The original macro (TextEdit - Get Title and Path) was still on the computer and it had as trigger the DELETE key.
Sorry for all the trouble!
Relieved that I have the Delete key back!
Thanks to everyone who helped, esp. @noisneil and @ComplexPoint !