Clipboard content match

I'mnoob

Member
Hi, I'm trying to make if else (condition is if the clipboard contents matches the provided url) basically YouTube url.

Is there a format to do this?
I have tried doing it and it's just not working.

I simply pasted YouTube home page url (conditions)
Am I doing something wrong because it never matches the url whenever I copy YouTube video url.

Check the image.
 

Attachments

  • Screenshot_20230214-095634.png
    Screenshot_20230214-095634.png
    141.6 KB · Views: 9

Dimlos

Well-known member
I made a sample macro, although it may not be perfect.
It responds to text beginning with https:// and excludes YT Music.
 

Attachments

  • URL_Check.macro
    2.3 KB · Views: 0

Dimlos

Well-known member
A few words about the macro. In the trigger, I defined the clipboard text to start at https://. I could have completed everything here, but I wanted to use "If" so I excluded "https://music" and defined the clipboard text to include "youtu".

A little ingenuity is required because we need to include the shortened URL "https://youtu.be" in addition to the regular "https://youtube.com".

Regular expressions are used to determine these strings, so regular expression checking is required.

The sample macro will work if you copy the strings to the clipboard, so please try it out. You can also create your own original macro based on this macro.
 

Attachments

  • Triggers.jpg
    Triggers.jpg
    422.4 KB · Views: 7
  • If clause.jpg
    If clause.jpg
    414.9 KB · Views: 7
  • Clipboard Contents.jpg
    Clipboard Contents.jpg
    362.2 KB · Views: 8

Dm114

Well-known member
Hi, I'm trying to make if else (condition is if the clipboard contents matches the provided url) basically YouTube url.

Is there a format to do this?
I have tried doing it and it's just not working.

I simply pasted YouTube home page url (conditions)
Am I doing something wrong because it never matches the url whenever I copy YouTube video url.

Check the image.
To use such a comparison, the "allow regular expressions" box must be UNchecked because the URL you're testing contains characters (such as / and .) with a special meaning in Regex.

With the box unchecked, it should work but, as @Dimlos said, shortened URLs are sometimes used so your test will fail
 
Top