public void OnPageLoaded(IEController controller, string url) { foreach (var scriptIndex in ScriptIndexes) { if (url.StartsWith(scriptIndex.Item2)) { var filePath = $"./Macro/Scripts/{scriptIndex.Item1}"; if (!File.Exists(filePath)) { Console.WriteLine($"스크립트 파일이 없습니다: {filePath}"); continue; } var js = string.Empty; foreach (var line in File.ReadAllLines(filePath)) { var l = line.Trim() + ' '; if (l.Contains("//")) { // '//'주석 처리 코드 l = StringFunction.before(l, "//"); } js += l; } Console.WriteLine($"Run Script:\n\t{js}"); controller.RunScript(js); } } }
public void OnPageLoaded(IEController controller, string url) { if (!url.StartsWith("http://www.af.mil/user/boardList.action?command=view")) { return; } try { foreach (var line in Headers) { if (string.IsNullOrEmpty(line)) { continue; } var s = $"document.getElementsById('divView').outerHTML = document.getElementsById('divView').outerHTML.replaceAll('{line.Trim()}', '');"; controller.RunScript(s); } } catch (Exception ex) { Console.WriteLine($"document 조작에러: {ex.ToString()}"); } }