Hello, Can someone show please, How can I modify text into -> [[^clipboard |text]].
Are you sure that's what you want ?
(It's not an MD link – looks like a wiki link)
and 'file
' ?
(Not quite sure yet what you mean by that)
I use obsidian it is [[^^link| nametoappear]]
So two parts in your wiki-link there:
[[ linkURL | human-legible label ]]
- The link URL you seem to be getting by copying.
- Where is the human-readable label coming from ?
It is the selected text
So you first copy a link,
and then move the selection to text which will be used as a label ?
Yes indeed
So there are really 3 events, and two different selection moves:
- A first copy (for the link)
- A second copy (for the label text)
- A move to a third position, and a paste ?
(Or are you replacing the selected label text with a wikilink ?)
No i am modfying many labels so I cannot copy. Thats why I used applescript first, i googled it.
There are many many files including that label.
The picture is still not very clear to me
Could you show us a before and after example ?
(You are searching for all matching texts and replacing them with a WikiLink based on a URL in the clipboard ?)
Of course my mistake, In obsidian you can make links to blocks if you type ^something, it becomes a key to there. For example i say. RNA is very important to humans. There is a block that i want to link it to. So I convert RNA into [[^^something| Label] . It is double ^ in brackets.
So if you have many RNA in many different files. It is hard to do. So I want to copy ^something. And replace every RNA with [[^^something| RNA]]
So the Keyboard Maestro macro you are looking for aims to:
- search and replace every
givenText
with[[^^linkURL| givenText]]
in the current Obsidian document ? Or - search and replace every
givenText
with[[^^linkURL| givenText]]
across a set of files, perhaps in a given folder ?
For the search and replace you want to make use of the Obsidian menu search+replace ?
Putting aside the question of search and replace, you should be able to assemble a WikiLink of that pattern by doing something along these lines:
Replace selected text with WikiLink to url in clipboard.kmmacros (4.4 KB)
I will try Thank you for your time.
This doesnt work for me. This multiplies text inside, i want to use it many times without copying the first text.
Add a step that sets the System Clipboard to %Variable%localURL%
.