Want to improve macro to insert Safari Title as URL Link

I wrote a macro which inserts frontmost Safari Window name as a clickable link. It works but is a bit clunky. I was wondering if there is a more elegant way of getting to the same result such as a script.

thank you

insert Safari Title as URL Link.kmmacros (3.1 KB)

In which app do you want to insert it?

1 Like

into Evernote, but I would also like to be able to do it generically, applicable to all (most apps).
thank you Tom.
I am used to inserting the Title and URL below which is quite ugly. The title as a clicklable link is esthetically much nicer.

OK, try this:

Untitled-pty-fs8
Multi-Formatted Links from Safari URL:Title.kmmacros (5.6 KB)


You can choose from three link formats:

24-pty-fs8

Result (all three together):

41-pty-fs8

2 Likes

Fanatastic Tom ! Thank you so much !!

I made a Chrome version which works perfectly.

I used this macro to insert a URL link of this discussion at the top of this macro . It is extremely useful

Thank you for all your work including the macro, explanations and the testing. It is a lot of work !

Your macro is perfect. I have a general question concerning KBM prompt for input.

I am not asking you to make changes. It is for my education.

Let's say that I wanted to

1- start the macro by displaying the message:
What format do you want ?
Press H for HTML, R for RTF and M for Markdown

2- then I would create a series of Switch Case actions with conditions, the actions being identical to your macro.

  • if pressed H → list actions for HTML format
  • if pressed M → actions for Markdown format
  • if pressed R → actions for RTF format

My question is:
is there such a thing in KBM actions to prompt for user input of key presses ? The only one I know is pause until keypress which is not useful here. I understand that a drop down list is an indirect use of keypress. I would just like to know if there are other prompt for keypress methods without the drop down list and without having to click the OK button.

After thinking of it, I think the best – and natural – trigger for this macro are typed strings. Simply because when you are going to insert a link you are most likely already in a text field of an app.

Here with Typed String triggers, the rest is the same:

Untitled-pty-fs8
Multi-Formatted Links from Safari URL:Title (Typed String Trigger).kmmacros (5.2 KB)

Mnemonics:

  • ;ilh ‘insert link html’
  • ;ilm ‘insert link markdown’
  • ;ilr ‘insert link rtf’
2 Likes

And, to answer your question:

I am pretty sure I saw a thread about this recently. With a solution by @JMichaelTX, IIRC. But I’m unable to find it, at the moment.

1 Like

thanks very much, Tom !

great idea ! better than yet one other shortcut. thanks very much, Tom !