Jump to content

COM "The requested action with this object has failed."


Go to solution Solved by Nine,

Recommended Posts

Posted

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()

Debugger.thumb.png.bb082be46159c0acfbf6d47ca5385095.png

  • Solution
Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...