Displaying window.alert()

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
comp3v
Posts: 7
Joined: Thu Nov 10, 2016 9:41 pm

Displaying window.alert()

Post by comp3v » Thu Nov 10, 2016 10:22 pm

(I know it's a dumb question, but I couldn't find this info in wiki or elsewhere!)
I want to display a javascript dialog by calling something like

Code: Select all

URL GOTO=javascript:alert("TEST");
. If I just run this from my .iim macros, I get an error (Unhandled alert dialog detected. Dialog message: "TEST", line: 5 (Error code: -1450)). From the wiki, I see the explanation "The Dialog Manager detected a dialog, but the handler for this dialog type is not enabled." - but this is my own alert, I want just to display it and let the user close it, not handle it from the script! (Okay, I can add some "ONDIALOG" command, but what exactly should I write there if I want to display it?)

UPD. Config I am using: Windows 10 64-bit, Firefox v 49.0.2, iMacros v 9.0.3.
Last edited by comp3v on Fri Nov 11, 2016 4:09 am, edited 1 time in total.
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Displaying window.alert()

Post by chivracq » Fri Nov 11, 2016 1:03 am

comp3v wrote:(I know it's a dumb question, but I couldn't find this info in wiki or elsewhere!)
I want to display a javascript dialog by calling something like

Code: Select all

URL GOTO=javascript:alert("TEST");
. If I just run this from my .iim macros, I get an error (Unhandled alert dialog detected. Dialog message: "TEST", line: 5 (Error code: -1450)). From the wiki, I see the explanation "The Dialog Manager detected a dialog, but the handler for this dialog type is not enabled." - but this is my own alert, I want just to display it and let the user close it, not handle it from the script! (Okay, I can add some "ONDIALOG" command, but what exactly should I write there if I want to display it?)
CIM...! :mrgreen:
It's a Technical Forum, we need Technical Info about your precise Environment...! :roll:

'...but I couldn't find this info in wiki or elsewhere!", well the Statement you are trying to use is an exact Copy&Paste from the Wiki...

But, OK, "good news", it's a Bug since v7.5.x or v8.0.x (hum, talking about iMacros for FF Versions, you didn't mention your FCI but I reckon you are on FF, oh...!, and you posted in the 'iMacros for FF' Sub-Forum...!) that has never been fixed, maybe in v9.0.3, I didn't check, and that I have reported already 2 or 3 years ago... => The Wiki is wrong... (well..., concerning FF, it works in CR I know, and probably in IE and iMB, only FF is impacted...)

Workaround is to use 'PROMPT'.
Or use a '.js' Script otherwise, 'alert()' works fine then...

If you were trying to use this Syntax for a "Conditional PROMPT", see the following Thread for a Workaround for FF I posted a few months ago:
- Re: PROMPT Messagebox - Yes - No - Cancel (end)
(Hum, and it probably only works in Win32/64 OS as I'm "misusing" another Bug...)
- (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...
comp3v
Posts: 7
Joined: Thu Nov 10, 2016 9:41 pm

Re: Displaying window.alert()

Post by comp3v » Fri Nov 11, 2016 4:12 am

chivracq, thanks for the answer! sorry for not giving tech info (added it to the original post now) - I thought that with so basic question, the only issue was only about me doing something wrong :) and of course I could not expect that my very first code in iMacros will catch a bug!
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Displaying window.alert()

Post by iimfun » Fri Nov 11, 2016 1:37 pm

comp3v wrote:... this is my own alert, I want just to display it ...
Sometimes a miracle may happen

Code: Select all

' ...
' the last command in your macro
URL GOTO=javascript:setTimeout("alert('TEST');",300);void(0);
comp3v wrote:... my very first code in iMacros ...
Or perhaps you just need this?

Code: Select all

PROMPT TEST
comp3v
Posts: 7
Joined: Thu Nov 10, 2016 9:41 pm

Re: Displaying window.alert()

Post by comp3v » Fri Nov 11, 2016 4:20 pm

iimfun wrote:Sometimes a miracle may happen

Code: Select all

' ...
' the last command in your macro
URL GOTO=javascript:setTimeout("alert('TEST');",300);void(0);
didn't work in my case :/ No error messages this time, but alert does not appear either.
iimfun wrote:Or perhaps you just need this?

Code: Select all

PROMPT TEST
no, unfortunately it's not what I need: I want a message from inside a piece of javascript code...
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Displaying window.alert()

Post by chivracq » Fri Nov 11, 2016 5:01 pm

comp3v wrote:chivracq, thanks for the answer! sorry for not giving tech info (added it to the original post now) - I thought that with so basic question, the only issue was only about me doing something wrong :) and of course I could not expect that my very first code in iMacros will catch a bug!
comp3v wrote:UPD. Config I am using:

Code: Select all

Windows 10 64-bit, 
Firefox v 49.0.2, 
iMacros v 9.0.3.
OK, good for your FCI... :D
Always mention it when you open a Thread or post for the first time in some existing older Thread, many Commands are not implemented for all Browsers/Versions or can get broken from some specific Version like in this current Case...!
But OK, you are on v9.0.3, meaning it's not fixed in this Version either, which doesn't surprises me. v9.0.3 is pretty buggy and limited btw, Advice is to go back to v8.9.7 which is way more stable...
iimfun wrote:
comp3v wrote:... this is my own alert, I want just to display it ...
Sometimes a miracle may happen

Code: Select all

' ...
' the last command in your macro
URL GOTO=javascript:setTimeout("alert('TEST');",300);void(0);
comp3v wrote:... my very first code in iMacros ...
Or perhaps you just need this?

Code: Select all

PROMPT TEST
Yeah, 'PROMPT' is what I suggested as well, which is even more powerful than the plain JavaScript 'alert()' Function anyway...

But, sh%^$#^&*tt, @iimfun, your Syntax with 'setTimeout()' does work indeed (at least in my FCI's:

Code: Select all

iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10-x64 
+ iMacros for FF v8.9.7, FF47, Win10-x64
)...!!
This is very good news for FF Users like me, because that opens the door (again) to Conditional PROMPT's in a much more easy way than the Workaround I had posted a few months ago which misuses some Bug on the Clipboard and can only handle Display PROMPT's while your Syntax will probably work as well for 'confirm()' and I forgot the name of the 3rd similar JS DialogBox Function to be able to handle Input PROMPT's.

And the funny thing is that I had tried as well about 2 years ago to use 'setTimeout()' on the Advice of a Friend of mine who's a nerdy/freaky JavaScript Guru to try to find a Workaround but I had not succeeded to get 'setTimeout()' really to work directly and I didn't want to bother him too much so I didn't insist (and I didn't need the Functionality for myself at that time), but he was right, ah-ah...!
I actually thank indirectly all my Knowledge on iMacros to that Friend as we've been competing for 10 years now on some "stupid" Internet Game where I did/do all my Automation using iMacros and he using pure JavaScript, ah-ah...!

:twisted: :twisted: A Big Thanks @iimfun for your Workaround, ah-ah...! :D :twisted: :twisted:
- (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...
comp3v
Posts: 7
Joined: Thu Nov 10, 2016 9:41 pm

Re: Displaying window.alert()

Post by comp3v » Sat Nov 12, 2016 2:35 am

indeed, when I've switched to 8.9.7, workaround with setTimeout works! Thank you @iimfun for this solution!
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Displaying window.alert()

Post by chivracq » Sat Nov 12, 2016 4:50 am

comp3v wrote:indeed, when I've switched to 8.9.7, workaround with setTimeout works! Thank you @iimfun for this solution!
OK, pfff, one more "Bug" then for v9.0.3, hum some Developer is beginning to deserve some Spanking I'm afraid...! :shock: , the List of Limitations/Bugs for this Version keeps becoming well, nearly "unlimited", ah-ah...!

But OK, seriously @OP, I hope you understood the Importance of mentioning your FCI when you open a Thread, I won't even react to your Thread next time you open a new one if you don't mention it... 8)

And yep, Thanks again to @iimfun, I've mentioned your new Workaround in the "main" Thread about "the Subject", ah-ah...!
- (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: Displaying window.alert()

Post by iimfun » Mon Nov 14, 2016 8:11 am

chivracq wrote:Thanks again to @iimfun, I've mentioned your new Workaround ...
Why did I think that it had been already tested since that time?..
But Okay. To be continued anyway.
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Displaying window.alert()

Post by chivracq » Mon Nov 14, 2016 9:19 pm

iimfun wrote:
chivracq wrote:Thanks again to @iimfun, I've mentioned your new Workaround ...
Why did I think that it had been already tested since that time?..
But Okay. To be continued anyway.
Oh yep indeed, I had checked/tested your first Solution which indeed didn't work on FF, but OP in "that" Thread never mentioned their FCI like I had asked them so I didn't follow that Thread anymore and you were dealing with it anyway and I apparently missed your Reply that was meant for me, I would have of course confirmed that your second Solution did work on FF... (I will now update that other Thread, Thanks for pointing to it...)
- (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...
Post Reply