khaynes Posted December 5, 2007 Share Posted December 5, 2007 Hello, I have a Visual Basic 6.0 program that can automate a FILMeasure.FMRemoteControl. I am trying to translate it into AutoIt. I get an error when I run my AutoIt program: "Error: The requested action with this object has failed" on this line: Local $response = $oFilmetrics.Execute("GetSerialNumber", $errorCode) ; Fails I can tell the the FILMeasure object has been created because it puts up a Window when it runs. Is there a problem handling the second argument ? It is a pass by reference. Looking at the AutoIt Feature Requests, I found Com ByRef Feature Request . Does that mean that I can't do this? If I can't call the Execute function from AutoIt, is there any way to work around it? Thanks, Keith Visual Basic Code: CODEDim mobjFILMeasureRemotecontrol As FILMeasure.FMRemoteControl Private Sub cmdExecute_Click() Dim intErrCode As Integer Dim strErrString As String lblResponse.Caption = mobjFILMeasureRemotecontrol.Execute(cboCommand, intErrCode) If intErrCode Then Select Case intErrCode Case -1 strErrString = "Syntax Error" Case -2 strErrString = "System Busy" Case Else strErrString = "Unknown Error" End Select lblResponse.Caption = strErrString MsgBox "Error. Error code=" & intErrCode & ", error Type=" & strErrString End If End Sub AutoIt code: CODE; Attempt to open connection to Filmetrics $oFilmetrics = ObjCreate("FILMeasure.FMRemoteControl") If @error Then MsgBox(0, "Process Error", "Error Getting an active FILMeasure object. Error code: " & hex(@error,8)) Exit EndIf MsgBox(0, "Debug", "FILMeasure Name = " & ObjName($oFilmetrics)) ; This works (name is _FMRemoteControl) Local $errorCode Local $response = $oFilmetrics.Execute("GetSerialNumber", $errorCode) ; Fails Link to comment Share on other sites More sharing options...
DaleHohm Posted December 6, 2007 Share Posted December 6, 2007 Don't see where you are trying to use byRef anywhere. When you say it "fails" - how does it fail? what are the error messages? Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 6, 2007 Share Posted December 6, 2007 Looking at the AutoIt Feature Requests, I found Com ByRef Feature Request. Did you, now? The title of that topic is "NO TAXATION WITHOUT REPRESENTATION, Talk politics and crap" from 2004. Does that mean that I can't do this? You mean talk politics, or talk crap? (But of course, that's redundant.) Sorry, couldn't resist... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
khaynes Posted December 6, 2007 Author Share Posted December 6, 2007 Don't see where you are trying to use byRef anywhere.When you say it "fails" - how does it fail? what are the error messages?DaleThe second parameter of the Execute method is passed by reference.I can tell because the visual basic code checks its value after the call.The error message is:"Error: The requested action with this object has failed"and the script stops running.Keith Link to comment Share on other sites More sharing options...
khaynes Posted December 6, 2007 Author Share Posted December 6, 2007 Did you, now? The title of that topic is "NO TAXATION WITHOUT REPRESENTATION, Talk politics and crap" from 2004. You mean talk politics, or talk crap? (But of course, that's redundant.) Sorry, couldn't resist... Guess the Insert Special Item didn't work the way I thought it would. Second try. COM argument ByRef Link to comment Share on other sites More sharing options...
DaleHohm Posted December 6, 2007 Share Posted December 6, 2007 The second parameter of the Execute method is passed by reference.I can tell because the visual basic code checks its value after the call.The error message is:"Error: The requested action with this object has failed"and the script stops running.KeithAre you able to perform any other methods or access any properties of this object, or is the trouble isolated to the Execute method? Also, plase post the full output from the SciTe console.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
khaynes Posted December 11, 2007 Author Share Posted December 11, 2007 Are you able to perform any other methods or access any properties of this object, or is the trouble isolated to the Execute method? Also, plase post the full output from the SciTe console. Dale Hello, The object only supports two things, the Response property and the Execute method. The Response property appears to work. Here are a short program and its outputs. Program: AutoItSetOption("MustDeclareVars", 1) Local $oFilmetrics = ObjCreate("FILMeasure.FMRemoteControl") Local $logFile = FileOpen("logfile.txt", 2) FileWriteLine($logfile, "FILMeasure Name = " & ObjName($oFilmetrics)) Local $response1 = $oFilmetrics.Response() FileWriteLine($logFile, "response1 = " & $response1) While( $response1 == "Busy" ) $response1 = $oFilmetrics.Response() FileWriteLine($logFile, "response1 = " & $response1) Sleep(200) WEnd FileWriteLine($logFile, "not busy response1 = " & $response1) Sleep(2000) Local $errorCode Local $response2 = $oFilmetrics.Execute("GetSerialNumber", $errorCode) FileWriteLine($logFile, "response2 = " & $response2) FileClose($logFile) SciTe console: (I think this is what you wanted to see) >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "O:\Emitter data\VisualBasicFilmetrics\FilmTest.au3" O:\Emitter data\VisualBasicFilmetrics\FilmTest.au3 (15) : ==> The requested action with this object has failed.: Local $response2 = $oFilmetrics.Execute("GetSerialNumber", $errorCode) Local $response2 = $oFilmetrics.Execute("GetSerialNumber", $errorCode)^ ERROR >Exit code: 1 Time: 5.208 logFile as written by the above program: FILMeasure Name = _FMRemoteControl response1 = Busy response1 = Busy response1 = DDELink Active not busy response1 = DDELink Active Thank you for taking the time to look at this problem. Keith Link to comment Share on other sites More sharing options...
DaleHohm Posted December 11, 2007 Share Posted December 11, 2007 I'm not sure what to suggest. Can you craft a small working example in VBScript that could be used as a model for conversion? Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
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