"download link" { global $g_YoutubeUrl; sub "_Input_Youtube_Url"; global $g_SelectedQuality; sub "_Quality_Picker"; run("youtube-dl -f $g_SelectedQuality $g_YoutubeUrl", "", "0", "1"); } "_Input_Youtube_Url" { global $g_YoutubeUrl; // if clipboard contains valid url use that one if (regexmatches (, "http[s]?://www\.youtube\.com[^ ]+", , 0)){ $g_YoutubeUrl = ; } // otherwise display input dialog else { $g_YoutubeUrl = input ("Youtube.com", "Paste Youtube video URL here:", , s, , 300, 200); } } "_Quality_Picker" { global $g_YoutubeUrl; $ret = runret("youtube-dl -F $g_YoutubeUrl"); $QualityOptions = regexmatches($ret, "^\d[^\n\r]+", "|", "0"); $ret = inputselect("Your options for this video", $QualityOptions, "|", "4"); global $g_SelectedQuality; $g_SelectedQuality = regexmatches($ret, "^\d+", "|", "0"); }