/// <summary> /// IMacrosTest Constructor /// </summary> /// <param name="url">URL</param> /// <param name="initialApp">iMacros.App instance</param> /// <param name="macroDirectory">path to the directory hosting .iim macros to run</param> public ImacrosPlayer(App initialApp, string macroDirectory) { macroDirectoryPath = macroDirectory; filenames = Directory.EnumerateFiles(macroDirectoryPath); imacrosApp = initialApp; //Url = url; // remove? imacrosApp.iimInit(null, true, null, null, null); }
public AcessoImacros(bool ocultaImacros) { iim = new iMacros.App(); int timeout = 90; if (ocultaImacros) { // RODAR MACROS COM IMACROS INVISIVEL iMacros.Status status = iim.iimInit("-silent", true, timeout); instanciaImacros++; } else { iMacros.Status status = iim.iimOpen("", true, timeout); instanciaImacros++; } }
static public Status Run(string content, string fileId) { try { File.WriteAllText("D:/Files/mac" + fileId + ".iim", content); int timeout = 60, errors = 0; iMacros.Status status; var app = new iMacros.App(); status = app.iimInit("-V7", true, "", "", "", timeout); if (status != iMacros.Status.sOk) { errors++; } string macro = "D:/Files/mac" + fileId + ".iim"; status = app.iimDisplay("Interface version =\n" + app.iimGetInterfaceVersion().ToString(), timeout); if (status != Status.sOk) { return(status); } status = app.iimPlay(macro, timeout); if (status != Status.sOk) { return(status); } status = app.iimExit(timeout); if (status != Status.sOk) { return(status); } return(status); } catch (Exception) { throw; } }
void OldCode() { var url = "http://www.google.com/"; var imApp = new iMacros.App(); var iimApp2 = new iMacros.App(); iMacros.Status imStatus; int timeout = 60; imStatus = imApp.iimOpen("", true, timeout); imStatus = imApp.iimPlayCode("URL GOTO=" + url, timeout); imStatus = iimApp2.iimOpen("", true); List<string> extractedData = new List<string>(); for (int i = 1; i <= 5; i++) { imStatus = imApp.iimPlayCode("TAG POS=" + i + " TYPE=SPAN ATTR=CLASS:NAME EXTRACT=TXT", timeout); string data = imApp.iimGetLastExtract(1); extractedData.Add(data); } }