Message without stopping macro?

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
viking
Posts: 243
Joined: Sun Mar 16, 2008 7:22 am

Message without stopping macro?

Post by viking » Mon Jun 05, 2017 7:34 pm

I would like to display messages (in a loop) while the macro is running. Is that possible to do in a regular macro or do I need to use javascript and iimDisplay() ?

1. PROMPT always needs the user to press "OK" so it stops the macro.

2. Can iimDisplay() be used in macro or do I need javascript?
I tried this, but it didn't work:

Code: Select all

 SET !VAR1 EVAL("int ret_code=iimDisplay('hello'); ret_code;")
imacros v8.9.7
FF v.53.03
WIN7 (64bit)
chivracq
Posts: 9291
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Message without stopping macro?

Post by chivracq » Mon Jun 05, 2017 9:20 pm

viking wrote:

Code: Select all

imacros v8.9.7
FF v.53.03
WIN7 (64bit)
I would like to display messages (in a loop) while the macro is running. Is that possible to do in a regular macro or do I need to use javascript and iimDisplay() ?

1. PROMPT always needs the user to press "OK" so it stops the macro.

2. Can iimDisplay() be used in macro or do I need javascript?
I tried this, but it didn't work:

Code: Select all

 SET !VAR1 EVAL("int ret_code=iimDisplay('hello'); ret_code;")
imacros v8.9.7
FF v.53.03
WIN7 (64bit)
Yep, I would need the Functionality as well, I have some EnhReq in this Thread (Items '05' and '09' would be relevant for you...), would be nice btw if you could "support" (= bump) it, (+ maybe other EnhReq's I posted in the same Thread that you might find "interesting"), I cannot make "things move" just by myself... :idea:

I already did some "vague" Attempt to get this Functionality in pure '.iim', the "best Solution" I had in mind after trying like you to use 'iimDisplay()' in 'EVAL()' and a few other "things" would be to call a mini '.js' Script at some "strategic" places (using the 'URL GOTO=imacros://run/?m=' Syntax) to handle the Display part before calling back the "rest" of the '.iim' Macro..., but that requires splitting the original '.iim' Macro into 2 or more '.iim' Sub-Macros and it quickly become a bit cumbersome...

Some "more correct" Syntax I think to use btw for what you tried with 'iimDisplay()' in 'EVAL()' would be:

Code: Select all

SET !VAR1 EVAL("var ret_code=iimDisplay('hello'); ret_code;")
... or this one, following the Syntax for 'MacroError()':

Code: Select all

SET !VAR1 EVAL("{iimDisplay('hello');}")
... but both trigger anyway the following RuntimeError:
ReferenceError: iimDisplay is not defined, line 4 (Error code: -1001)
This one doesn't work either:

Code: Select all

URL GOTO=javascript:int<SP>ret_code=iimDisplay('hello');ret_code;
(No RuntimeError but the 'iimDisplay()' is not triggered...

Other "Workarounds" I had in mind involve using the OS Clipboard to paste "manually" from time to time its Content into some Temp Notepad File opened in parallel, or even have the Macro save automatically that Data to the Temp '.TXT' File that can be already opened in a second Tab or in some 2nd FF Window or even in a different FF Profile and that the User can from time to time refresh to get the "latest" Info (or have some parallel Macro running and performing a periodic Refresh of the Page/Tab), or you can also have the Macro input that Info into some 2nd Tab with some Input Field and the User can pause the Macro when needed to check the Content of the 2nd Tab, but none of those "Workaround" are as powerful and simple as the 'iimDisplay()' Functionality...

I wanted "one day" to have a "look" at how 'iimDisplay()' is coded in the Add-on for FF (to see if I could port it to use in 'EVAL()' or 'URL GOTO=javascript:'), but I haven't taken/found the time/energy (yet!?) to go investigating that, ah-ah...! :oops:

Advanced User @iimfun posted a few months ago some Script like the following one, supposed to implement this Functionality, and I thought that was very "promising", but it doesn't work for me in the 2 FCI's I tested it...:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
TAB T=1

SET normLoop {{!LOOP}}
SET maxLoop 3

SET !ERRORIGNORE YES
SET D EVAL("var d = 'Display:\\n\\nLOOP : '+ {{normLoop}} + ' OF ' + {{maxLoop}} + '\\n\\n'; MacroError(d);")
SET !ERRORIGNORE NO

WAIT SECONDS=3
Not working...! Tested in the following 2 FCI's:
- iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10-x64.
- iMacros for FF v8.9.7, FF53, Win10-x64.

But he (@iimfun) uses CR I think as his Default Browser, so maybe it works in v8.4.4 for CR, dunno...!
And I didn't try in v9.0.3 for FF either (that I never bothered to install actually, oops...!)...
- (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...
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Message without stopping macro?

Post by iimfun » Wed Jun 07, 2017 6:35 am

Additional note.
Sometimes for testing purposes it's possible to take advantage of the web console or status bar (there should be a similar extension for Firefox). Below is my idea.

Code: Select all

' open Web Console before playing this code
SET message "Displaying it on the web console"
URL GOTO=javascript:console.log("{{message}}");
This works on iMacros for Firefox 8.9.7 and iMacros for Chrome 8.4.4.
chivracq wrote:But he (@iimfun) uses CR I think as his Default Browser, so maybe it works in v8.4.4 for CR
Yeah, that's true.
chivracq
Posts: 9291
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Message without stopping macro?

Post by chivracq » Wed Jun 07, 2017 7:47 pm

iimfun wrote:Additional note.
Sometimes for testing purposes it's possible to take advantage of the web console or status bar (there should be a similar extension for Firefox). Below is my idea.

Code: Select all

' open Web Console before playing this code
SET message "Displaying it on the web console"
URL GOTO=javascript:console.log("{{message}}");
This works on iMacros for Firefox 8.9.7 and iMacros for Chrome 8.4.4.
chivracq wrote:But he (@iimfun) uses CR I think as his Default Browser, so maybe it works in v8.4.4 for CR
Yeah, that's true.
Hum-hum-hum...!, that's not a bad Idea actually, ah-ah...! A bit "dirty" on one side as the Console Panel takes quite a lot of Space I find, and I would expect it to probably "screw" the 'X/Y CLICK' Mode I'm afraid, and it may look a bit "freaky" to "Standard" Users, and I find the Information not as easily visible as the 'iimDisplay()' Command in the iMacros Side Panel, but I like it anyway..., and one nice Advantage is that the Console Panel can be docked out of the Browser Instance running the Macro (at least on FF/PM) to be opened in a separate Window or even on a 2nd Monitor, which can be quite handy...

Another mini-Trick is to (Conditionally eventually) automatically open the Console Panel from the Macro directly using the 'EVENT' Mode on 'Ctrl^Shift^k'.
'<BR>' doesn't seem to work in the Msg, but '\n' does, which allows to display the Msg on several Lines..., which would give for "my" previous little Macro:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
TAB T=1

SET maxLoop 3

'URL GOTO=javascript:console.log(clear);

EVENT TYPE=KEYPRESS SELECTOR="HTML>BODY" CHAR="k" MODIFIERS=[ctrl,shift]
'WAIT SECONDS=1
SET message "Displaying it on the web console, and on 2 Lines...!:"
ADD message \nLOOP<SP>{{!LOOP}}<SP>of<SP>{{maxLoop}}.
URL GOTO=javascript:console.log('{{message}}');

WAIT SECONDS=3
(Tested on iMacros for FF v8.8.2, PM v26.3.3 (=FF47), Win10-x64.)

The 'Ctrl^Shift^k' on the first Run takes 1-2 sec to open and keeps running directly without waiting for the Console to open and displays the Msg with a bit of Delay, but the Display is then "instant" on the next Runs, as the Console remains open, 'Ctrl^Shift^k' doesn't toggle it Open/Close, I guess it can be closed as well from the Macro...
And the Console remembers the last Setting about being out-docked, when opened again, that's handy as well...

Oh...!, and I "vaguely" tried to clear the Content of the Console, but my 'clear' didn't work..., I didn't insist...

>>>

But hum, @iimfun, could you check that "my" little Macro from my previous Post, based on your Macro actually from a few months ago in some other Thread, indeed doesn't work in FF (with v8.9.7)...? Maybe you'll find a way to get it to work in FF as well, ah-ah...!?
Last edited by chivracq on Sat May 30, 2020 1:15 pm, edited 1 time in total.
- (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...
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Message without stopping macro?

Post by iimfun » Mon Jun 12, 2017 6:33 am

chivracq wrote:But hum, @iimfun, could you check that "my" little Macro from my previous Post, based on your Macro actually from a few months ago in some other Thread, indeed doesn't work in FF (with v8.9.7)...?
Earlier I made sure that my code for Chrome wouldn't work in Firefox, so I decided to give my second idea a try:

1. Added the Status-4-Evar extension to Firefox.
2. Followed this instruction
To allow scripts to change the the status bar text, the user must set the dom.disable_window_status_change preference to false in the about:config screen.
3. Customize the status bar behavior.

Then played some code like this

Code: Select all

SET message "Displaying it on the status bar"
URL GOTO=javascript:window.status="{{message}}";void(0);
That is useful only for testing, I think.
Post Reply