STOP/ABORT/BREAK[SOLVED]

Discussions and Tech Support specific to the iMacros Firefox Add-on.
Forum rules
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
Post Reply
Trax
Posts: 43
Joined: Thu Sep 13, 2012 4:07 pm
Contact:

STOP/ABORT/BREAK[SOLVED]

Post by Trax » Sat Apr 02, 2016 9:34 am

Is there any way to stop a script, NOT pause, from running, any kind of STOP/ABORT/BREAK code ?

Or is iimExit the only choice?
Last edited by Trax on Tue May 03, 2016 3:05 pm, edited 1 time in total.
Cobra99
Posts: 64
Joined: Thu Dec 25, 2014 12:17 am

Re: STOP/ABORT/BREAK

Post by Cobra99 » Sat Apr 02, 2016 12:27 pm

Make line with syntax error and do not use errorignore yes
VERSION BUILD=8820413 RECORDER=FX, WIN7 64-bit SK, Pale Moon 25.8.1(x86)
FCIM here http://forum.imacros.net/viewtopic.php?f=20&t=3331
User avatar
alex686
Posts: 32
Joined: Wed Oct 21, 2015 6:48 am
Contact:

Re: STOP/ABORT/BREAK

Post by alex686 » Mon Apr 04, 2016 3:19 pm

Unforunately, the author of this thread did not specify the type of script he is eager to stop (.js or .iim). With regards to iim script, cobra's answer is correct. But how would one stop the .js script?

Consider the following .js script:

Code: Select all

iimPlayCode("WAIT SECONDS=10");
iimPlayCode("URL GOTO=http://google.com");
After starting the script, press the STOP button during the 10 sec delay. The playing of "WAIT SECONDS" would be aborted and the script will run further opening google's page. But how to stop the script entirely so that it never visit google if you press STOP during the "WAIT SECONDS" delay? Here is how:

Code: Select all

var returnCode = iimPlayCode("WAIT SECONDS=10");
if (returnCode === -101) {
  throw Error('You pressed STOP button');
}
iimPlayCode("URL GOTO=http://google.com");
For the curious reader, all the return codes are specified here.
Now the script will stop entirely if a user stops it during the delay and the google's page won't be opened.
I've created a wraper function to easily utilize this concept. You may create your own based on mine.

The problem I'm facing now is how to stop a .js macro execution when there is no iimPlayCode running in it and there is no way to get the return code and check whether it equals to -101 or not? Any ideas?


UPDATE
The code snippets I published work the way I descibe only when you uncheck the Show Javascript during replay option in iMacros settings. When this option is checked, then the Stop button interrupts script normaly and you don't have to check the return code. Is that ok? I never set this checkbox. Devs, any comments on this?
iMacros for Firefox: 8.9.7
Firefox: 49.0.1
Pale Moon: 27.0.2
OS: Arch Linux, Windows 10

Manage iMacros from your mobile device: https://manage.getbot.ru
chivracq
Posts: 8980
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: STOP/ABORT/BREAK

Post by chivracq » Mon Apr 04, 2016 4:58 pm

alex686 wrote:UPDATE
The code snippets I published work the way I descibe only when you uncheck the Show Javascript during replay option in iMacros settings. When this option is checked, then the Stop button interrupts script normaly and you don't have to check the return code. Is that ok? I never set this checkbox. Devs, any comments on this?
Ah OK...!, that's what I was going to say...

I already gave my Comments in this Thread (about a '.js' Script running several '.iim' Macros):
- Re: Bug or Feature?
chivracq on 21 Jan 2016, 21:33 wrote:(Tested on iMacros for FF v8.8.2, PM v24.6.2, Win7-x64.)

The Trigger for me is to uncheck the 'Show Javascript during Replay' Setting in the General Options.
I didn't test on FF nor if the 'showsteps' Command toggles it as well but you already know where it comes from...

As you can toggle this Behaviour, I wouldn't call it a Bug, on the contrary...!
It could even be very useful for splitting your whole '.iim' part into several '.iim' Sub-Macros if some part(s) of the whole Workflow sometimes don't really need to be run, like that you can jump quickly to the next Sub-Macro like if you had a GOTO in the Code... I love that...! 8)
The only "price" to pay if you prefer the Full Stop with the Setting activated is that you are supposed to lose a bit of Performance...
But I'm still not convinced both Replies in this Thread address the OP's Qt as the Qt is so vaguely formulated, and without any FCI, that's why i had not reacted to this Thread... The OP is talking about a "Command", not stopping the Script, '.iim' or '.js' indeed we don't know, manually... :?
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Trax
Posts: 43
Joined: Thu Sep 13, 2012 4:07 pm
Contact:

Re: STOP/ABORT/BREAK [SOLVED]

Post by Trax » Tue May 03, 2016 3:05 pm

I meant in a .js script, I wasnt looking for a workaround like writing a piece of bad code to generate a syntax error, was just asking if there is an actual in-built way to do it.
Post Reply