06-21-2023, 06:31 PM
Maybe the script sometimes gets some old text from the clipboard. Try to clear the clipboard and wait for clipboard text.
// script ""
var w = wnd.find(1, "Edvard Grieg Утро (сюита \"Пер Гюнт\") Sheet Music Downloads - Personal - Microsoft Edge", "Chrome_WidgetWin_1");
var button = w.Elm["web:LINK", "DOWNLOAD FILE"].Wait(0);
100.ms();
button.SendKeys("Apps");
var w2 = wnd.find(5, "", "Chrome_WidgetWin_?", "msedge.exe", contains: "Save link as");
var save = w2.Elm["MENUITEM", "Copy link"].Find(3);
clipboard.clear();
save.Invoke();
var link = wait.forCondition(3, () => clipboard.text);
print.it(link); //https://notes-box.com/upload/iblock/967/8tqmaf3zxf8ttfnnrk1oyj1z1k6oqjj1/%D0%AD%D0%B4%D0%B2%D0%B0%D1%80%D0%B4-%D0%93%D1%80%D0%B8%D0%B3-Edvard-Grieg-%D0%A3%D1%82%D1%80%D0%BE.pdf
var name = System.Net.WebUtility.UrlDecode(pathname.getName(link));
print.it(name); //Эдвард-Григ-Edvard-Grieg-Утро.pdf