JonF Posted March 29, 2025 Posted March 29, 2025 This is driving me crazy. This worked flawlessly for months. Two days ago it stopped working with an "The requested action with this object has failed." error. I ran SFC. I restored the entire C drive to the day before from a Macrium Reflect image. I rewrote it to use the WinHttp.au3 UDF. I uninstalled and reinstalled AutoIT. I ran it in Steve Towner's GUI debugger (https://web.archive.org/web/20220401023656/https://www.thefoolonthehill.net/drupal/AutoIt Debugger) and verified the objects were objects. I've Googled the error and gotten many hits, none of which explain WTF should be done. If I un-comment the "$objErr =..." line the error message is "Access is denied". Help?? Func _GoogleAPITranslate($sMytext, $sFrom, $sTo) Global $objErr Local $sUrl,$sResponse, $JSONData, $sOutput = "", $aData ; $objErr = ObjEvent("AutoIt.Error","MyErrFunc") $oSC = ObjCreate("ScriptControl") $oSC.language = "Javascript" $g_sMytext = $oSC.eval("encodeURI('" & $sMytext & "');") $sUrl = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" & $sFrom & "&tl=" & $sTo & "&dt=t&q=" & $g_sMytext $oHTTP = ObjCreate("Microsoft.XMLHTTP") $oHTTP = ObjCreate("Msxml2.XMLHTTP.6.0") $oHTTP.Open("POST", $sUrl, False) $oHTTP.setRequestHeader('Content-Type','application/x-www-form-urlencoded') $oHTTP.Send() $sResponse = $oHTTP.ResponseText EndFunc ;==>_GoogleAPITranslate Func MyErrFunc() MsgBox(48, 'COM Error', $objErr.description) SetError(1) EndFunc ; https://www.autoitscript.com/forum/topic/202204-simple-google-translate/?do=findComment&comment=1505984 Func TestTranslate() MsgBox(0,'Output',_GoogleAPITranslate('Hello world','en','uk')) EndFunc TestTranslate()
Solution Nine Posted March 29, 2025 Solution Posted March 29, 2025 Works for me flawlessly. Maybe denial is coming from Google ? Like too many posts ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
argumentum Posted March 29, 2025 Posted March 29, 2025 1 hour ago, JonF said: Help?? See if this version ( https://www.autoitscript.com/forum/topic/211932-google-translation-with-gui/ ) works. If it does, use it as the base for yours. If it does not then try another PC ?, $objErr in my PC don't throw errors. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting
JonF Posted March 30, 2025 Author Posted March 30, 2025 On 3/29/2025 at 9:32 AM, Nine said: Works for me flawlessly. Maybe denial is coming from Google ? Like too many posts ? Ah, that's it. If I use a VPN it works.
JonF Posted March 30, 2025 Author Posted March 30, 2025 On 3/29/2025 at 10:49 AM, argumentum said: See if this version ( https://www.autoitscript.com/forum/topic/211932-google-translation-with-gui/ ) works. If it does, use it as the base for yours. If it does not then try another PC ?, $objErr in my PC don't throw errors. I have that. It doesn't work. The denial seems to be based on too many requests from my IP. argumentum 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now