Jump to content

Recommended Posts

Posted (edited)

In the hope that someone can shed some light on this issue

The below code works fine in Altiris 6

$oIE = _IECreate("http://webSite....")
WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE)
$oForm = _IEFormGetObjByName($oIE, "form1")
$oText = _IEFormElementGetObjByName($oForm, "parameterListCtrl:param0:value")
_IEFormElementSetValue($oText, "1234567")
_IELoadWait($oIE)

from the below Web Source Code:

table><span id="parameterListCtrl_param0" onkeypress="javascript:return keycheck(this);"><tr><td nowrap><span id="parameterListCtrl_param0_prompt" class="txtFldLabel">Computer Name:</span></td><td nowrap><input name="parameterListCtrl:param0:value" type="text" value="%" id="parameterListCtrl_param0_value" />

The below code however will not work in Altiris 7.1

$oIE = _IECreate("http://webSite....")
WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE)
$oForm = _IEFormGetObjByName($oIE, "form1")
$oText = _IEFormElementGetObjByName($oForm, "ContentHolder:DefaultReportView__2__1:ViewPanel:ParameterPanel:ExpandableParameterSection:ComputerName:ComputerName")
_IEFormElementSetValue($oText, "1234567")
_IELoadWait($oIE)

from the below Web Source Code:

id="ContentHolder_DefaultReportView__2__1_ViewPanel_ParameterPanel_ExpandableParameterSection_ComputerName"><span>Computer Name&nbsp;</span><input name="ContentHolder:DefaultReportView__2__1:ViewPanel:ParameterPanel:ExpandableParameterSection:ComputerName:ComputerName" type="text" value="%" id="ContentHolder_DefaultReportView__2__1_ViewPanel_ParameterPanel_ExpandableParameterSection_ComputerName_ComputerName" title="Computer Name" style="width:100px;"

Please advise where I'm going wrong because I'm starting to go nuts!

Many thanks in advance.

Mav

Edited by Iceman682
Posted (edited)

Ok, this is what I get:

--> IE.au3 V2.4-0 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

 

Which for the life of me don't understand given that the Object name is correct as I can see.

Below is what seems to be the function within the Web Source code:

/***********************************************************************/
 
/* GetClientValue for ContentHolder_DefaultReportView__2__1_ViewPanel_ParameterPanel_ExpandableParameterSection_ComputerName_ComputerName
 
/***********************************************************************/
 
function GetClientValue_ContentHolder_DefaultReportView__2__1_ViewPanel_ParameterPanel_ExpandableParameterSection_ComputerName_ComputerName() {
 
    // TODO: implement callback for validation and then return the checked value
 
    var editCtrl = document.getElementById("ContentHolder_DefaultReportView__2__1_ViewPanel_ParameterPanel_ExpandableParameterSection_ComputerName_ComputerName");
 
    if (editCtrl)
 
        return editCtrl.value;
 
    return '';
 
}
 
function intOnly_ContentHolder_DefaultReportView__2__1_ViewPanel_ParameterPanel_ExpandableParameterSection_ComputerName_ComputerName(e) {
 
    var keyNum;
 
    if(window.event) { // IE
 
        keyNum = e.keyCode;
 
    } else if(e.which) { // Netscape/Firefox/Opera
 
        keyNum = e.which;
 
    }
 
    if (keyNum == 8  ||    
 
        keyNum == 13 ||
 
        keyNum == 35 ||
 
        keyNum == 36 ||
 
        keyNum == 37 ||
 
        keyNum == 39 ||
 
        keyNum == 45 ||
 
        keyNum == 46 ||
 
        keyNum == 109 ||
 
        keyNum == 189) { 
 
        return true;    // Backspace, Enter, End, Home, Left, Right, Insert, Delete, - (keypad), -
 
    }
 
    if ((keyNum > 45 && keyNum < 58) || (keyNum > 95 && keyNum < 106))
 
        return true;    // numbers above letters and on keypad
 
    else
 
        return false;
 
}
 
// --></script><span id="ContentHolder_DefaultReportView__2__1_ViewPanel_ParameterPanel_ExpandableParameterSection_ComputerName"><span>Computer Name&nbsp;</span><input name="ContentHolder:DefaultReportView__2__1:ViewPanel:ParameterPanel:ExpandableParameterSection:ComputerName:ComputerName" type="text" value="%" id="ContentHolder_DefaultReportView__2__1_ViewPanel_ParameterPanel_ExpandableParameterSection_ComputerName_ComputerName" title="Computer Name" style="width:100px;" /></span></div></div>
 
<script type="text/javascript">aliScriptLink('awc.axd?r=ExpandableSectionControl.js&d=ExpandableSectionControl&v=7184000&rp=1');</script>
 
 
Edited by Iceman682
Posted

Yep with the same error.

--> IE.au3 V2.4-0 Warning from function _IEGetObjById, $_IEStatus_NoMatch (ContentHolder_DefaultReportView__2__1_ViewPanel_ParameterPanel_ExpandableParameterSection_ComputerName_ComputerName)
--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

Posted (edited)

I don't think I'm allowed from a security point I'm afraid :(

I think its due to it being javascript (that's a guess)

Edited by Iceman682
Posted (edited)

Hi DanP2

Many thanks for you attempting to assist.

I can see this being a very long and drawn out process trying to find how to do this.

I have managed to find a workaround by using Send("{TAB}"), although not perfect it seems to work ok. I just hope that the web page doesn't take too long to load eventhough I have a _IELoadWait($oIE), WinActivate and a Sleep(5000) otherwise I'm stuffed :)

$oIE = _IECreate("http://Webpage.com")
WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE)
_IELoadWait($oIE)
WinActivate("[CLASS:IEFrame]", "")
Sleep(5000)
Send("{TAB}")
Send("{TAB}")
Send("1234567")

Many thanks again.

Edited by Iceman682

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
  • Recently Browsing   0 members

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