I have a problem. I have a script that creates a hidden IE instance, navigates to a certain URL that is supplied and then retrieves information from a frame within that page. The thing is that I need to navigate to a veeery long URL (over 2500 characters), and I have found out that IE limits URL's to just 2083 characters. So the script crashes in the IE.Navigate(Path) line (took ages to find the reason why!).
Since I can't imagine a way to bypass that limit, I feel the only way is to migrate my code to Edge instead, since it will accept URL's longer than 5000 characters (I have checked). But I don' t know how to do the migration. How can I change the references to the IE object to Microsoft Edge? I know I can use the Run, %Path% option but I don't know how to do it in a hidden window, nor access the frames content as IE.document.readyState, IE.busy or IE.document.getElementsByTagName("textarea")[1].value, among others, are able to do. Ideally, I would need to do the same things I am doing in Internet Explorer now in Edge.
Notice I am in now way an expert in IE objects or DOM. I just found the information on this forum and then managed to adapt it to my needs via trial and error. I honestly stil don't know really what IE.document.getElementsByTagName("textarea")[1].value is, or why it seems to be the same as IE.document.getElementsByClassName("lmt__textarea lmt__target_textarea")[0].innertext...
Here's my code.
Code: Select all
IE := ComObjCreate("InternetExplorer.Application") ;~ Creation of hidden Internet Explorer instance to look up Deepl Translate and retrieve translation
IE.Visible := False
IE.Navigate(Path) ; Here is the issue, if Path is longer than 2083 characters, it crashes.
; Path can be something like "https://www.deepl.com/translator#en/es/" and then a very long string (the text you want to translate in DeepL, actually)
While IE.readyState!=4 || IE.document.readyState!="complete" || IE.busy ; Wait until page is loaded
Sleep 50
While (IE.document.getElementsByTagName("textarea")[1].value = "") ;Since the conversion takes a second we want to wait till the value is filled otherwise the return will always be nothing
{
Sleep 50
If (A_Index >190) { ; Es decir, tarda demasiado
; MsgBox ,,,Error`, restarting, .5
IE.Quit
Result:="Translation failed"
}
}
Result := IE.document.getElementsByTagName("textarea")[1].value ; Retrieves the translation of Path in Result