Jump to content

Stuck on a popup


Recommended Posts

The script I was writing to auto register a program was working well till I was told to add and option if it was a replacement for some reason just sending enter wont get past the popup it generates. Wondering if anyone can help. I have posted the source of the page my script get stuck on and the part of my script that interacts with the page.

[html]<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title>Resource Centre - Licenses</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" link="#920077" vlink="#002F47"
alink="#920077" onload="licenseCheck()">
<script language="javascript">
function licenseCheck(){
    if(document.FORMMAIN != null && document.FORMMAIN.MacId != null)
    {
        document.FORMMAIN.MacId.focus();
    }
    else if(document.admin_form != null && document.admin_form.userId_Edit != null)
    {
        document.admin_form.userId_Edit.focus();
    }
    else if(document.ProdSpecAddEdit != null && document.ProdSpecAddEdit.AcctEmailAddr!= null)
    {
        document.ProdSpecAddEdit.AcctEmailAddr.focus();
    }
    else if(document.admin_form != null && document.admin_form.Reason!= null)
    {
        document.admin_form.Reason.focus();
    }
    else if(document.report_form != null && document.report_form.QueryParam!= null)
    {
        document.report_form.QueryParam.focus();
    }
    else if(document.NewLicDur != null && document.NewLicDur.LicenseDuration!= null)
    {
        document.NewLicDur.LicenseDuration.focus();
    }
    else if(document.NewLicType!= null && document.NewLicType.LicenseType!= null)
    {
        document.NewLicType.LicenseType.focus();
    }
    else if(document.NewPlatform!= null && document.NewPlatform.PlatformName!= null)
    {
        document.NewPlatform.PlatformName.focus();
    }
    else if(document.NewProduct!= null && document.NewProduct.productName!= null)
    {
        document.NewProduct.productName.focus();
    }
    else if(document.NewVersion!= null && document.NewVersion.version!= null)
    {
        document.NewVersion.version.focus();
    }
    if (document.FORMMAIN == null) return;
    if (document.FORMMAIN.LicenseType == null) return;
    if(document.FORMMAIN.LicenseType.selectedIndex == null) return;
    boxName = document.FORMMAIN.LicenseType.options[document.FORMMAIN.LicenseType.selectedIndex];
    licenseObject = document.FORMMAIN.LicenseDura;
    if(licenseObject){
        if (navigator.appName == "Microsoft Internet Explorer"){
            box = boxName.text;
            if (box.search("Temporary") != -1){
                licenseObject.disabled = false;
            } else {
                licenseObject.disabled = true;
            }
        }
    }
}
function confirmLicGen() {
    return confirm("By clicking on the 'Ok' button I agree to pay for all charges associated with the issue of this license.")
}
function confirmDelete() {
    return confirm("Are you sure you want to delete this data?")
}
function confirmSave() {
    return confirm("Are you sure you want to save these changes?")
}
function confirmChange() {
    return confirm("Are you sure you want to change this data?")
}
function validateEmailAddr(){
    emailAddr = document.FORMMAIN.EmailAdds.value;
    if ((emailAddr == "") ||
        (emailAddr.indexOf(" ") == -1))
        return true;
    alert("Spaces are not permitted in EMail addresses.  Please reenter your email address");
    document.FORMMAIN.EmailAdds.focus();
    return false;
}
function licenseTypeArrayRecord(id, licenseStatus) {    
    this.id = id;
    this.licenseStatus = licenseStatus;
}
function reasonRecord(id, name) {   
    this.id = id;
    this.name = name;
}
var licenseTypeArray = new Array();
var num1 = 0;
var replacementArray = new Array();
var num2 = 0;
var newSaleArray = new Array();
var num3 = 0;
function goBack(){ history.back() }
// this can be altered for any "checkOK" string you desire
function checkNumber(str) {
      var checkOK = "0123456789";
      var checkStr = str;
      var allValid = true;
      for (i = 0;  i < checkStr.length;  i++)
      {
        var ch = checkStr.charAt(i);
        for (var j = 0;  j < checkOK.length;  j++)
            if (ch == checkOK.charAt(j)){
                break;
            }
            if (j == checkOK.length)
            {
              allValid = false;
              break;
            }
      }
      if (!allValid)
      {
        return (false);
      }
      else{
          return (true);
      }
}
function setDurationValue(){
    var durValue = document.FORMMAIN.txtDur.value;
    if(durValue != null && durValue.length != 0 && checkNumber(durValue))
    {
        if(document.FORMMAIN.durBuffer != null){
            var durBufferSize = document.FORMMAIN.durBuffer.value;
            var fieldName = null;
            if(durBufferSize != null && durBufferSize.length != 0){
                for (i = 0; i <= durBufferSize; i++){
                    //fieldName = document.getElementsByName("DUR" + i);
                    fieldName = document.FORMMAIN['DUR' + i];
                    fieldName.value = durValue;
                }
            }
            return true;
        }
        else
        {
            alert("No duration field need to set.");
            return false;
        }
    }
    else
    {
        document.FORMMAIN.txtDur.value="";
        document.FORMMAIN.txtDur.focus();
        alert("Please enter only numeric characters in the \"duration text\" field.");
        return false;
    }
}
//2001-10-28 YL Changs 40
function checkIAPFileExtension() 
{
    var fileExt= document.ProdSpecAddEdit.IAPFileExtension.value;
    if(fileExt == "" || fileExt.length == 0)
    {
        document.ProdSpecAddEdit.IAPFileExtension.value ="bin";
    }
    else
    {
        fileExt = fileExt.replace('.', '');
        if(fileExt == "" || fileExt.length == 0)
        {
            document.ProdSpecAddEdit.IAPFileExtension.value ="bin";
        }
        document.ProdSpecAddEdit.IAPFileExtension.value =fileExt;
    }
    return true;
}
</script>
<table border="0" cellpadding="0" cellspacing="0" width="600">
    <tr>
        <td><img src="../images/dot_clear.gif" width="155"
        height="1"></td>
        <td><img src="../images/dot_clear.gif" width="440"
        height="1"></td>
    </tr>
    <tr>
    <td valign="top" height="62"><a name="top"></a><img src="../Images/Cedara_logo.jpg" width="102" height="82"> 
    </td>
        <td valign="top" height="62"><img src="../images/prodserv.jpg" alt="Products and Services" width="440" height="55"></td>
    </tr>
    <tr>
    <td valign="top" rowspan="2"> 
      <p><!--nav--> <!--Sleep                <TABLE BORDER=0 WIDTH=127 CELLPADDING=2 CELLSPACING=0>
                <TR><TD><A HREF="docs.html">    <IMG WIDTH=127 HEIGHT=22 BORDER=0 SRC="../images/vrbutton1.gif"  ALT="Documentation"></A></TD></TR>
                <TR><TD><A HREF="contacts.html"><IMG WIDTH=127 HEIGHT=22 BORDER=0 SRC="../images/vrbutton2.gif"  ALT="Contacts"></A></TD></TR>
                <TR><TD><A HREF="service.html"> <IMG WIDTH=127 HEIGHT=22 BORDER=0 SRC="../images/vrbutton3.gif"  ALT="Service/Support"></A></TD></TR>
                <TR><TD>                        <IMG WIDTH=127 HEIGHT=22 BORDER=0 SRC="../images/vrbutton4b.gif" ALT="Licenses"></TD></TR>
                <TR><TD><A HREF="training.html"><IMG WIDTH=127 HEIGHT=22 BORDER=0 SRC="../images/vrbutton5.gif"  ALT="Training"></A></TD></TR>
                <TR><TD><A HREF="tenders.html"> <IMG WIDTH=127 HEIGHT=22 BORDER=0 SRC="../images/vrbutton6.gif"  ALT="Tenders"></A></TD></TR>
                <TR><TD><A HREF="index.html">   <IMG WIDTH=127 HEIGHT=22 BORDER=0 SRC="../images/vrbutton8.gif"  ALT="Home"></A></TD></TR>
                </TABLE> Sleep--> <!--nav--> </p>
        </td>
        <td valign="top">
        <img src="../images/license.jpg" alt="licenses"
        width="238" height="129"><br>
<script LANGUAGE="javascript">
licenseTypeArray[num1++] = new licenseTypeArrayRecord('New Sales Permanent', '0');
licenseTypeArray[num1++] = new licenseTypeArrayRecord('Replacement Permanent', '1');
replacementArray[num2++] = new reasonRecord('Select Reason','Select Reason');
replacementArray[num2++] = new reasonRecord('Administration Correction', 'Administration Correction');
replacementArray[num2++] = new reasonRecord('Configuration or Feature Change', 'Configuration or Feature Change');
replacementArray[num2++] = new reasonRecord('Hardware Change', 'Hardware Change');
replacementArray[num2++] = new reasonRecord('License Expired', 'License Expired');
replacementArray[num2++] = new reasonRecord('Other', 'Other');
replacementArray[num2++] = new reasonRecord('Software Reload or reinstall', 'Software Reload or reinstall');
replacementArray[num2++] = new reasonRecord('Software Upgrade', 'Software Upgrade');
replacementArray[num2++] = new reasonRecord('Transfer to another system or user', 'Transfer to another system or user');
newSaleArray[num3++] = new reasonRecord('Select Reason','Select Reason');
newSaleArray[num3++] = new reasonRecord('Administration Correction', 'Administration Correction');
newSaleArray[num3++] = new reasonRecord('Demo', 'Demo');
newSaleArray[num3++] = new reasonRecord('New Sale', 'New Sale');
newSaleArray[num3++] = new reasonRecord('Other', 'Other');
newSaleArray[num3++] = new reasonRecord('Previous Server Code Not matched', 'Previous Server Code Not matched');
newSaleArray[num3++] = new reasonRecord('Previous Server Code unknown', 'Previous Server Code unknown');
newSaleArray[num3++] = new reasonRecord('Software Reload or reinstall', 'Software Reload or reinstall');
function changeLicenseType(licenseTypeID) { 
    var recordIndex = -1; 
    var licenseStatus = 0; 
    for ( i = 0; i < licenseTypeArray.length; i++ ) { 
        if ( licenseTypeArray[i].id == licenseTypeID ) { 
            recordIndex = i; 
            licenseStatus = licenseTypeArray[i].licenseStatus; 
            break; 
        } 
    } 
    if ( recordIndex != -1 ){ 
        document.FORMMAIN.reason.options.length = 0; 
        if(licenseStatus == 1)  
            fillReplacementList(); 
        else 
            fillNewSaleList(); 
    } 
    else 
        alert('LicenseType not found'); 
} 
function fillReplacementList(){ 
    document.FORMMAIN.reason.options.length = 0; 
    var count = 0; 
    for ( k = 0; k < replacementArray.length; k++ ){  
        document.FORMMAIN.reason.options[count++] = new Option(replacementArray[k].name, replacementArray[k].name); 
    } 
} 
function fillNewSaleList(){ 
    document.FORMMAIN.reason.options.length = 0; 
    var count = 0; 
    for ( j = 0; j < newSaleArray.length; j++ ){ 
        document.FORMMAIN.reason.options[count++] = new Option(newSaleArray[j].name, newSaleArray[j].name); 
    } 
} 
</SCRIPT>
<script LANGUAGE="javascript">
function checkValue() {
    if (document.FORMMAIN.MacId.value == "") {
        alert ("Please input the value of Machine Id");
        document.FORMMAIN.MacId.focus();
        return false;
    }
    if (document.FORMMAIN.Sitename.value == "" || document.FORMMAIN.Sitename.value.length == 0) {
        alert ("Please enter a Site Name.");
        document.FORMMAIN.Sitename.focus();
        return false;
    }
    if (document.FORMMAIN.Customer_Ref.value == "" || document.FORMMAIN.Customer_Ref.value.length == 0){
        alert("Please input the value of Customer Reference");
        document.FORMMAIN.Customer_Ref.focus();
        return false;
    }
    if (document.FORMMAIN.LicenseType != null) {
        var strLicenseType = document.FORMMAIN.LicenseType.value;
        var strReason      = document.FORMMAIN.reason.value;
        if((strLicenseType.toUpperCase()).match("REPLACEMENT") != null && (strReason.toUpperCase()).match("SELECT REASON") != null){
            alert("You must select an item from the Reason list!");
            document.FORMMAIN.reason.options[0].selected;
            return false;
        }
        if((strLicenseType.toUpperCase()).match("REPLACEMENT") != null && (document.FORMMAIN.OldKey.value == "" && document.FORMMAIN.OldID.value == "")){
            alert("Please input the value of an Old Machine Id or Old Transaction Id.");
            document.FORMMAIN.OldKey.focus();
            return false;
        }
    }
    if (confirmLicGen()) document.FORMMAIN.submit();
}
</SCRIPT>
<FORM NAME="FORMMAIN" METHOD="POST" ACTION="../cgi-bin/main.exe">
<P>
<INPUT TYPE="HIDDEN" NAME="creds" VALUE="RWSKCPL">
<INPUT TYPE="hidden" NAME="template" VALUE="cedara_template.html">
<center><h2> License Request </h2><hr width=80%><font size=3></center>
<P>
Please fill in the appropriate parameters and  click on Request License to generate a License Request.</P>
<P>
<table width=100% height=100%>
<tr>
<td>Customer: </td>
<td>Zwanger-Pesiri Radiology Group</td>
<td>Requestor: </td>
<td>Zwanter-Pesini</td>
</tr>
<tr>
<td>Product: </td>
<td>Cedara I-ReadMammoPlus</td>
<td>Version: </td>
<td>R6.2 GMA</td>
</tr>
<tr>
<td>Platform: </td>
<td colspan=3><SELECT NAME="Platform">
<OPTION>Windows 2000
<OPTION SELECTED> Windows XP
</SELECT></td>
</tr>
<P>
<tr>
<td id="mandatoryField" NOWRAP>License Type: *</td>
<td><SELECT NAME="LicenseType" onchange="changeLicenseType(document.FORMMAIN.LicenseType.value);licenseCheck();">
<OPTION VALUE="New Sales Permanent" >New Sales Permanent
<OPTION VALUE="Replacement Permanent" >Replacement Permanent
</SELECT></td>
<td NOWRAP>License Duration: </td>
<td><SELECT NAME="LicenseDura">
<OPTION SELECTED>7 Days
<OPTION>10 days
<OPTION>15 Days
<OPTION>30 Days
<OPTION>45 Days
<OPTION>60 Days
<OPTION>90 Days
</SELECT></td>
</tr>
<tr>
<td NOWRAP>Reason: </td>
<td><SELECT NAME="reason" SIZE=1>
<OPTION VALUE="Select Reason" SELECTED>Select Reason
<OPTION VALUE="Administration Correction" >Administration Correction
<OPTION VALUE="Demo" >Demo
<OPTION VALUE="New Sale" >New Sale
<OPTION VALUE="Other" >Other
<OPTION VALUE="Previous Server Code Not matched" >Previous Server Code Not matched
<OPTION VALUE="Previous Server Code unknown" >Previous Server Code unknown
<OPTION VALUE="Software Reload or reinstall" >Software Reload or reinstall
</SELECT></td>
<td NOWRAP>Details: </td>
<td><INPUT TYPE="text" NAME="replR" SIZE=25 MAXLENGTH=254></td>
</tr>
<tr>
<td id="mandatoryField" NOWRAP>Machine Id: *</td>
<td colspan=3><INPUT TYPE="text" NAME="MacId" SIZE=55 MAXLENGTH=50></td>
</tr>
<tr>
<td NOWRAP>Old Machine Id: </td>
<td ><INPUT TYPE="text" NAME="OldKey" SIZE=30 MAXLENGTH=50></td>
<td NOWRAP>Old Transaction Id: </td>
<td><INPUT TYPE="text" NAME="OldID" SIZE=25 MAXLENGTH=50></td>
</tr>
<tr>
<td NOWRAP>Email Address: </td>
<td><INPUT TYPE="text" NAME="EmailAdds" SIZE=30 MAXLENGTH=254></td>
<td id="mandatoryField" NOWRAP>Customer Ref: *</td>
<td><INPUT TYPE="text" NAME="Customer_Ref" SIZE=25 MAXLENGTH=50</td>
</tr>
<tr>
<td id="mandatoryField" NOWRAP>Site Name: *</td>
<td><INPUT TYPE="text" NAME="Sitename" SIZE=30 MAXLENGTH=50></td>
<td NOWRAP>Host Name: </td>
<td><INPUT TYPE="text" NAME="Hostname"  SIZE=25 MAXLENGTH=50></td>
</tr>
<tr>
<td NOWRAP>Notes: </td>
<td colspan = 3><textarea rows="4" TYPE="texteara" NAME="Notes" cols="70" MAXLENGTH=255></textarea></td>
</tr>
<tr>
<td id="mandatoryField" colspan = 4> </td>
</tr>
<tr>
<td id="mandatoryField" colspan = 4>* - indicates required fields. </td>
</tr>
<tr>
<td id="mandatoryField" colspan = 4> </td>
</tr>
<tr><td colspan=4>Features:</td>
</tr></table><P>
<table border width=100% height=100%>
<tr>
<td><INPUT TYPE = "checkbox" NAME="FT0" VALUE="3189" > Softstore Integration (P#: I-INT-SSI)</td>
<td><INPUT TYPE = "checkbox" NAME="FT1" VALUE="3199" > VRS Server/Broker (P#: I-INT-VRS)</td>
</tr>
<tr>
<td><INPUT TYPE = "checkbox" NAME="FT2" VALUE="3206" > Single Media Archive (P#: I-M-SMAV)</td>
</tr>
</table>
<p>
By requesting this license you are acknowledging the existence of the license agreement, and are agreeing to abide by it.
<P>
<table>
<tr>
<td><INPUT TYPE="button" NAME="Action"  VALUE="Request License" onclick='checkValue(); '></td>
<td><INPUT TYPE="Reset" VALUE=" Clear "></td>
<td><INPUT TYPE="submit" NAME="Action"  VALUE="Signoff"></td>
<td><INPUT TYPE="button" NAME="Action"  VALUE="Help" onclick="window.open('../HelpSubSystem/weblicense.htm', 'helpWindow', 'width=618, height=410, resizable=yes, toolbar=yes, menubar=yes, status=yes');"></td>
</tr>
</table>
<table>
<tr>
<td id="mandatoryField" colspan = 4> </td>
</tr>
<tr>
<td id="mandatoryField" colspan = 4><B>Click the HELP button, then GETTING STARTED to learn about improvements we've made to our WEB LICENSING. </B></td>
</tr>
</table>
<INPUT TYPE="HIDDEN" NAME="nSRV" VALUE="0">
<INPUT TYPE="HIDDEN" NAME="nFT" VALUE="3">
<INPUT TYPE="HIDDEN" NAME="ProdVer_Key" VALUE="2563">
<P>
</FORM>
                <!-- footer -->        <p><a href="#top"><font size="2" face="Arial, Helvetica">Top
        of Page</font></a> </p>
        <p><img src="../images/302dot.gif" width="440" height="2"></p>
        <p><!--Sleep       <FONT SIZE=2 FACE="Arial, Helvetica"><A HREF="docs.html">Documentation</A> | <A HREF="contacts.html">Contacts</A> | <A HREF="service.html">Service/Support</A> | 
                <B>Licenses</B> | <A HREF="training.html">Training</A> <BR> <A HREF="tenders.html">Tenders</A> | <A HREF="index.html">Home</A></FONT><P>
                <P><IMG WIDTH=440 HEIGHT=2 SRC="../images/302dot.gif"><P> Sleep--> <font size="1" face="Arial, Helvetica">Published June
        16, 1998. Updated November 10, 2003.<br>
        Please direct all questions or comments regarding these
        pages to: </font><a
        href="mailto:license.request@cedara.com"><font size="1"
        face="Arial, Helvetica">license.request@cedara.com</font></a><font
        size="1" face="Arial, Helvetica">.<br>
        <br>
        Padlock image copyright © 1998 Photodisc, Inc.</font> <!-- footer --> </p>
        </td>
    </tr>
</table>
</body>
</html>[/html]

</div></div></div>

Edited by ChronoStriker1
Link to comment
Share on other sites

What have you tried so far?

Edit: Btw, is this the window you are talking about?

function confirmLicGen() {return confirm("By clicking on the 'Ok' button I agree to pay for all charges associated with the issue of this license.")}

Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

What have you tried so far?

Edit: Btw, is this the window you are talking about?

function confirmLicGen() {
return confirm("By clicking on the 'Ok' button I agree to pay for all charges associated with the issue of this license.")
}

Yeah I believe that is the popup. I have tried focusing that window then clicking, hitting enter and space. Ive tried a couple of things I found on the forum for popups that wont go away, but I dont remember which. Ill have to do a search and get back to you.
Link to comment
Share on other sites

Opt("WinTitleMatchMode", 3) ;Set's the option so that the title must match exactly
WinWait( "Windows Internet Explorer", "")
ControlClick( "Windows Internet Explorer", "OK", 1 )oÝ÷ Ù«­¢+ØÀÌØí¡Ý¹ô}%AɽÁÉÑåÐ ÀÌØí½%°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì¤)
½¹Ñɽ±M¹ ÀÌØí¡Ý¹°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðíí¹ÑÉôÅÕ½Ðì¤

There were more but I cant find them right now

Link to comment
Share on other sites

The method Confirm() creates a dialog box that is holding the browser from doing anything else until it is dismissed. Your script is waiting for the broswer to return from the click event, therefore it hangs. I have had trouble in the past with dialog boxes in IE, and I still haven't found a great way to handle them. If the dialog window contains the control "Internet Explorer_Server1", you can use the same method Dale uses in his _IEAttach ("DialogBox" option). Or if it is a standard Win32 window, you can use normal Win functions to handle it. Your case is neither of these, so here's a work around: (kind of crude, but you can give your script control back)

AdlibEnable("WhackPopUp")

$oButton = _IEGetObjByName($oIE, "Action")
_IEAction($oButton, "focus")
Send("{SPACE}")

Func WhackPopUp()
    If WinExists($title, $text) Then
        ControlClick($title, "", 1)
    EndIf
EndFunc

It's the same work around used for <INPUT>'s of the "file elements" type....focus on the object, then Send(). I haven't tested, but a ControlSend should work as well. AdlibEnabling is just one way to handle the window, now that your script has control, you can use whatever method you like. Perhaps Dale can provide us with a better solution for handling dialog boxes. Hope this helps.

Edit: Changed ControlClick($title, "", 2) to ControlClick($title, "", 1)

Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

I tested it, and it works. Post your code and what you're having trouble with. "It doesn't work" doesn't mean anything to me. :whistle:

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Yeah, sorry about that, I hate when people do that to me so youd think Id know better.

#include <IE.au3>
dim $radio1
$replacement = $radio1
$oIE = _IECreate()
_IENavigate($oIE, "http://wobble.cedara.com/wbl")
$userid = _IEGetObjByName($oIE, "UserId")
_IEFormElementSetValue($userid, "******")
$password = _IEGetObjByName($oIE, "password")
_IEFormElementSetValue($password, "*******")
$oSignon = _IEGetObjByName($oIE, "action")
_IEAction($oSignon, "click")
_IELoadWait ($oIE)
$product = _IEGetObjByName($oIE,"Product")
_IEFormElementSetValue($product, "2563")
$next = _IEGetObjByName($oIE, "action")
_IEAction($next, "click")
_IELoadWait ($oIE)
$macid = _IEGetObjByName($oIE, "MacId")
;my machine ID remove if $machineid = ClipGet() works
_IEFormElementSetValue($macid, ClipGet())
$custref = _IEGetObjByName($oIE, "Customer_Ref")
_IEFormElementSetValue($custref, "Zwanger")
$sitename = _IEGetObjByName($oIE, "Sitename")
_IEFormElementSetValue($sitename, "Zwanger")
$reqlicence = _IEGetObjByName($oIE, "Action")
;enter replacement code
If $replacement = $radio1 Then
    $licencetype = _IEGetObjByName($oIE, "LicenseType")
    _IEFormElementSetValue($licencetype, "Replacement Permanent")
    $reason = _IEGetObjByName($oIE, "reason")
    _IEFormElementSetValue($reason, "Software Reload or reinstall")
    $oldmachineid = _IEGetObjByName($oIE, "OldKey")
    _IEFormElementSetValue($oldmachineid, ClipGet())
EndIf
_IEAction($reqlicence, "click")
AdlibEnable("WhackPopUp")

$oButton = _IEGetObjByName($oIE, "Action")
_IEAction($oButton, "focus")
Send("{SPACE}")
_IELoadWait ($oIE)
;Send("{ENTER}")
;more replacement code
If $replacement = $radio1 Then
    ;there has to be user interaction here...
    MsgBox(0, "User Interaction", "You need to select the licence.  Don't touch anything else!  You have 30 sec after hitting ok, or you break the script (dirty hack cause I cant think right now).")
    sleep(30000)
    $reqlicence = _IEGetObjByName($oIE, "Action")
    _IEAction($reqlicence, "click")
    $oButton = _IEGetObjByName($oIE, "Action")
    _IEAction($oButton, "focus")
    Send("{SPACE}")
    _IELoadWait ($oIE)
EndIf
$oTable = _IETableGetCollection ($oIE, 1)
$aTableData = _IETableWriteToArray ($oTable)
$regcode = $aTableData[1][9]
_IEQuit($oIE)

Func WhackPopUp()
    If WinExists("Windows Internet Explorer", "By clicking on the") Then
        ControlClick("Windows Internet Explorer", "", 1)
    EndIf
EndFunc
Link to comment
Share on other sites

Just remove:

_IEAction($reqlicence, "click")

Should work for you then. The Send("{SPACE}") is doing the actual clicking.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

I saved your source to my HDD and ran the original code I posted, and it handled the pop-up just fine. Can you make a reproducer of your problem? Make it the smallest amount of code possible (ie. remove the logging in, and everything after the pop-up is handled). I opened your page in IE, set the required values to junk stuff, clicked ok, and then handled the pop-up. Show me some trimmed code.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Ok I cut it down to this

#include <IE.au3>
dim $radio1
$replacement = $radio1
$oIE = _IECreate()
_IENavigate($oIE, "file:///C:/Users/jschiller/Desktop/main.html")
_IELoadWait ($oIE)
$product = _IEGetObjByName($oIE,"Product")
_IEFormElementSetValue($product, "2563")
$next = _IEGetObjByName($oIE, "action")
_IEAction($next, "click")
_IELoadWait ($oIE)
$macid = _IEGetObjByName($oIE, "MacId")
;my machine ID remove if $machineid = ClipGet() works
_IEFormElementSetValue($macid, ClipGet())
$custref = _IEGetObjByName($oIE, "Customer_Ref")
_IEFormElementSetValue($custref, "Zwanger")
$sitename = _IEGetObjByName($oIE, "Sitename")
_IEFormElementSetValue($sitename, "Zwanger")
$reqlicence = _IEGetObjByName($oIE, "Action")
;enter replacement code
If $replacement = $radio1 Then
    $licencetype = _IEGetObjByName($oIE, "LicenseType")
    _IEFormElementSetValue($licencetype, "Replacement Permanent")
    $reason = _IEGetObjByName($oIE, "reason")
    _IEFormElementSetValue($reason, "Software Reload or reinstall")
    $oldmachineid = _IEGetObjByName($oIE, "OldKey")
    _IEFormElementSetValue($oldmachineid, ClipGet())
EndIf
_IEAction($reqlicence, "click")
AdlibEnable("WhackPopUp")

$oButton = _IEGetObjByName($oIE, "Action")
_IEAction($oButton, "focus")
Send("{SPACE}")
_IELoadWait ($oIE)

Func WhackPopUp()
    If WinExists("Windows Internet Explorer", "By clicking on the") Then
        ControlClick("Windows Internet Explorer", "", 1)
    EndIf
EndFunc

It looks like its just skipping that popup so it then goes to my msgbox. Only problem is that on the real page it does the same thing but it doesnt load the next page.

Edited by ChronoStriker1
Link to comment
Share on other sites

You still had a bunch of clicks in there...what I'm trying to say is that a click leaves your browser in control, and your browser will wait until the dialog box is dismissed. If you hit the buttons that force dialog boxes with a click, your script will stall. That's the point of that little snippet I posted.

#include <IE.au3>

AdlibEnable("WhackPopUp")

$oIE = _IECreate("file:///C:/Users/jschiller/Desktop/main.html", 1)
$product = _IEGetObjByName($oIE,"Product")
_IEFormElementSetValue($product, "2563")
$macid = _IEGetObjByName($oIE, "MacId")
_IEFormElementSetValue($macid, "JUNK")
$custref = _IEGetObjByName($oIE, "Customer_Ref")
_IEFormElementSetValue($custref, "Zwanger")
$sitename = _IEGetObjByName($oIE, "Sitename")
_IEFormElementSetValue($sitename, "Zwanger")
$reqlicence = _IEGetObjByName($oIE, "Action")
$oButton = _IEGetObjByName($oIE, "Action")
_IEAction($oButton, "focus")
Send("{SPACE}")
_IELoadWait ($oIE)
Sleep(5000)

Func WhackPopUp()
    If WinExists("Windows Internet Explorer", "By clicking on the") Then
        ControlClick("Windows Internet Explorer", "", 1)
    EndIf
EndFunc

PS. See how little of the code I needed to reproduce your situation? I'd rather not have to trim it down like this myself...

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

I guess I'm not understanding but your code is almost identical to mine, I left in something from the previous page at the top by accident

_IELoadWait ($oIE)
$product = _IEGetObjByName($oIE,"Product")
_IEFormElementSetValue($product, "2563")
$next = _IEGetObjByName($oIE, "action")
_IEAction($next, "click")

and I need that if statement in there because some of our installations are reinstallations so we dont want to pay for multiple licenses. In fact I'm trying to make it so it uses the if cause I was able to get it working without it just by send("{ENTER}") there is something there causing the problem.

Link to comment
Share on other sites

It's the click you are doing! I can't be any clearer on that...you are clicking the button, which I am trying to show you how to work around. Those If statements are fine, as long as you don't click the bloody button. Any place you need to click the button, use a focus followed by a Send.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Are you focusing on the button before you Send? You can post the specific code you are having trouble with. Remember I am using the exact HTML code you presented in your first post. I can almost 100% guarantee that the last code I posted will handle the HTML you provided.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Right, and are you sending "SPACE" immediately after that?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Right, and are you sending "SPACE" immediately after that?

Yes

Also I was looking at the example for _IEAction in the help file and replaced the click in it for focus and added a Send("{SPACE}") after it and Im getting the same problem where its sending the space to the address bar.

#include <IE.au3>
$oIE = _IE_Example ("form")
$oSubmit = _IEGetObjByName ($oIE, "submitExample")
_IEAction ($oSubmit, "focus")
Send("{SPACE}")
_IELoadWait ($oIE)
Edited by ChronoStriker1
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...