OnWebPageDialog can't close form

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.
Post Reply
acichosz13
Posts: 7
Joined: Tue Sep 11, 2018 5:58 pm

OnWebPageDialog can't close form

Post by acichosz13 » Thu Jan 10, 2019 11:05 pm

Hello,
Have a question if I am able to play a macro onwebpagedialog and then after that if I can get it to close.

Microsoft Windows 10 Enterprise
Microsoft Windows NT 6.3.9600.0
64-bit Operating System
Installed UI Culture: English (United States)
CLR version 4.0.30319.42000
Internet Explorer version 11.1508.15063.0
Enhanced Protected Mode = False, 64-bit processes for EPM = False
BrowserEmulation Mode = IE11
iMacros Browser (x86) version 12.5.503.8802
Licensed Product: Trial Version
License Type: 30-day trial (27 days left)

Here is my issue: I fill out a form click submit. Then I have it click "add case report" button this is when onwebpage dialog is activated. I can get it to close if I do the {CLOSE}, but I have another macro playing to select the correct form, fill out the form, click save. Everything works as it should, but I am looking for a way to "x" out of the dialog webpage. I even tried URL GOTO=javascript:window.close(); this works for the main webpage but when I looked into the source code I found it was a window.showmodaldialog and can't seem to get that to close.

Code: Select all

ONDIALOG POS=1 BUTTON=YES
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=NAME:btnSubmit
ONWEBPAGEDIALOG MACRO=UDFeICR.iim
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=NAME:btnAddCaseReport
Any way to play the MACRO=UDFeICR.iim -> do KEY={CLOSE} once that macro is complete? Just looking for some other options kind of hit a wall.
Tom, Tech Support
Posts: 3425
Joined: Mon May 31, 2010 4:59 pm

Re: OnWebPageDialog can't close form

Post by Tom, Tech Support » Fri Jan 11, 2019 10:34 am

Hi acichosz13,

Web page dialogs are a bit of antiquated technology specific to Internet Explorer and they always were a bit of a pain to automate, especially when the developers of said dialogs don't provide a way for the dialog to close itself. I'm assuming that there is no button on the web page dialog itself for closing the window, or else you would have already tried that, but I need to ask just to be sure.

I am currently unaware of any other means of closing the dialog besides using KEYS={CLOSE}, so you may end up having to use the KEYS parameter to automate this dialog rather than MACRO, otherwise you're in a real pickle!

I will also ask one of our developers if they have any other ideas for this scenario.
Regards,

Tom, iMacros Support
Tom, Tech Support
Posts: 3425
Joined: Mon May 31, 2010 4:59 pm

Re: OnWebPageDialog can't close form

Post by Tom, Tech Support » Fri Jan 11, 2019 12:03 pm

acichosz13 wrote:
Thu Jan 10, 2019 11:05 pm
Any way to play the MACRO=UDFeICR.iim -> do KEY={CLOSE} once that macro is complete? Just looking for some other options kind of hit a wall.
So as it turns out, there is already an undocumented "feature" of the ONWEBPAGEDIALOG command that allows both the KEYS and MACRO parameters to be specified and it will process both! The problem though, is that it will always process the KEYS command first. However, we're going to make a special build for you that reverses this behavior so that you can try using the following to see if it gets you out of this jam:

Code: Select all

ONWEBPAGEDIALOG MACRO=UDFeICR.iim KEYS={CLOSE}
If this works, we'll make this change permanent and part of the next official release. We'll send you a link to download the installer once it's available via the email address you used to register on these forums.
Last edited by Tom, Tech Support on Fri Jan 11, 2019 3:36 pm, edited 1 time in total.
Reason: Implementing the change is not as straightforward as initially anticipated and will take more time
Regards,

Tom, iMacros Support
acichosz13
Posts: 7
Joined: Tue Sep 11, 2018 5:58 pm

Re: OnWebPageDialog can't close form

Post by acichosz13 » Fri Jan 11, 2019 3:36 pm

Tom,

Thank you so much for doing this! You have no idea how much time this will save me. I will let you know if it works how I need it to.

Thanks again!
Tom, Tech Support
Posts: 3425
Joined: Mon May 31, 2010 4:59 pm

Re: OnWebPageDialog can't close form

Post by Tom, Tech Support » Fri Jan 11, 2019 3:38 pm

I just tested the first version of the fix myself, but it's not working entirely as expected and the developer will need more time to sort it out. I'm not sure how long it will take at this point before we have something ready for you, sorry.
Regards,

Tom, iMacros Support
Tom, Tech Support
Posts: 3425
Joined: Mon May 31, 2010 4:59 pm

Re: OnWebPageDialog can't close form

Post by Tom, Tech Support » Fri Jan 11, 2019 3:40 pm

Well actually, even though it is not working the way we intend it to, it may be sufficient for your need. If I can't get a new version within a few hours, I'll send you what I have to let you try it anyway.
Regards,

Tom, iMacros Support
chivracq
Posts: 8042
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: OnWebPageDialog can't close form

Post by chivracq » Sat Jan 12, 2019 2:10 am

Tom, Tech Support wrote:
Fri Jan 11, 2019 12:03 pm
However, we're going to make a special build for you...
Huouoummmm!, woaw-woaw...!, what a Service...!, first time I see that on this (and any) Forum...! LOVE IT...!! :D

Should be a bit "normal" actually. but tja, happens-happens-happens very scarcely... :(
[@OP, I had "alerted" TechSup to have a look at your Thread, glad to see it worked so well... :wink: ]
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Tom, Tech Support
Posts: 3425
Joined: Mon May 31, 2010 4:59 pm

Re: OnWebPageDialog can't close form

Post by Tom, Tech Support » Mon Jan 14, 2019 6:35 pm

acichosz13 wrote:
Fri Jan 11, 2019 3:36 pm
Tom,

Thank you so much for doing this! You have no idea how much time this will save me. I will let you know if it works how I need it to.

Thanks again!
Hi acichosz13,

Did you get a chance yet to try the build I sent you the other day?
Regards,

Tom, iMacros Support
acichosz13
Posts: 7
Joined: Tue Sep 11, 2018 5:58 pm

Re: OnWebPageDialog can't close form

Post by acichosz13 » Thu Jan 17, 2019 5:28 pm

Hey Tom,

Sorry for the delay... bit of a process to get programs installed. I was finally able to install this and test it out. So it runs and starts the macro within fills out a few text boxes then I receive the prompt: "Are you sure you want to navigate away from this page?" Clicking cancel will let the macro continue and then do nothing. Click okay with "x" out of the user defined form. So I hate to report back that its not working in the way I need it and that it is not actually finishing the macro before it closes.

Thank you for trying to come up with a fix. I appreciate it.
Tom, Tech Support
Posts: 3425
Joined: Mon May 31, 2010 4:59 pm

Re: OnWebPageDialog can't close form

Post by Tom, Tech Support » Thu Jan 17, 2019 8:04 pm

Hmmm... so it sounds like it is attempting to close the web page dialog before the macro has a chance to complete. Okay, thanks for the feedback, I will forward this on to the developer and let you know as soon as we have another update that you can try.
Regards,

Tom, iMacros Support
Tom, Tech Support
Posts: 3425
Joined: Mon May 31, 2010 4:59 pm

Re: OnWebPageDialog can't close form

Post by Tom, Tech Support » Thu Jan 24, 2019 9:46 am

Hi acichosz13,

I regret to inform you that the proposed fix for this issue turned out to be quite more involved and tricky to debug than originally hoped, and due to the rarity of the issue and unpopularity of web page dialogs in general, the dev team cannot justify spending additional resources on it.

There may be one other potential solution to your situation. It involves launching your macro from a VBScript using the iMacros scripting interface, and then using the WshShell.SendKeys method to send an ESC key to the iMacros browser for closing the dialog.

I can try to work up an example for you if you like, just let me know.
Regards,

Tom, iMacros Support
acichosz13
Posts: 7
Joined: Tue Sep 11, 2018 5:58 pm

Re: OnWebPageDialog can't close form

Post by acichosz13 » Wed Jan 30, 2019 7:28 pm

Hey Tom,

I totally understand and I appreciate you asking. Those web pages are just hard to manipulate so I can see why they are rare. Haha. If you wouldn't mind coming up with a little example I would appreciate that, VB scripting is something I have used a little, but looking at more examples with how it works with iMacros scripting interface would be greatly helpful.

Thank you again for working so hard on this issue!
Tom, Tech Support
Posts: 3425
Joined: Mon May 31, 2010 4:59 pm

Re: OnWebPageDialog can't close form

Post by Tom, Tech Support » Fri Feb 08, 2019 12:16 pm

Hi acichosz13,

I'm attaching a zip of the example script and macro files to this post. Just download and extract the files to your Documents\iMacros\Macros folder and then run the VBScript by browsing the folder on your computer and double-clicking the .vbs file.

Here's a short screencast of it running on my machine:

https://www.screencast.com/t/Z8bOPZ1ivP

The key point here is that the VBScript is actually closing the dialog window (not iMacros) via the WshShell.SendKeys method.
Attachments
CloseWebPageDialog.zip
(1.51 KiB) Downloaded 25 times
Regards,

Tom, iMacros Support
Post Reply