Jump to content

vladtsepesh

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by vladtsepesh

  1. Hi all, I got the need of crawling all the label tag contained within a div element, and then inspecting one by one looking for a specified content Local $reportForm=_IEFormGetObjByName($oIE,"ui_form") If @error Then ConsoleWrite('_IEFormGetObjByName @error = ' & @error & ' @extended = ' & @extended & @CRLF) EndIf Local $divTagSites = _IEGetObjById($reportForm, "divElementId") If @error Then ConsoleWrite('_IEGetObjById for @error = ' & @error & ' @extended = ' & @extended & @CRLF) EndIf Local $divLabels = _IETagNameGetCollection($divTagSites, "label") If @error Then ConsoleWrite('_IETagNameGetCollection for label @error = ' & @error & ' @extended = ' & @extended & @CRLF) EndIf ConsoleWrite('_IETagNameGetCollection @extended = ' & @extended & @CRLF) For $divLabel In $divLabels ConsoleWrite($divLabel.for & @CRLF) Next the html looks like the following <div id="divElementId"> <td nowrap="nowrap"> <span> <input id="divElementId_ctl01" type="checkbox" name="divElementId$ctl01" onclick="some JavaScript stuff" /> <label for="divElementId_ctl01_ctl01">ele-1000002 [1000002]</label> </span> </td> </div> what I'd like to perform is to access the label element text ele-1000002 [1000002] comparing to a variable and then check the corresponding checkbox. What I miss is the step: accessing the text inside the label tag. TIA. PS: searching through the forum I found out only method based on analyzing the whole html page.
  2. The ControlSend() command did the trick, but in advance I had to apply a Ctrl+a command to hilight all the default path a overwrite with the new one. No need to interact with the [CLASS:ToolbarWindow32; INSTANCE:3] to move the foelder to the desired one. WinWait("Salva con nome") Local $hSaveAsDlg=WinActivate("Salva con nome") ConsoleWrite(" --> full path" & $fullpathFileName & @CRLF) ControlSend($hSaveAsDlg,"&Salva","[CLASS:Edit; INSTANCE:1]","^a") ControlSend($hSaveAsDlg,"","[CLASS:Edit; INSTANCE:1]", $fullpathFileName) Sleep(1500) ConsoleWrite(" --> Click save Button " & @CRLF) ControlClick($hSaveAsDlg,"","Button1")Thanks anybody.
  3. Hi all, I'm trying to download a file as a result of an interrogation to a report server, this means I don't have a direct URL from which to download directly the file. I need to interact with the classic "Save as" dialog box To perform this task I wrote a simple piece of code I'm supposed to work, it could be summarized as follows Local $hWndDwnld=WinActivate("Download del file") Sleep(500) If @error Then ConsoleWrite('WinActivate' & '@error = ' & @error & @CRLF & '@extended = ' & @extended) ConsoleWrite("Wait for download file dialog..." & @CRLF) Local $hWndDwnld=WinWaitActive("Download del file") ConsoleWrite(".. found." & @CRLF) WinActivate($hWndDwnld) Endif ;~ waiting for window ControlSend($hWndDwnld, "", "", "!v") ;~ send ctrl+v WinWait("Salva con nome") WinActivate("Salva con nome") ControlSetText("Salva con nome", "", "[CLASS:ToolbarWindow32; INSTANCE:3]", $dest) Sleep(1500) ControlSetText("Salva con nome","","[CLASS:Edit; INSTANCE:1]","") Sleep(1500) $filename="aReport.csv" ;~ ControlSetText("Salva con nome","&Salva","Edit1", $filename) ControlSetText("Salva con nome","","[CLASS:Edit; INSTANCE:1]", $filename) Sleep(1500) $filename=ControlGetText("Salva con nome","&Salva","Edit1") ConsoleWrite(" --> " & $filename & @CRLF) ControlClick("Salva con nome","","Button1")It's based mostly on this post: https://www.autoitscript.com/forum/topic/134561-automating-the-ie-save-as-file-dialog/ What I'would like to obtain is changing the filename and the directory as in the two variables $filename and $dest. Instead I get the file named as provided by the report server and suggested at first in the SaveAs window and dowloaded in the last folder browsed, to be more clear none of the ControlSetText instructions in the snippet above work. TIA for any help. PS: the script is based on the Italian language settings for the WinOS, for the English language the "Download del file" and "Salva con nome" strings should be replaced by "File Download" and "Save As" respectively.
  4. This is how the script looks like: but googling around the forum I found a new way to send the the action to the button Local $oExport=_IEGetObjById($oIE,"ctl140_ctl01_ctl05_ctl01") Local $hWnd = _IEPropertyGet($oIE, "hwnd") _IEAction($oExport, "focus") ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")Hope it helps.
  5. As mLipok said, I've read this so my AutoIt script now is _IEErrorHandlerRegister(_User_ErrFunc)   ;~ ;~ few lines of code ;~ assuming $oIE is the reference to IE browser   Local $oExport=_IEGetObjById($oIE,"ctl140_ctl01_ctl05_ctl01") If @error Then MsgBox($MB_ICONERROR, '_IEGetObjByName', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(2,0,0) Endif $oExport _IEAction($oExport,"click") If @error Then MsgBox($MB_ICONERROR, '_IEGetObjByName', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(2,0,0) Endifbut I get no error on a MessageBox and no error in the Output pane, the behavior, obviously, is the same, the new window is opened and suddenly close with the control returning to the parent window. Any help appreciated, TIA.
  6. Hi all, I face a strange behavior on an anchor element when I try to reproduce a click on it. The fragment of the html page is reported below, is a page from SQL Server Report System: <td height="28px"> <a id="ctl140_ctl01_ctl05_ctl01" onclick="var formatDropDown = document.getElementById('ctl140_ctl01_ctl05_ctl00'); if (formatDropDown.selectedIndex == 0) return false; window.open(document.getElementById('ctl140').ClientController.m_exportUrlBase + encodeURIComponent(formatDropDown.value), '_blank') formatDropDown.selectedIndex = 0; document.getElementById('ctl140_ctl01_ctl05_ctl01').Controller.SetViewerLinkActive(document.getElementById('ctl140_ctl01_ctl05_ctl00').selectedIndex != 0); return false;" onmouseover="this.Controller.OnLinkHover();" onmouseout="this.Controller.OnLinkNormal();" class="DisabledLink" title="Export" href="#"> <script type="text/javascript"> document.getElementById('ctl140_ctl01_ctl05_ctl01').Controller = new ReportViewerLink("ctl140_ctl01_ctl05_ctl01", false, "ActiveLink", "DisabledLink", "", "", ""); </script>Export </a> </td>The script to emulate the click on it should be as simple as the follow ;~Assuming $oIE is the reference to IE browser Local $oExport=_IEGetObjById($oIE,"ctl140_ctl01_ctl05_ctl01") ConsoleWrite($oExport.href); _IEAction($oExport,"click") Anyway what I see is rather different, when I click on the browser on the Export writing as a human task I see a new window opened, due to the window.open instruction in the javascript, and then I get a Dialog Box to download the given report. With the AutoIt script I get the new window open but no Dialog Box appear, the control return to the html page. I'm sure I'm missing something but I need somebody to help me to figure it out. TIA.
  7. Hi all, I'm investigating the way to interact with a calendar popup window app. The AutoIt Window Info gives me this info: >>>> Control <<<< Class: SysMonthCal32 Instance: 1 ClassnameNN: SysMonthCal321 Name: Advanced (Class): [CLASS:SysMonthCal32; INSTANCE:1] I thought to set the the data via the _GUICtrlMonthCal_SetToday with this little snippet of code Local $hCalendar = WinGetHandle("Calendar") _GUICtrlMonthCal_SetToday($hCalendar, 2014, 3, 31) trying to debug the behavior of the script I add these few lines Local $sString = _GUICtrlMonthCal_GetTodayStr($hCalendar) ConsoleWrite ( $sString ) ControlClick($hCalendar, "", "Button1") but I get the date as 00/00/0000 and, obviously, when send the click to the Button1, the control return to the main app an uninitialized value. TIA for any useful help. PS: googling the help I found the _GUICtrlMonthCal_SetCurSel method, it doesn't work either.
×
×
  • Create New...