I have a macro I'm launching via javascript on the click of a button.
version 1
Code: Select all
var macroSource = {
'thing1': 'URL GOTO=https://localhost/thing1',
'thing1': 'URL GOTO=https://localhost/thing12,
}
function fillForm(thing) {
try {
var macro = {};
macro.source = macroSource[thing];
macro.name = 'Fill Form for thing ' + thing;
var evt = document.createEvent("CustomEvent");
evt.initCustomEvent("iMacrosRunMacro", true, true, macro);
window.dispatchEvent(evt);
} catch(e) {
alert('iMacros Bookmarklet error: '+e.toString());
}
}
I tried version 2
Code: Select all
function fillTIForm(thing) {
try {
var macro = {};
macro.source = macroSource[thing];
macro.name = 'Fill Form for thing ' + thing;
new_window = window.open("", "_blank");
var evt = new_window.document.createEvent("CustomEvent");
evt.initCustomEvent("iMacrosRunMacro", true, true, macro);
new_window.dispatchEvent(evt);
} catch(e) {
alert('iMacros Bookmarklet error: '+e.toString());
}
}
Possibly related to this post by ghundermark.