Is it possible to stop iMacros through Greasemonkey?
Forum rules
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
-
- Posts: 2
- Joined: Sun May 29, 2011 10:16 pm
Is it possible to stop iMacros through Greasemonkey?
This seems like it should be simple, but I haven't had much luck with searching here or on Google. Basically, I have a macro running that is searching different webpages, while my Greasemonkey script is searching each page for different content. However, when my Greasemonkey script finds a certain piece of content, I would like to add a line in that script that tells iMacros to either stop the specific macro, or close entirely. I'm aware of the EVAL statement and using MacroError to halt the macro, but given that I'm dealing with some dynamic search variables that took a bit of work to iron out in Javascript, I'd rather leave the url looping to iMacros and let Greasemonkey do the rest of the work. Is this feasible at all? Thanks.
Windows 7
Firefox 26.0
iMarcros 8.6.0
Firefox 26.0
iMarcros 8.6.0
Re: Is it possible to stop iMacros through Greasemonkey?
Why don't you simply just use TAG ... CONTENT=EVENT:FAIL_IF_FOUND?
http://wiki.imacros.net/TAG#Triggering_events
I had some ideas to integrate GreaseMonkey with iMacros (or the other way round...!, didn't really decide...!) but I didn't come far enough to actually implement a Proof of Concept, mainly because I didn't spend enough time to become fluent with GM, you seem to have come further than me... Good!
EVAL and MacroError should do the job otherwise indeed.... maybe based on some HTML Element you could dynamically add to the Page with GM before iMacros has a chance to do any Processing on that Page...
http://wiki.imacros.net/TAG#Triggering_events
I had some ideas to integrate GreaseMonkey with iMacros (or the other way round...!, didn't really decide...!) but I didn't come far enough to actually implement a Proof of Concept, mainly because I didn't spend enough time to become fluent with GM, you seem to have come further than me... Good!
EVAL and MacroError should do the job otherwise indeed.... maybe based on some HTML Element you could dynamically add to the Page with GM before iMacros has a chance to do any Processing on that Page...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- thecoder2012
- Posts: 446
- Joined: Sat Aug 15, 2015 5:14 pm
- Location: Internet
- Contact:
Re: Is it possible to stop iMacros through Greasemonkey?
It's my topic since few minutes.
But it's impossible in the newest FF version.
Incompleted workaround: Close the Tab
Autostart thing with GreaseMonkey is no problem. See use imacros code in tampermonkey, Autostart on page load by URI, autrun and call a iMacros-Script from greasemonkey
Possible as workaround in iMacros with JS "throw exit;" (as big instant error without syntax error) but same to MacroError.
EDIT: Proof of concept in iMacros v8.9.7 with Javascript (*.js):
It works in my test with Waterfox 55.2.2 but not in Greasemonkey/Tampermonkey (context/tab wrong, maybe)
Stop-Button is better in a few cases. But the (low-level) way is hard in FF but I hope it's possible in Greasemonkey/Tampoermoney in the future.chivracq wrote:Why don't you simply just use TAG ... CONTENT=EVENT:FAIL_IF_FOUND?
http://wiki.imacros.net/TAG#Triggering_events
But it's impossible in the newest FF version.
Incompleted workaround: Close the Tab
Which ideas?chivracq wrote:I had some ideas to integrate GreaseMonkey with iMacros (or the other way round...!, didn't really decide...!) but I didn't come far enough to actually implement a Proof of Concept, mainly because I didn't spend enough time to become fluent with GM, you seem to have come further than me... Good!
Autostart thing with GreaseMonkey is no problem. See use imacros code in tampermonkey, Autostart on page load by URI, autrun and call a iMacros-Script from greasemonkey
Sure but Stop(-Button) is required in few cases and better for Greasemonkey, Tampermonkey and in iMacros with JS as solution.chivracq wrote:EVAL and MacroError should do the job otherwise indeed.... maybe based on some HTML Element you could dynamically add to the Page with GM before iMacros has a chance to do any Processing on that Page...
Possible as workaround in iMacros with JS "throw exit;" (as big instant error without syntax error) but same to MacroError.
EDIT: Proof of concept in iMacros v8.9.7 with Javascript (*.js):
Code: Select all
var wm = imns.Cc["@mozilla.org/appshell/window-mediator;1"].getService(imns.Ci.nsIWindowMediator);
//line for greasemonkey/tampermoney
//var wm = imns.Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(imns.Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");//window/tab management required with more than 1 tab!
iimPlayCode("URL GOTO=https://www.google.de/");
win.iMacros.jsplayer2.stop();//imacros stop button
iimPlayCode("URL GOTO=https://www.yahoo.de/");
Last edited by thecoder2012 on Wed Apr 11, 2018 10:29 pm, edited 1 time in total.
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me!
Re: Is it possible to stop iMacros through Greasemonkey?
Yeah, sure...!, since @OP didn't bother to follow up...!thecoder2012 wrote:It's my topic since few minutes.
You seem to be "in a mood" for "exhuming" old Threads from 4 years ago, ah-ah...! But interesting Thread indeed..
Hum..., "newest"/"latest" is always vague and won't mean anything again to anybody reading the Thread in 4 years from now, you can better mention the exact Version in/from/until which stg (still) works or not anymore... => I guess you probably mean FF57...thecoder2012 wrote:Stop-Button is better in a few cases. But the (low-level) way is hard in FF but I hope it's possible in Greasemonkey/Tampoermoney in the future.chivracq wrote:Why don't you simply just use TAG ... CONTENT=EVENT:FAIL_IF_FOUND?
http://wiki.imacros.net/TAG#Triggering_events
But it's impossible in the newest FF version.
Incompleted workaround: Close the Tab
Oh...!, and about 'TAB Close', have a look at the following Thread (hum, from 2014 as well, ah-ah...!) where I had posted a very simple Sol that can even be used for a Conditional Close if needed..., and where I maintain a List of relevant Threads as well, with other Sols...:
- How to close the iMacros Browser?
Fouff..., I don't really remember what "Ideas" I had then, 4 years ago... I "see" one Game that I play where I could (have) use(d) a Mix of GM and iMacros, but I think I wasn't playing it yet in Feb 2014 and for other Games that I was already playing, I had other perfect Sols in (pure) ('.iim') iMacros, so I guess it was maybe for other Threads on the Forum, where like @OP in this one the User(s) didn't follow up, so I didn't do any further "Digging"...thecoder2012 wrote:Which ideas?chivracq wrote:I had some ideas to integrate GreaseMonkey with iMacros (or the other way round...!, didn't really decide...!) but I didn't come far enough to actually implement a Proof of Concept, mainly because I didn't spend enough time to become fluent with GM, you seem to have come further than me... Good!
Autostart thing with GreaseMonkey is no problem. See use imacros code in tampermonkey, Autostart on page load by URI, autrun and call a iMacros-Script from greasemonkey
But hum..., wondering if it's possible to Conditionally launch a Macro from GM, or even Macro_1 or Macro_2..., that could be interesting...
Even if, hum-hum..., maybe not best for me though, and not "better" than the Sol I already have, I need pure Speed, and a GM Script running on the Page will probably already slow the Page Loading by a few Milliseconds, and even worse, loading and parsing an (.iim') Macro can sometimes take 1-2 sec before the Macro is actually running, while in "my Sol", my Macro is already running, so I'm already beyond the Parsing Phase... (and several Vars and Computations have already been loaded in Memory)...
Same about "newest" a bit earlier, you should mention as well in which FF Version you've tested your Script..., and/or in which Browser(s) actually as you regularly use WaterFox like I use Pale Moon myself...thecoder2012 wrote:Sure but Stop(-Button) is required in few cases and better for Greasemonkey, Tampermonkey and in iMacros with JS as solution.chivracq wrote:EVAL and MacroError should do the job otherwise indeed.... maybe based on some HTML Element you could dynamically add to the Page with GM before iMacros has a chance to do any Processing on that Page...
Possible as workaround in iMacros with JS "throw exit;" (as big instant error without syntax error) but same to MacroError.
EDIT: Proof of concept in iMacros v8.9.7 with Javascript (*.js):It works in my test but not in Greasemonkey/Tampermonkey (context/tab wrong, maybe)Code: Select all
var wm = imns.Cc["@mozilla.org/appshell/window-mediator;1"].getService(imns.Ci.nsIWindowMediator); //line for greasemonkey/tampermoney //var wm = imns.Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(imns.Components.interfaces.nsIWindowMediator); var win = wm.getMostRecentWindow("navigator:browser");//window/tab management required with more than 1 tab! iimPlayCode("URL GOTO=https://www.google.de/"); win.iMacros.jsplayer2.stop();//imacros stop button iimPlayCode("URL GOTO=https://www.yahoo.de/");
But hum..., interesting to see that you can access the 'Stop' Button of the iMacros Side-Panel from a Script..., I guess that's what the 'PAUSE' Command is doing with probably some:
Code: Select all
win.iMacros.jsplayer2.pause();
But hum-hum..., @thecoder2012, any way to create some Keyboard Shortcut on the fly to this 'pause()' (+ 'continue()')...? That could be interesting, several Threads about such a Functionality on the Forum actually..., just an Idea...
OK, trying to post now, I started this Reply several hours ago, got some Visit several times in the meantime...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- thecoder2012
- Posts: 446
- Joined: Sat Aug 15, 2015 5:14 pm
- Location: Internet
- Contact:
Re: Is it possible to stop iMacros through Greasemonkey?
A little yes.thecoder2012 wrote:You seem to be "in a mood" for "exhuming" old Threads from 4 years ago, ah-ah...!
Yes but I mean more the new addon system "WebExtensions" because no low level api possible. See Comparison with the Add-on SDK ("Add-on SDK => WebExtensions" + "Low-level APIs").chivracq wrote:Hum..., "newest"/"latest" is always vague and won't mean anything again to anybody reading the Thread in 4 years from now, you can better mention the exact Version in/from/until which stg (still) works or not anymore... => I guess you probably mean FF57...
Thanks! It's helpful.chivracq wrote:Oh...!, and about 'TAB Close', have a look at the following Thread (hum, from 2014 as well, ah-ah...!) ...
Cyberfox 52.x ESR and Waterfox 55.xchivracq wrote:Same about "newest" a bit earlier, you should mention as well in which FF Version you've tested your Script..., and/or in which Browser(s) actually as you regularly use WaterFox like I use Pale Moon myself...
Yes. I was unsure but it is possible.chivracq wrote:But hum..., interesting to see that you can access the 'Stop' Button of the iMacros Side-Panel from a Script..., [/code]
Yes but I have checked the source code (jdgui => imacros.jar => content => iMacros.js). But few commands are untested.chivracq wrote:I guess that's what the 'PAUSE' Command is doing with probably some:Hum, wondering what a 'play()' will do, ah-ah...!, maybe with some Macro as Argument...Code: Select all
win.iMacros.jsplayer2.pause();
General (with checks!):
Code: Select all
win.iMacros.pause();
win.iMacros.play("file.js");
win.iMacros.playLoop("file.iim",10);
win.iMacros.playURLMacro("yoururldata?code=base64script");
win.iMacros.stop();
IIM:
Code: Select all
win.iMacros.player.pause();
win.iMacros.player.unpause();
win.iMacros.player.play(imns.FIO.openMacroFile("file.iim"));
win.iMacros.player.play(imns.FIO.openMacroFile("file.iim"),10);
win.iMacros.player.stop();
Code: Select all
win.iMacros.jsplayer2.pause();
win.iMacros.jsplayer2.unpause();
win.iMacros.jsplayer2.playJSFile("yourjsdata","file.js");
win.iMacros.jsplayer2.stop();
Code: Select all
win.iMacros.recorder.start();
win.iMacros.recorder.pause();
win.iMacros.recorder.unpause();
win.iMacros.recorder.stop();
It's not really possible without a lot of code.chivracq wrote:But hum-hum..., @thecoder2012, any way to create some Keyboard Shortcut on the fly to this 'pause()' (+ 'continue()')...? That could be interesting, several Threads about such a Functionality on the Forum actually..., just an Idea...
See this addon shortkeys (Run custom JS + imacros script in base64 as url) as solution, maybe.
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me!