AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Hi in russian google translate12/19/2023 ![]() > Result (ital.) : Questo è un testo inglese da tradurre in italiano. Example : -> Source (engl.) : This is an English text to be translated into Italian. However, the regular expression still needs some fine-tuning. Some time ago, I created a Q&D code snippet that uses the Microsoft.XMLHTTP object. getAttribute ( $Attribute ), $AttributeValue ) > 0 Then $GetObj = $aTag ExitLoop EndIf EndIf Next If $GetObj = "" Then Else Return $GetObj EndIf EndFunc =>GetObj ![]() classname, $AttributeValue ) > 0 Then $GetObj = $aTag MsgBox("","","found" & $aTag.innerText) ExitLoop EndIf Else If StringInStr ( $aTag. innerText, $AttributeValue ) > 0 Then $GetObj = $aTag ExitLoop EndIf ElseIf StringLower ( $Attribute ) = "class" Or StringLower ( $Attribute ) = "classname" Then If StringInStr ( $aTag. quit Return $TranslateFromGGL EndFunc Func GetObj ( $Tag, $Attribute, $AttributeValue, $oIE = $oIE ) $aTags = _IETagNameGetCollection ( $oIE, $Tag ) For $aTag In $aTags If StringLower ( $Attribute ) = "innertext" Then If StringInStr ( $aTag. ![]() innerText If Then $TranslateFromGGL = "It was not able to trasnlate your request!" Else $TranslateFromGGL = $html EndIf $oIE. quit $TranslateFromGGL = "It was not able to translate your request" Exit EndIf Local $html = $oTranslated. ![]() Expand collapse popup #include $translateText = clipget ( ) $textResault = TranslateFromGGL ( $translateText, "bg" ) ConsoleWrite ( $textResault ) Func TranslateFromGGL ( $sTextToTranslate, $ToLanguageCode ) $URL = "" & $ToLanguageCode & "&text=" & $sTextToTranslate Global $oIE = _IECreate ( $URL, 0, 0, 1 ) $oTranslated = GetObj ( "span", "class", "tlid-translation translation", $oIE ) If Then $oIE. ![]()
0 Comments
Read More
Leave a Reply. |