Daniel Rika
Daniel Rika

Reputation: 69

Run javascript inside imacros

I'm making a bot with imacros in the form of a .js file. I make it as a javascript file because it's easier when checking text, looping and errorchecking.

Now the problem gets a little messy. I'm trying to click a button using javascript while proxy is being used. Here is my script:

var imacros = "PROXY ADDRESS = 12.3.4.5:67" + "\n";
imacros += "EVAL(\"document.getElemensByClassName('class_here')[0].click()\")"
iimPlayCode(imacros);

When I try running this, I get error 901. Why don't I just run it as plain javascript, not as "eval"? Because at the moment the imacros script stops running, the proxy is gone. and it wouldn't be clicking that button using a proxy. I've tried, and can't click the button using imacros.

Any help is appreciated. I just want to click that button in javascript while using proxy.

Upvotes: 1

Views: 533

Answers (2)

Paul C Sebesta
Paul C Sebesta

Reputation: 76

You can run external javascript store in local js file your main macro file main.js

var macro = "PROXY ADDRESS=xxx.xxx.xxx.xxx:port\n";
immPlayCode(macro);
loadScriptFromURL('file:///F:/imacros/doauto.js');
do_auto();
function loadScriptFromURL(url) { 
/*
...code to load script from your url ...
for examples visit my website http://wirecellar.com/2FJZ
*/
}

AND file doauto.js:

function do_auto() {/*......*/}

Upvotes: 0

Shugar
Shugar

Reputation: 5299

Try by means of pseudo-URL:

var imacros = "PROXY ADDRESS=12.3.4.5:67" + "\n";
imacros += "URL GOTO=javascript:{document.getElemensByClassName('class_here')[0].click();undefined;}" + "\n";
iimPlayCode(imacros);

Upvotes: 1

Related Questions