Jump to content

Cannot interact with "Message from webpage" IE popup


Recommended Posts

Hi all. In my script I use _IEAction to click a link in a webpage that then brings a popup windows titled "Message from webpage". I'm not sure why but I cannot interact with this window at all.

local $wint = "Message from webpage"
local $wintt = "You are about to change the status of the selected Carton(s).  Are you sure you want to continue?"
while 1
if WinExists($wint, $wintt) then
sleep(1000)
ControlSend("Message from webpage", "", "[CLASS:Button; INSTANCE:1]", "{enter}")
sleep(1000)
    EndIf
    wend

im trying the little bit of above code but cant get anything to work. Also tried just sending the enter key as at the time this window is focued anyway but it still did'nt work.

The below HTML is what i have used _IEAction to click in order to make the popup appear. script/CI_CartonCancel.htc is stored in a folder of the URL. As an alternative I was wondering if there is any easy way to run that script without navigating away from the page that I am on? Thanks in advance.

<a name="hid_Cancel Carton"  id="hid_cancel"  class="navlink"  style="behavior:url('script/CI_CartonCancel.htc')"  href= >Cancel Carton</a>

Edited by GlennRogers
Link to comment
Share on other sites

do a forum search for deadlocked process.

You either have to focus on the object that causes the window to open, and send enter at the window, or create a second process (call a second script) to use the _ie functions to click, so that process is deadlocked, and your initial script can interact with the window

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

You could try to create a script that sit on the tray, waiting for the popup window to appear, then send {ENTER} keystroke, like this:

While 1
    $hWin = WinGetActive()
    If WinExists("Message from webpage") Then
        WinActivate("Message from webpage")
        Send("{ENTER}")
        WinActivate($hWin[0])
    EndIf
    Sleep(10000) ; delay 10 secs to prevent our script hog the CPU
WEnd

Func WinGetActive()
    Dim $window[2]
    Dim $winlist
    $winlist = WinList()
    For $i = 1 To $winlist[0][0]
        If $winlist[$i][0] <> "" And IsVisible($winlist[$i][1]) Then
            $window[0] = $winlist[$i][0]
            $window[1] = $winlist[$i][1]
            ExitLoop
        EndIf
    Next
    Return $window
EndFunc   ;==>WinGetActive

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc   ;==>IsVisible
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...