Grab URL from .webloc file?

I'd like to create a macro that grabs the URL from a .webloc file selected in Finder, and then saves that URL to a variable.

Is there a way to do this? Perhaps it requires a script?

This could be improved... but might be all you need?

1 Like

and I think you should also be able to write something like this:

Webloc URLs selected in Finder.kmmacros (3.1 KB)


Expand disclosure triangle to view JS source
return Application("Finder")
.selection()
.flatMap(
    x => "Web internet location" === x.kind()
        ? [x.location()]
        : []
)
.join("\n");

1 Like

Thank you, @kevinb and @ComplexPoint! :pray:t3:

1 Like