Mithrandir
Active Members-
Posts
144 -
Joined
-
Last visited
About Mithrandir
- Birthday 06/04/1989
Profile Information
-
Location
Montevideo, Uruguay
-
Interests
Programming, Physics, Philosophy, Reading, Morey...Did I already say programming? :P
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Mithrandir's Achievements
Adventurer (3/7)
0
Reputation
-
IE controls with no Name or ID...
Mithrandir replied to TJ123's topic in AutoIt General Help and Support
Yes, my bad, I wanted to paste <form action="/finance/converter" method="get" name="f"> Sorry for the mistake . It's good to see you figuring things out and using the IE udf. If you need any help ask again. I remember the days when I was starting with the IE udf and DaleHohm helped me a lot (by the way now that I saw his signature I think that was because of him that I downloaded debugbar -
Listview doesn't sort after adding items
Mithrandir replied to Mithrandir's topic in AutoIt GUI Help and Support
Thank you BrewManNH, that also works. So, what's the meaning of that $IParam value? It is not documented except for the "Application defined data" which I don´t know what it is. I have been looking at the source of GuiListView.au3 and I see that _GUICtrlListView_AddItem actually returns _GUICtrlListView_InsertItem in which $IParam is used in DllStructSetData($tItem, "Param", $iParam) but I still don't get the use of it or why leaving $IParam as default gives trouble. Func _GUICtrlListView_InsertItem($hWnd, $sText, $iIndex = -1, $iImage = -1, $iParam = 0) If $Debug_LV Then __UDF_ValidateClassName($hWnd, $__LISTVIEWCONSTANT_ClassName) Local $fUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd) Local $iBuffer, $tBuffer, $iRet If $iIndex = -1 Then $iIndex = 999999999 Local $tItem = DllStructCreate($tagLVITEM) DllStructSetData($tItem, "Param", $iParam) If $sText <> -1 Then $iBuffer = StringLen($sText) + 1 If $fUnicode Then $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]") $iBuffer *= 2 Else $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]") EndIf DllStructSetData($tBuffer, "Text", $sText) DllStructSetData($tItem, "Text", DllStructGetPtr($tBuffer)) DllStructSetData($tItem, "TextMax", $iBuffer) Else DllStructSetData($tItem, "Text", -1) EndIf Local $iMask = BitOR($LVIF_TEXT, $LVIF_PARAM) If $iImage >= 0 Then $iMask = BitOR($iMask, $LVIF_IMAGE) DllStructSetData($tItem, "Mask", $iMask) DllStructSetData($tItem, "Item", $iIndex) DllStructSetData($tItem, "Image", $iImage) If IsHWnd($hWnd) Then If _WinAPI_InProcess($hWnd, $_lv_ghLastWnd) Or ($sText = -1) Then $iRet = _SendMessage($hWnd, $LVM_INSERTITEMW, 0, $tItem, 0, "wparam", "struct*") Else Local $iItem = DllStructGetSize($tItem) Local $tMemMap Local $pMemory = _MemInit($hWnd, $iItem + $iBuffer, $tMemMap) Local $pText = $pMemory + $iItem DllStructSetData($tItem, "Text", $pText) _MemWrite($tMemMap, $tItem, $pMemory, $iItem) _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer) If $fUnicode Then $iRet = _SendMessage($hWnd, $LVM_INSERTITEMW, 0, $pMemory, 0, "wparam", "ptr") Else $iRet = _SendMessage($hWnd, $LVM_INSERTITEMA, 0, $pMemory, 0, "wparam", "ptr") EndIf _MemFree($tMemMap) EndIf Else Local $pItem = DllStructGetPtr($tItem) If $fUnicode Then $iRet = GUICtrlSendMsg($hWnd, $LVM_INSERTITEMW, 0, $pItem) Else $iRet = GUICtrlSendMsg($hWnd, $LVM_INSERTITEMA, 0, $pItem) EndIf EndIf Return $iRet EndFunc ;==>_GUICtrlListView_InsertItem EDIT: I think some of the answers to my doubts are in this post: Quual: It's great to see that the answer to one question can be the answer of another one- 5 replies
-
- _GUICtrlListView_AddItem
- _GUICtrlListView_AddSubItem
- (and 2 more)
-
How do you set the referrer URL in IE
Mithrandir replied to Herb191's topic in AutoIt General Help and Support
What exploit are you referring to? If it's getting the referrer I don't see how can it pose a security risk. -
IE controls with no Name or ID...
Mithrandir replied to TJ123's topic in AutoIt General Help and Support
Oh, I see, you are mistaking the ID of a window with the ID of an object of an HTML document. Look, the autoit window info is useful to automatize windows like in the winzip auto install that is in the beginning of the helpfile. Now, to automatize Internet Explorer with the IE UDF, (I assume you have basic knowledge of HTML, if not I would recommend http://www.w3schools.com/html/default.asp ) you have to look in the source code either as you did with ´view source´ or with the help of tools like firebug for firefox or debugbar for IE. There you will find elements with tags like <form name= or <form id= When an element does not have name or id you can get them by index (first form in the code is 0, second is 1 and so on). With that information, you can make your script. For instance, in the source of http://www.google.com/finance/converter you can see there's a form with this code: <form action="/finance/converter" method="f"> (......) Its name is 'f' go get it with _IEFormGetObjByName and it has a select with this code: <select name=from value=""> <option value="AED">United Arab Emirates Dirham (AED)</option> (.....) There you can use _IEFormElementOptionselect after using IEGetObjById Try it and show some code even if it doesn't work or If you didn't understand something just ask. -
IE controls with no Name or ID...
Mithrandir replied to TJ123's topic in AutoIt General Help and Support
I would rather use the IE UDF, search in the help file for _IECreate , _IEFormGetObjByName, _IEFormElementOptionselect . To inspect the DOM of a page in Internet Explorer you can use debugbar. Try it and if you have any doubt ask again. -
How do you set the referrer URL in IE
Mithrandir replied to Herb191's topic in AutoIt General Help and Support
Maybe this $referrer = _IEPropertyGet($oIE, "refferer") -
Listview doesn't sort after adding items
Mithrandir replied to Mithrandir's topic in AutoIt GUI Help and Support
PhoenixXl: Thank you a lot! It's strange though that the functions from the UDF (_GUICtrlListView_AddItem,_GUICtrlListView_AddISubItem) didn't work and the native one (GUICtrlCreateListViewItem) has to be used when the sort function is from the UDF. So, I will look into mixing UDF functions with native ones when required in the future. PS: If you happen to know about SOAP or webservices, I would appreciate your insights in- 5 replies
-
- _GUICtrlListView_AddItem
- _GUICtrlListView_AddSubItem
- (and 2 more)
-
First of all, I am starting with GUIs but reading examples from the helpfile as well as the forum I made an script in which I have a listview that is going to be populated with user input and sorted at any given moment. When I sort it by the first or second column with the data that was already set when starting the script (1|D,2|C,4|A,3|D ) It sorts correctly but when I add a new element it doesn't sort it right, it seems it dismisses the new entered data. Here is a small example of my code to show the issue: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> $Form1_1 = GUICreate("Form1", 969, 569, 209, 134) $ListView1 = GUICtrlCreateListView("Col1|Col2", 32, 128, 353, 321, -1, $LVS_EX_CHECKBOXES) _GUICtrlListView_RegisterSortCallBack($ListView1) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 115) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 115) $ListView1_0 = GUICtrlCreateListViewItem("1|D", $ListView1) $ListView1_1 = GUICtrlCreateListViewItem("2|C", $ListView1) $ListView1_2 = GUICtrlCreateListViewItem("4|A", $ListView1) $ListView1_3 = GUICtrlCreateListViewItem("3|B", $ListView1) $bElim = GUICtrlCreateButton("Delete element(s)", 176, 464, 201, 25) $elem = GUICtrlCreateInput("Element", 88, 16, 241, 21) $bAdd = GUICtrlCreateButton("Add letter", 112, 48, 201, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _GUICtrlListView_UnRegisterSortCallBack($ListView1) Exit Case $ListView1 _GUICtrlListView_SortItems($ListView1, GUICtrlGetState($ListView1)) Case $bElim $i = 0 $cantitems = _GUICtrlListView_GetItemCount(GUICtrlGetHandle($ListView1)) While $i <= $cantitems If _GUICtrlListView_GetItemChecked(GUICtrlGetHandle($ListView1), $i) Then _GUICtrlListView_DeleteItem(GUICtrlGetHandle($ListView1), $i) Else $i += 1 EndIf WEnd Case $bAdd $number = Random(0, 100, 1) $handlelista = GUICtrlGetHandle($ListView1) _GUICtrlListView_AddItem($handlelista, $number) _GUICtrlListView_AddSubItem($handlelista, _GUICtrlListView_GetItemCount(GUICtrlGetHandle($ListView1)) - 1, GUICtrlRead($elem), 1) EndSwitch WEnd Note that if you delete all the elements that are set after the script started and you add new ones, it doesn't sort them. What's wrong? Thanks for your help!
- 5 replies
-
- _GUICtrlListView_AddItem
- _GUICtrlListView_AddSubItem
- (and 2 more)
-
Can I use this udf to send a SOAP message by post? I ask this because I tried and as far as I know, the SOAP sintax is ok but I am not able to access the file. Here is the thread were I elaborate about the issue:
-
Now I managed to get an answer, I was forgetting to send the header "SOAPAction" in the request. #include 'C:\Program Files (x86)\AutoIt3\Include\WinHttp.au3' Global $sAddress = "www.expedientes.poderjudicial.gub.uy" $sPostData = '<?xml version="1.0"?><soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' & _ 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:consultaIUEwsdl"><soapenv:Header/><soapenv:Body>' & _ '<urn:consultaIUE soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><iue xsi:type="xsd:string">148-472/2002</iue></urn:consultaIUE></soapenv:Body></soapenv:Envelope>' Global $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5") Global $hConnect = _WinHttpConnect($hOpen, $sAddress) Global $hRequest = _WinHttpOpenRequest($hConnect, _ "POST", _ "/wsConsultaIUE.php", _ Default, _ Default, _ 'Content-Type: application/soap+xml') _WinHttpAddRequestHeaders($hRequest, "Name: consultaIUE") _WinHttpAddRequestHeaders($hRequest, "Binding: consultaIUEwsdlBinding") _WinHttpAddRequestHeaders($hRequest, "SOAPAction: urn:consultaIUEwsdl#consultaIUE") _WinHttpAddRequestHeaders($hRequest, "Style: rpc") _WinHttpSendRequest($hRequest, -1, $sPostData) _WinHttpReceiveResponse($hRequest) Global $sHeader, $sReturned If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest) MsgBox(64, "Header", $sHeader) Do $sReturned &= _WinHttpReadData($hRequest) Until @error ConsoleWrite($sReturned) Else ConsoleWriteError("!No data available." & @CRLF) MsgBox(48, "Failure", "No data available.") EndIf _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Nevertheless, I receive this answer: <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:consultaIUEwsdl"><SOAP-ENV:Body><consultaIUEResponse><resultado xsi:type="tns:resultado"><estado xsi:type="xsd:string">EL EXPEDIENTE NO SE ENCUENTRA EN EL SISTEMA</estado><origen xsi:type="xsd:string"></origen><expediente xsi:type="xsd:string"></expediente><caratula xsi:type="xsd:string"></caratula><abogado_actor xsi:type="xsd:string"></abogado_actor><abogado_demandante xsi:type="xsd:string"></abogado_demandante><movimientos xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:giro[0]"></movimientos></resultado></consultaIUEResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> "EL EXPEDIENTE NO SE ENCUENTRA EN EL SISTEMA" means "THE FILE WAS NOT FOUND IN THE SYSTEM" but If I search for 148-472/2002 in http://www.expedientes.poderjudicial.gub.uy/Consulta.php it appears Is there anyone that knows about SOAP that can give me any help? If not I'll need to start again with another focus or else the deadline is going to reach me
-
I have been reading this example in another language: http://cafeconleche.org/books/xmljava/chapters/ch03s05.html and I think that the sintax in my SOAP request is ok, except for the <?xml version="1.0"?> at the beginning but I tried sending with it and I get the same error. I am still puzzled, I would highly appreciate any guidance.
-
Hi, I am trying to make a SOAP client for this page: http://www.expedientes.poderjudicial.gub.uy/wsConsultaIUE.php?wsdl They give this documentation of the webservice: http://www.expedientes.poderjudicial.gub.uy/manualWebService.pdf So, I made a script using winhttp udf to retrieve some data using the webservice 'ConsultaIUE' in which I have to send a string like this: 148-472/2002 in an xml envelope, here is the example from the documentation: <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:consultaIUEwsdl"> <soapenv:Header/> <soapenv:Body> <urn:consultaIUE soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <iue xsi:type="xsd:string">148-472/2002</iue> </urn:consultaIUE> </soapenv:Body> </soapenv:Envelope> Here is the script I made: #include 'C:\Program Files (x86)\AutoIt3\Include\WinHttp.au3' Global $sAddress = "www.expedientes.poderjudicial.gub.uy" $sPostData = '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' & _ 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:consultaIUEwsdl"><soapenv:Header/><soapenv:Body>' & _ '<urn:consultaIUE soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><iue xsi:type="xsd:string">148-472/2002</iue></urn:consultaIUE></soapenv:Body></soapenv:Envelope>' Global $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5") Global $hConnect = _WinHttpConnect($hOpen, $sAddress) Global $hRequest = _WinHttpOpenRequest($hConnect, _ "POST", _ "/wsConsultaIUE.php", _ Default, _ Default, _ 'Content-Type: text/xml') _WinHttpSendRequest($hRequest, -1, $sPostData) _WinHttpReceiveResponse($hRequest) Global $sHeader, $sReturned If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest) MsgBox(64, "Header", $sHeader) Do $sReturned &= _WinHttpReadData($hRequest) Until @error ConsoleWrite($sReturned) Else ConsoleWriteError("!No data available." & @CRLF) MsgBox(48, "Failure", "No data available.") EndIf _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) But instead of receiving a xml response with the data, I receive a 500 error code and this is printed in the console: <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body><SOAP-ENV:Fault><faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode><faultactor xsi:type="xsd:string"></faultactor><faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service</faultstring><detail xsi:type="xsd:string"></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> I have read other threads like but I don't know how to debug this. I appreciate any help!
-
I have made this script to translate the string $textoatraducir from russian ( $sourcelang = 'ru' ) into english ( $resultlang = 'en' ) #include <WinHttpUTF-8.au3> #include <File.au3> $url = 'http://translate.google.com.uy' $aurl = _WinHttpCrackUrl($url) $sourcelang = 'ru' $resultlang = 'en' $textoatraducir = FileRead(@ScriptDir&'/textinrussian.txt') MsgBox(0,'textoatraducir:',$textoatraducir) $hOpen = _WinHttpOpen('Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.28) Gecko/20120306 Firefox/3.6.28 (.NET CLR 3.5.30729)') $hConnect = _WinHttpConnect($hOpen,$aurl[2]) $sRead = _WinHttpSimpleFormFill($hConnect,'','gt-form','source',$textoatraducir,'gt-sl',$sourcelang,'gt-tl',$resultlang,'js','n','prev','_t','hl','es','name:ie','UTF-8','name:layout','2','name:eotf','1') _FileCreate(@ScriptDir&'/translategoogleresult'&'-'&@MDAY&'-'&@MON&'-'&@YEAR&'-'&@HOUR&'-'&@MIN&'-'&@SEC&'.html') $hfile = FileOpen(@ScriptDir&'/translategoogleresult'&'-'&@MDAY&'-'&@MON&'-'&@YEAR&'-'&@HOUR&'-'&@MIN&'-'&@SEC&'.html',129) FileWrite($hfile,$sRead) FileClose($hfile) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) In which I used the UDF 'WinHttpUTF-8.au3' which is WinHttp.au3 edited in the line circa 1312 (in _WinHttpSimpleFormFill function) so instead of Local $sReturned = _WinHttpSimpleReadData($hRequest) If @error Then _WinHttpCloseHandle($hRequest) Return SetError(4, 0, "") ; either site is expiriencing problems or your connection EndIf I put Local $sReturned = _WinHttpSimpleReadData($hRequest,1) If @error Then _WinHttpCloseHandle($hRequest) Return SetError(4, 0, "") ; either site is expiriencing problems or your connection EndIf so that when it reads the data it does it in UTF-8. The problem is that I receive this as html in the result (I used pastehtml cause emoticons appeared in the code if i posted here in an spoiler): http://pastehtml.com/view/brxbjx5je.html With all the russian characters showing as '????' . I don't know what's wrong, Fileread reads the text in russian correctly as the Messagebox shows. I guess the problem is in _WinHttpSimpleFormFill but I thought that by editing the line that I said it would be solved. Thanks for your help! PS: If I try to translate from english into russian (To reproduce it: $sourcelang = 'en' , $resultlang = 'ru' and in $textoatraducir put some text in english) It does it correctly, as it shows the html of the response: http://pastehtml.com/view/brxbxdjt6.html
-
Thank you a lot! I tested Fileread, Filewrite with Fileopen in write mode+utf-8 with bom (which is 129) , regexp and all function well! Now I'm researching the encoding of characters to send them with _WinHttp UDF, It seems that to read for instance the response data from WinHttpSimpleRequest($hConnect, $sType, $sPath [, $sReferrer = Default [, $sData = Default [, $sHeader = Default [, $fGetHeaders = Default [, $iMode = Default ]]]]]) The $iMode should be set to 1 to read the data as utf-8. One thing that I don't get, why the default is ANSI? Because with utf-8 we can read characters from more alphabets than with ANSI. Is it faster to read in ANSI than in utf-8? As far as I know, there shouldn't be any problem with sending data that have characters in russian or greek in an http request because the only things that are encoded are the special characters like '&' which have an ascii code. If this is not true, I would like to know if I have to do something more.
-
I'm trying to make a script that will need a function that writes a string in another language. The problem is that I looked at the ascii code in the help file and there aren't the special characters of languages like russian or greek. For instance 'programming' in russian is 'программирование' How can I write the 'п' for instance? In scite when I try to do it it writes '????????????????' if I copy paste it . The same goes with 'programming' in greek which is 'προγραμματισμού' . I guess there are two possible solutions: 1) Using google translate to translate the words and get them back in a string variable 2) Storing the string in russian or greek in a txt file (What should I use? Unicode or Unicode big endian or UTF-8?) and then pulling it to a string variable In both cases I would need some kind of 'encoding' to be able to 'write' them... I'm afraid my post is likely to not making any sense, but I'm confused about what I'm missing here. The problem that underlies my confusion I think it is that I don't know whether it is a problem of the operating system or a problem of autoit. To summarise my problem, how can I use string variables with characters from other alphabets in autoit? Is there any udf/function/snippet to do that? Or is there a simpler way? In that case I would appreciate any guidance. Thanks for your help!