AHK Script freezing due to pop up.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kaosway07

AHK Script freezing due to pop up.

24 May 2018, 09:03

Hello All,

I am running an AHK script to fill up certain field in a webform using COM elements.

But a certain pop up when I click a checkbox is freezing the script. And the script only resumes when I close the pop up manually.

No code in the script is being executed once the pop up opens.

Please help, If any one has some idea why this might be happening.

Thanks in advance.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: AHK Script freezing due to pop up.

24 May 2018, 12:43

kaosway07 wrote:..a certain pop up when I click a checkbox is freezing the script. And the script only resumes when I close the pop up manually...
Modal popups can potentially interrupt normal script behavior but it's hard to say without seeing your code, how exactly you are approaching this and or being able to test it directly.
Can you post your code so far? It shouldn't be too difficult to close and or manipulate the popup once it's inspected.
kaosway07

Re: AHK Script freezing due to pop up.

25 May 2018, 03:21

Hi. Thanks for the reply.

The code is

Code: Select all

wb := WBGet()
wb.visible := True

Framex := wb.document.parentwindow.frames["Main"].document

Framex.getElementById("mail_radio").click() 
Sleep, 1000

Send, {ENTER}
Sleep 1000

Framex.getElementById("Submit").click() 

return
please place your code in [code][/code] tags!


Now once thar Mail Radio button is cliked. The script freezes. And I have to manually close the pop up and script again resumes from the next line.

Let me know if you need any other information. Help is appreciated.

Thank You
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: AHK Script freezing due to pop up.

25 May 2018, 13:47

If it's a modal alert it like this:
Image
It can be closed like any other standard dialog box.
For instance:

Code: Select all

WinWait Message from webpage
ControlClick, Button1, Message from webpage
If it's a DOM based dialog box create a reference to it and then use the close() method:

Code: Select all

alertBox := wb.document.getElementById("myDialog") 
alertBox.close()
htms
kaosway07

Re: AHK Script freezing due to pop up.

28 May 2018, 08:17

Thank you so much for your help. However my issue was not with script but the checkbox. The scipt always froze after checkbox elements was clicked, so no matter what ever I added after that was not executed by ahk hence the pop up was not closed.

However I tweaked the script to set focus on the checkbox and checked by sending a space key. Later I closed the pop up by using the controlclick like you recommended.

I wonder what went wrong when I used click() function. Is there any other way to check a checkbox other then clicking it. May come in handy in future.

Thank You very much.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arrondark, jdfnnl, kshitij90, Rohwedder and 315 guests