Reputation: 1
I'm trying to create a batch file to start a .js file (tom.js) on imacros (firefox browser) at a specific time. The most simple solution seams to be:
C:\Program Files (x86)\Mozilla Firefox\> start firefox.exe imacros://run/?m=TOM.js
Then I will use windows task scheduler to run the .bat file at a specific time..
Problem: This line C:\Program Files (x86)\Mozilla Firefox\
start firefox.exe
actually opens a new window of firefox, then runs the tom.js file.
I would like the .bat file to run tom.js file on the ALREADY OPEN firefox browser instead to open a new window of firefox each time. The reason is that i have a few sites in a few tabs already opened and logged in, it would be much more simple if the command to run the .js
file does that in one of the already opened tabs (tab 1 ideally).
Any suggestion on how to achieve this?
Upvotes: 0
Views: 1208
Reputation: 5299
You can just bypass the '.bat' approach in the following way:
var startTime = "2017-01-24T11:55:00";
var secWait = parseInt((new Date(startTime) - new Date()) / 1000);
secWait = Math.max(0, secWait);
iimPlayCode("WAIT SECONDS=" + secWait);
window.location.href = "imacros://run/?m=TOM.js";
In addition, it's possible to make this code as 'iim'-macro. (Sometimes more preferable.)
Upvotes: 0