Jump to content

evering7

Members
  • Posts

    3
  • Joined

  • Last visited

evering7's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: JianFei Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase ; http://www.kjjxjy.com/WebAcc/?ver=1 Local $urlStart, $oIE Local $oForms , $oForm; Local $oQuery; $urlStart = "http://10.68.108.16/LangChao.ECGAP.InPortal/login/formlogin.aspx" $oIE = _IECreate ($urlStart) ; windows position _IEPropertySet($oIE, "left",0) _IEPropertySet($oIE, "top",0) _IEPropertySet($oIE, "width", @DesktopWidth) _IEPropertySet($oIE, "height", @DesktopHeight) sleep(2000) ;send("{ENTER}") ;$oForm = _IEFormGetCollection ($oIE, 0) ;$oIE = _IECreate ("http://www.autoitscript.com") $oForms = _IEFormGetCollection ($oIE) ConsoleWrite( "Forms Info There are " & @extended & " forms on this page" & @CRLF) For $oForm In $oForms ConsoleWrite( "Form Info " & $oForm.name & @CRLF) Next ConsoleWrite("End loop of IE Forms" & @CRLF) $oForm = _IEFormGetCollection ($oIE, 0) ;input user name $oQuery = _IEFormElementGetObjByName ($oForm, "txtUser") _IEFormElementSetValue ($oQuery, "zh") ;password $oQuery = _IEFormElementGetObjByName ($oForm, "txtPass") _IEFormElementSetValue ($oQuery, "1") ;click image button ;$oQuery = _IEFormElementGetObjByName ($oForm, "ImageButton1") _IEFormImageClick ($oForm, "ImageButton1", "name") ;$oIE = _IE_Example ("frameset") local $oFrames = _IEFrameGetCollection($oIE) local $iNumFrames = @extended local $i local $oFrame local $oFrameLeft Local $strFrameUrl ConsoleWrite("Frame number = " & $iNumFrames & @CRLF) For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection ($oIE, $i) ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF) $strFrameUrl = _IEPropertyGet ($oFrame, "locationurl") if StringRight($strFrameUrl, 10) = "/left.aspx" Then $oFrameLeft = $oFrame ; get correct url endif Next _IELinkClickByText ($oFrameLeft, "业务办理") ;click the link in left frame sleep(3000) $oFrames = _IEFrameGetCollection($oIE) $iNumFrames = @extended local $oFrameShouJian local $TempStrUrl = "/newwork.aspx?StartType=ShouJian" For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection ($oIE, $i) ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF) $strFrameUrl = _IEPropertyGet ($oFrame, "locationurl") ConsoleWrite("get frame URL: " & $strFrameUrl & @CRLF) ;if StringRight($strFrameUrl, 12) = "/conLeft.htm" Then if StringRight($strFrameUrl, stringlen($TempStrUrl)) = $TempStrUrl Then ConsoleWrite("hit correct URL" & @CRLF) $oFrameShouJian = $oFrame ; assign correct url endif Next ConsoleWrite("get span id" & @CRLF) local $oSpan = _IEGetObjById ($oFrameShouJian, "Datagrid1__ctl2_TreeView1t0") ConsoleWrite("have got span id = " & $oSpan.id & @CRLF) ;$oSpan.fireEvent("onclick") local $oChildDiv = $oSpan.firstChild Local $oChildSpan = $oChildDiv.firstChild $oChildSpan.fireEvent("onclick") local $Error local $InputApplyName = "" Do $InputApplyName = InputBox("name ","applier name") Until not ($InputApplyName ="") ;================================================== Get the frame of content ================================== ; The source content of the frame is as follwing $oFrames = _IEFrameGetCollection($oIE) $iNumFrames = @extended local $oFrameShouLi $TempStrUrl = "&ChineseWord=&EnterpriseName=&fieldPath=" ;http://10.68.108.16/LangChao.ECGAP.InPortal/Business/ShowTodoWork.aspx?ActivitySchemeGuid=791a0ed2-57b2-4d05-aac6-1f12d74dff36&ActivityModelStepId=3&FormID=CXQCZJ_TongYongBiaoDan&ActivityModelGuid=ab033083-3b3f-4e63-8d71-10fd27d3ca83&AppType=WkFlow&Wf=first&type=new&SerailNO=36015&acttype=&acttypefrom=&SequenceNum=inspur0000035419&ChineseWord=&EnterpriseName=&fieldPath= For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection ($oIE, $i) ;ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF) $strFrameUrl = _IEPropertyGet ($oFrame, "locationurl") ConsoleWrite("get URL of form to fill in: " & $strFrameUrl & @CRLF) ;if StringRight($strFrameUrl, 12) = "/conLeft.htm" Then if StringRight($strFrameUrl, stringlen($TempStrUrl)) = $TempStrUrl Then ConsoleWrite("hit URL" & @CRLF) $oFrameShouLi = $oFrame ; endif Next ;============ The above is ok. The problem come up when executing the following code to try accessing some input box in IE frame === ;============ The source code of the frame is as attached ;============ The following iteration can't find the correct input box of "ShengQingZhe" ;============ I try to set value of the input box but fail to get access to its reference, not even say assigning value local $oElement local $oInputs = _IETagNameAllGetCollection ($oFrameShouLi) local $TempRecordOfInputStr For $oElement In $oInputs $TempRecordOfInputStr = "name = " & $oElement.tagname & " id = " & $oElement.id & @CRLF MsgBox(0, "Form Input Type", $TempRecordOfInputStr) Next ;The following accessing for ShenQingZhe would bring up error, no find. local $oShenQingZhe = _IEGetObjById ($oFrameShouLi,"ShenQingZhe") ;$oShenQingZhe.value = "xxx" ;_IEFormElementSetValue ($oShenQingZhe, $InputApplyName) local $oLianXiRen = _IEGetObjByName($oFrameShouLi,"LianXiRen") ;_IEFormElementSetValue ($oLianXiRen, $InputApplyName)The autoit code I trying to access the IE input box
  2. Dear friends from AutoIt forum, I am a AutoIt fan in China. And I come across a problem when I tried to set a value of input box in IE using AutoIt script. The source code of au3 file and corresponding frame html is as attached. I try to set the value of input txt box(id=ShengQingZhe) in the frame in IE, but I can't even get the correct reference to this DOM object of input txt box. Could anyone give me a clue or suggestion on how to access the input txt box (id=ShengQingZhe)? I have tried many IE UDF function to access the input box object, but fail to execute and get results. These functions include _IETagNameAllGetCollection, _IETagNameGetCollection, _IEFrameGetObjByName, _IEGetObjByName, _IEGetObjById, _IEFormGetObjByName, _IEFormElementGetObjByName, etc. I would be very grateful if anyone could help me out. JF --> The html source code of webpage <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> </HEAD> <link rel="stylesheet" href="css/form0.css"> <LINK href="../../css/pub.css" type="text/css" rel="stylesheet"> <script language="javascript" src="js/fc.js" ></script> <script language="javascript" src="js/pubfunction.js" ></script> <script language='javascript' src='calendar/script/Popup.js' ></script> <script language="javascript" src="js/custom.js" ></script> <script language="javascript" > </script> <body MS_POSITIONING='GridLayout' onload='initpages();initdynas();' onunload='formunload();'> <form id='Form1' method='post' action="../pages/getValue.aspx?formname=CXQCZJ_TongYongBiaoDan" name='Form1'> <table cellspacing=0 class='tableall' align=center ><tr><td class='tdfieldset'><fieldset id='actionarea' class='actionareacss' ><P align=right></P></fieldset></td></tr><tr><td class='tdcontent'><table border=1 id='tab_table' ><tr><td className='taboncss' id='td_CXQCZJ_TongYongBiaoDan_Page_NAPZ1501' onclick="doTabpageClick('tab_table');showpage('pages_div','CXQCZJ_TongYongBiaoDan_Page_NAPZ1501')" >&nbsp&nbsp申请表&nbsp&nbsp</td></tr></table><table width='100%' border='0' bgcolor="#FFFFFF"><tr><td height='20' background="images/ecgapform.gif"></td></tr></table> <div class='formcontent'><Div id='pages_div' ><Div id='CXQCZJ_TongYongBiaoDan_Page_NAPZ1501' ><P align=center><FONT size=5><STRONG>项目申请表</STRONG></FONT></P> <P align=center><FONT size=5></FONT>&nbsp;</P> <P align=center><FONT size=5> <TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=1 borderColorDark=#000000 cellPadding=1 width="100%" borderColorLight=#000000 border=1> <TBODY> <TR> <TD borderColor=#000000 width="15%"> <P align=center>申请者:</P></TD> <TD borderColor=#000000 width="35%"><INPUT class="" onkeypress="" id=ShenQingZhe onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" onchange="" name=ShenQingZhe v_maxlength="100" v_must="1" v_name="申请者" elementType="txt"></TD> <TD borderColor=#000000 width="15%"> <P align=center>申请日期:</P></TD> <TD borderColor=#000000 width="35%"><INPUT class="" onkeypress="" id=ShenQingRiQi onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 80%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" readOnly onchange="" size=10 name=ShenQingRiQi v_must="0" v_name="申请日期" elementType="date" v_type="date"> <IMG style="CURSOR: hand" onclick="getDate('ShenQingRiQi','rowIndex')" alt=弹出日历下拉菜单 src="images/datetime.gif" align=absMiddle name=img_ShenQingRiQi></TD></TR> <TR> <TD borderColor=#000000 width="15%"> <P align=center>联系人:</P></TD> <TD borderColor=#000000 width="35%"> <P align=center><INPUT class="" onkeypress="" id=LianXiRen onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" onchange="" name=LianXiRen v_maxlength="100" v_must="0" v_name="联系人" elementType="txt"></P></TD> <TD borderColor=#000000 width="15%"> <P align=center>联系电话:</P></TD> <TD borderColor=#000000 width="35%"><INPUT class="" onkeypress="" id=LianXiDianHua onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" onchange="" name=LianXiDianHua v_maxlength="100" v_must="1" v_name="联系电话" elementType="txt"></TD></TR> <TR> <TD borderColor=#000000 width="15%"> <P align=center>联系地址:</P></TD> <TD borderColor=#000000 width="35%" colSpan=3> <P align=left><INPUT class="" onkeypress="" id=LianXiDiZhi onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" onchange="" name=LianXiDiZhi v_maxlength="100" v_must="0" v_name="联系地址" elementType="txt"></P></TD></TR> <TR> <TD borderColor=#000000 width="15%"> <P align=center>备注:</P></TD> <TD borderColor=#000000 width="35%" colSpan=3><TEXTAREA class="" onkeypress="" id=BeiZhu onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid; HEIGHT: 135px" onpropertychange="" onfocus="" onclick="" name=BeiZhu rows=7 onchange="" v_must="0" v_name="备注" elementType="area"></TEXTAREA></TD></TR></TBODY></TABLE></FONT></P></div></div></div></td></tr></table> <input type='hidden' name='docId' id='docId' value=''> <input type='hidden' name='rtnName' id='rtnName' value=''> <input type='hidden' name='formid' value='CXQCZJ_TongYongBiaoDan'> <input type='hidden' name='signfield1' value=''> <input type='hidden' name='signfield2' value=''> <input type='hidden' name='businessrelationid' value=''> </form> <script>var titleColStr="";</script> <script language='javascript'> var IsLicensePrintConfig = ''; AcceptSendMessageTip = 'no'; var FinishSendMessageTip = ''; FinishSendMessageTip = 'no'; var ShouLiPingYiConfig = ''; ShouLiPingYiConfig = 'no'; var PingYiConfig = ''; PingYiConfig = 'no'; var LangChao_ECGAP_Signature_SignatureSystem = 'jgkj'; var LangChao_ECGAP_Signature_SignatureServiceUrl = 'http://www.utcsoft.com/utcgetinfo.aspx'; var LangChao_ECGAP_Signature_UserID = '00054'; var LangChao_ECGAP_Signature_UserName = ''; var LangChao_ECGAP_Signature_DeptID = 'inspur001010'; var LangChao_ECGAP_Signature_DeptName = ''; var attString='791a0ed2-57b2-4d05-aac6-1f12d74dff36;;0;1;1;1;1;CXQCZJ_TongYongBiaoDan';var bManualSend = false;var LangChao_ECGAP_InPortal_MessageCenter_bNeedConfirmSendTacheStartMsg = false;var LangChao_ECGAP_InPortal_MessageCenter_bNeedConfirmSendToDoWorkMsg = false;var LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType = new Array(3); LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['grantpermit'] = false; LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['notgrantpermit'] = true; LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['reportnotgrantpermit'] = true; var LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType = new Array(3); LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['grantpermit'] = false; LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['notgrantpermit'] = true; LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['reportnotgrantpermit'] = true; var PingYiConfig = ''; PingYiConfig = 'no'; var IsLicensePrintConfig = ''; IsLicensePrintConfig = 'yes'; var LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType = new Array(3); LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['grantpermit'] = false; LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['notgrantpermit'] = true; LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['reportnotgrantpermit'] = true; var PingYiConfig = ''; PingYiConfig = 'no'; var IsLicensePrintConfig = ''; IsLicensePrintConfig = 'yes'; var HaveLicensePrint = ''; var LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType = new Array(3); LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['grantpermit'] = false; LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['notgrantpermit'] = true; LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['reportnotgrantpermit'] = true; var PingYiConfig = ''; PingYiConfig = 'no'; var IsLicensePrintConfig = ''; IsLicensePrintConfig = 'yes'; var HaveLicensePrint = ''; function StBody(obj,funStr,ExampleValue){ if(document.all(obj)){ document.all(obj).value = ExampleValue; var myondblclickvalue =document.all(obj).getAttributeNode("ondblclick").value; document.all(obj).ondblclick = new Function(myondblclickvalue+";"+funStr);}} </script> <script language='javascript'> //--------Binding SubForm Data-------- //------End Binding SubForm Data------ //Bind custom data. if (document.all("ShenQingRiQi")!=null) {document.all("ShenQingRiQi").value=replaceSubstring('2012-11-08',"[br]","\r\n");} //------End Binding Data------ document.all("docId").value = "00486"; </script> <script language='javascript'> //--------Local Action Information-------- document.all("actionarea").innerHTML=""; document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnSave\" value=\"暂存\" style=\"DISPLAY:\" title=\"\" class=\"normal-button\" onclick=\"FormSubmit(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >"; document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnSubmit\" value=\"提交\" style=\"DISPLAY:\" title=\"\" class=\"normal-button\" onclick=\"WfSubClick2(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >"; document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnAudit\" value=\"意见\" style=\"DISPLAY:\" title=\"\" class=\"normal-button\" onclick=\"OpenAudit(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >"; document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnPrint\" value=\"打印\" style=\"DISPLAY:\" title=\"\" class=\"normal-button\" onclick=\"FormSubmitPrint(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >"; document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnbujian\" value=\"补齐补正\" style=\"DISPLAY:\" title=\"\" class=\"normal-button\" onclick=\"bujian1(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >"; document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnHalfend\" value=\"中途\" style=\"DISPLAY:\" title=\"\" class=\"normal-button\" onclick=\"HalfEndFlow();\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >"; document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnShouLi\" value=\"\" style=\"DISPLAY:\" title=\"\" class=\"normal-button\" onclick=\"WfShouLiClick(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >"; document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnReturn\" value=\"取消\" style=\"DISPLAY:\" title=\"\" onclick=\"history.back(-1);\" class=\"normal-button\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >"; //------End Local Action Information------ //-------Custom Script-------- //------End Custom Script----- document.all("actionarea").innerHTML = ''+document.all("actionarea").innerHTML; document.all("actionarea").innerHTML = '资格'+document.all("actionarea").innerHTML;//--------Input ACL-------- //------End Input ACL------ </script> </body> </HTML> the AutoIt code I try to continue with feature of accessing the inputbox #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: JianFei Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <IE.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase ; http://www.kjjxjy.com/WebAcc/?ver=1 Local $urlStart, $oIE Local $oForms , $oForm; Local $oQuery; $urlStart = "http://10.68.108.16/LangChao.ECGAP.InPortal/login/formlogin.aspx" $oIE = _IECreate ($urlStart) ; windows position _IEPropertySet($oIE, "left",0) _IEPropertySet($oIE, "top",0) _IEPropertySet($oIE, "width", @DesktopWidth) _IEPropertySet($oIE, "height", @DesktopHeight) sleep(2000) ;send("{ENTER}") ;$oForm = _IEFormGetCollection ($oIE, 0) ;$oIE = _IECreate ("http://www.autoitscript.com") $oForms = _IEFormGetCollection ($oIE) ConsoleWrite( "Forms Info There are " & @extended & " forms on this page" & @CRLF) For $oForm In $oForms ConsoleWrite( "Form Info " & $oForm.name & @CRLF) Next ConsoleWrite("End loop of IE Forms" & @CRLF) $oForm = _IEFormGetCollection ($oIE, 0) ;input user name $oQuery = _IEFormElementGetObjByName ($oForm, "txtUser") _IEFormElementSetValue ($oQuery, "zh") ;password $oQuery = _IEFormElementGetObjByName ($oForm, "txtPass") _IEFormElementSetValue ($oQuery, "1") ;click image button ;$oQuery = _IEFormElementGetObjByName ($oForm, "ImageButton1") _IEFormImageClick ($oForm, "ImageButton1", "name") ;$oIE = _IE_Example ("frameset") local $oFrames = _IEFrameGetCollection($oIE) local $iNumFrames = @extended local $i local $oFrame local $oFrameLeft Local $strFrameUrl ConsoleWrite("Frame number = " & $iNumFrames & @CRLF) For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection ($oIE, $i) ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF) $strFrameUrl = _IEPropertyGet ($oFrame, "locationurl") if StringRight($strFrameUrl, 10) = "/left.aspx" Then $oFrameLeft = $oFrame ; get correct url endif Next _IELinkClickByText ($oFrameLeft, "业务办理") ;click the link in left frame sleep(3000) $oFrames = _IEFrameGetCollection($oIE) $iNumFrames = @extended local $oFrameShouJian local $TempStrUrl = "/newwork.aspx?StartType=ShouJian" For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection ($oIE, $i) ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF) $strFrameUrl = _IEPropertyGet ($oFrame, "locationurl") ConsoleWrite("get frame URL: " & $strFrameUrl & @CRLF) ;if StringRight($strFrameUrl, 12) = "/conLeft.htm" Then if StringRight($strFrameUrl, stringlen($TempStrUrl)) = $TempStrUrl Then ConsoleWrite("hit correct URL" & @CRLF) $oFrameShouJian = $oFrame ; assign correct url endif Next ConsoleWrite("get span id" & @CRLF) local $oSpan = _IEGetObjById ($oFrameShouJian, "Datagrid1__ctl2_TreeView1t0") ConsoleWrite("have got span id = " & $oSpan.id & @CRLF) ;$oSpan.fireEvent("onclick") local $oChildDiv = $oSpan.firstChild Local $oChildSpan = $oChildDiv.firstChild $oChildSpan.fireEvent("onclick") local $Error local $InputApplyName = "" Do $InputApplyName = InputBox("name ","applier name") Until not ($InputApplyName ="") ;================================================== Get the frame of content ================================== ; The source content of the frame is as follwing $oFrames = _IEFrameGetCollection($oIE) $iNumFrames = @extended local $oFrameShouLi $TempStrUrl = "&ChineseWord=&EnterpriseName=&fieldPath=" ;http://10.68.108.16/LangChao.ECGAP.InPortal/Business/ShowTodoWork.aspx?ActivitySchemeGuid=791a0ed2-57b2-4d05-aac6-1f12d74dff36&ActivityModelStepId=3&FormID=CXQCZJ_TongYongBiaoDan&ActivityModelGuid=ab033083-3b3f-4e63-8d71-10fd27d3ca83&AppType=WkFlow&Wf=first&type=new&SerailNO=36015&acttype=&acttypefrom=&SequenceNum=inspur0000035419&ChineseWord=&EnterpriseName=&fieldPath= For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection ($oIE, $i) ;ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF) $strFrameUrl = _IEPropertyGet ($oFrame, "locationurl") ConsoleWrite("get URL of form to fill in: " & $strFrameUrl & @CRLF) ;if StringRight($strFrameUrl, 12) = "/conLeft.htm" Then if StringRight($strFrameUrl, stringlen($TempStrUrl)) = $TempStrUrl Then ConsoleWrite("hit URL" & @CRLF) $oFrameShouLi = $oFrame ; endif Next ;============ The above is ok. The problem come up when executing the following code to try accessing some input box in IE frame === ;============ The source code of the frame is as attached ;============ The following iteration can't find the correct input box of "ShengQingZhe" ;============ I try to set value of the input box but fail to get access to its reference, not even say assigning value local $oElement local $oInputs = _IETagNameAllGetCollection ($oFrameShouLi) local $TempRecordOfInputStr For $oElement In $oInputs $TempRecordOfInputStr = "name = " & $oElement.tagname & " id = " & $oElement.id & @CRLF MsgBox(0, "Form Input Type", $TempRecordOfInputStr) Next ;The following accessing for ShenQingZhe would bring up error, no find. local $oShenQingZhe = _IEGetObjById ($oFrameShouLi,"ShenQingZhe") ;$oShenQingZhe.value = "xxx" ;_IEFormElementSetValue ($oShenQingZhe, $InputApplyName) local $oLianXiRen = _IEGetObjByName($oFrameShouLi,"LianXiRen") ;_IEFormElementSetValue ($oLianXiRen, $InputApplyName)
  3. Hi, Friends and Support Team of AutoIt, I am a new fan of AutoIt scripts from PR.China. I came accross problems when trying to use AutoIt script to change the default directory of Windows SlideShow screensaver through changing EncryptedPIDL in registry(HKEY_Current_User\Software\Microsoft\PhotoViewer\SlideShow\ScreenSaver\EncryptedPIDL). I would like to write a small script that can quickly change the default folder path of Windows built-in SlideShow ScreenSaver, instead of clicking the Windows UI step by step to finish the process. And I get a clue that The EncryptedPIDL may relate with this setting, but I copy and write some scripts, failing to change between EncryptedPIDL and the normal folder path, as shown by the attached script. Could anyone help me to write the correct scripts to translate between EncryptedPIDL and the normal folder path, at least from the normal folder path to the EncryptedPIDL. Or it is ok if anyone could show me a little utitily of commandline to change the default folder path of Windows built-in slideshow screensaver. Thank you very much! JF --> #include <Crypt.au3> #include <WinAPI.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare ============= Test to get folder path from EncryptedPIDL, fail ================= ; The following EncryptedPIDL is copied from the registry of my computer $encoded = "FAAfUOBP0CDqOmkQotgIACswMJ0ZAC9IOlwAAAAAAAAAAAAAAAAAAAAAAAAASgAx" & @CRLF & _ "AAAAAACqQJlOEAB0ZXN0AAA2AAgABADvvjNASwqqQJlOKgAAACSPAAAAAAcAAAAA" & @CRLF & _ "AAAAAAAAAAAAAAB0AGUAcwB0AAAAFABOADUAAAAAAKpA+U0QACxnH2c6X2NoAAA2" & @CRLF & _ "AAgABADvvgAAAACqQPlNKgAAACzIAAAAAAQAAAAAAAAAAAAAAAAAAAAsZx9nOl9j" & @CRLF & _ "aAAAGAAAAA==" local $decoded = _Base64Decode($encoded) Msgbox(0, "Types", "$decoded is " & VarGetType($decoded)) local $pidl = $decoded Local $folderpath = DllStructCreate("char[260]") ; try to decrypt the EncryptedPIDL, but the coming result of $folderPath is no as expected Local $ret = DllCall("shell32.dll", "int", "SHGetPathFromIDList", _ "ptr", $decoded, _ "ptr", DllStructGetPtr($folderPath)) Local $return if (@error=0) and ($ret[0] <> 0) Then $return = DllStructGetData($folderpath, 1) EndIf MsgBox(0, 'Base64 Decoded - foldername', $folderpath) ============= Test to get EncryptedPIDL from a folder path, fail ================= ; create a pidl from a specific path local $ppidl = DllCall("shell32.dll","ptr","ILCreateFromPathW","wstr","H:\test") Msgbox(0, "Types", "$ppidl is " & VarGetType($ppidl[0])) ConsoleWrite($ppidl[0] & @CRLF) $encoded = _Base64Encode($ppidl[0]) MsgBox(0, 'Base64 encoded - string', $encoded) ; The coming out result is not long, seeming not the form of EncryptedPIDL Func _Base64Encode($input) $input = Binary($input) Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]") DllStructSetData($struct, 1, $input) Local $strc = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error encoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Encode Func _Base64Decode($input_string) Local $struct = DllStructCreate("int") local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ "str", $input_string, _ "int", 0, _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($struct, 1), _ "ptr", 0, _ "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ "str", $input_string, _ "int", 0, _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($struct, 1), _ "ptr", 0, _ "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error decoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Decode
×
×
  • Create New...