!7 sclass YouTubeDownloader extends DynModule { transient JTextArea ta; transient JTextField tfURL, tfDest; transient JButton btnGo; void start { doEvery(1000, r updateMe); } JComponent visualize() { tfURL = jtextfield("https://www.youtube.com/watch?v=YYOKMUTTDdA"); // Full paste componentPopupMenu_clear(tfURL); componentPopupMenuItem(tfURL, "Paste", r { tfURL.selectAll(); tfURL.paste() }); tfDest = jtextfield(desktopDir()); onEnter(tfURL, r go); ret northAndCenterWithMargins( vstackWithSpacing( centerAndEast(withLabel("Video URL to download:", tfURL), withLeftMargin(btnGo = jbutton("Download", r go))), withLabel("Destination directory:", tfDest)), ta = typeWriterTextArea()); } void unvisualize() { ta = null; } void update { if (ta != null) setText(ta, localPrintLog()); } void go { thread "YouTube Download" { temp tempDisableButton(btnGo); installOrUpdateYouTubeDL(); youtubeDownloadVideo(formatYouTubeURL_long(gtt(tfURL)), newFile(gtt(tfDest))); print("Done (possibly)"); } } }