Trying to Replace Text in Copied URL

Hi, I'm trying to work out a way to replace text in a copied URL and send the edited one to the clipboard.

Specifically I'd like to change the last bit of text in a copied URL
https://www.flickr.com/photos/flickruser/52682082178/in/datetaken/
to ...
https://www.flickr.com/photos/flickruser/52682082178/sizes/l/

The text to change is always the same. This would save me several steps in getting the actual URL fo the Flickr image.

But not sure how to do it! This is what I tried, which didn't work!

Any help appreciated.

You can try adding a Pause action of 0.3second after Select Menu action as it may take sometime for copied data to appear in system clipboard.

1 Like

As an option to @macdevign_mac's hard-coded pause, you could use CLIPBOARDSEED() -- an integer which changes every time the clipboard contents change. So you can pause until the clipboard has changed, however long that might be. You'll have to swap the "Comment" action for your Arc "Select Menu Item" one:

Clipboard S'n'R.kmmacros (3.0 KB)

Image

I've added a leading / to both the search and replace terms. It seems a bit redundant to find a character then replace it with itself, but it tightens up your search term to help avoid false positives. You probably won't have a problem without it, but why take the risk?

1 Like

Thanks a lot; that made a difference!

Many thanks for your thoughts on this. I've got so much to learn!

Hey Warrick,

What web browser are you using?

If Chrome-based or Safari then there are text-tokens to acquire the URL that will be faster than copying to the Clipboard.

-Chris