Translator timeout when using command line to start macro (1 Viewer)

barnabas1969

Portal Member
July 17, 2011
27
1
Home Country
United States of America United States of America
I've written a macro that turns on my A/V receiver and sets the correct input on the receiver. When I click the "Test" button, it works perfectly without error. However, when I execute it by running translator from the command line, I get a timeout error. The commands are still sent correctly to my A/V receiver, but I have to click the "OK" button on the error message box. I would like to stop this from occurring, because I don't want to press the "OK" button.

The macro sends a power-on command via RS-232 to the receiver, then it pauses for 3000 milliseconds (3 seconds) before it sends a command to change the input.

I'm guessing that the command line interface expects a response from the running instance of translator within a specific time period, and that my 3 second pause is causing the problem. I've tried reducing the pause to 450mS and it runs without an error from the command line. However, my A/V receiver needs 3 seconds after power-on before it can switch the input.

Is there a way to change the timeout period?

My macro looks like this:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<macro>
  <item command="Macro: Receiver_Power_ON" />
  <item command="Pause: 3000" />
  <item command="Macro: Receiver_Input_MD-DAT" />
</macro>

And I get the following error message:
"System.ComponentModel.Win32Exception: This operation returned because the timeout period expired at IrssUtils.Win32.SendWindowsMessage(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr IParam) in ..."

I have a work-around for this problem... I just run Translator from a batch file to send the power-on command, then sleep for 3 seconds before running translator again to send the input-select command. This works as desired without an error message. However, I would like to get this fixed because I would like to use more features in the macros that will cause some delays... and I will need to run them from a command line from an external program.
 

barnabas1969

Portal Member
July 17, 2011
27
1
Home Country
United States of America United States of America
Well, I found the source code on sourceforge.net. I'm not real familiar with C, but it appears that the timeout is hard-coded to 1000 milliseconds at line 2408 in this file.

I would be willing to donate some money if the developer would make this timeout value a parameter that can be passed on the command line (with a default value of 1000mS if the parameter is not supplied).
 

barnabas1969

Portal Member
July 17, 2011
27
1
Home Country
United States of America United States of America
Well, I'm not a C programmer, but I think I have it figured out. I attached two C# files with the changes. I believe it will allow the argument to be passed to the program like this:

Code:
Translator.exe -MACRO "Your macro name|5000"

Where the "5000" in the above string is the number of milliseconds for the timeout. This parameter is optional, and must be delimited with a pipe character "|" if specified.

I'll have to figure out how to build the program, since I don't have a copy of Visual Studio.NET. I suppose the first hurdle is downloading all the necessary files in the correct directory structure. I've never used sourceforge, so I don't know how to do that yet.

Here's an outline of what I changed:
  • In Win32.cs, at line 2404, I added a new (optional) parameter Timeout with a default value of 1000.
  • At line 2408 in the same subroutine, I replaced the hard-coded value of 1000 with the variable Timeout.
  • In the CopyDataWM.cs file, at line 105, I defined a new integer named Timeout, with a default value of 1000.
  • At line 106 in the same subroutine, I added an "if" statement to check for a pipe character in the data variable. If the pipe is found, the data is split into a variable Timeout (UINT) and the remaining string is left in the variable "data".

If this looks good to you guys, I would really appreciate it if you would update the code and compile a new build. I am willing to test it. :)
 

Attachments

  • Translator.zip
    17.6 KB

barnabas1969

Portal Member
July 17, 2011
27
1
Home Country
United States of America United States of America
OK, I never knew that M$ supplies the "express" version of Visual Studio for free. I downloaded and installed Visual C# and I registered on Source Forge and downloaded the source for IRSS. I'll see if my changes will compile when I get some time to work on it... the wife doesn't like me tinkering with this stuff too much. She doesn't understand why I like doing this so much. I keep telling her that I could have worse hobbies.
 

barnabas1969

Portal Member
July 17, 2011
27
1
Home Country
United States of America United States of America
I have a couple of problems when I try to build my project in Visual C#. First, there are a bunch of errors about the code not being CLS-compliant. I'm guessing that there must be some way to tell Visual C# not to check for CLS compliance, but I haven't found it yet.

Second problem is that it is reporting that my call to SendWindowsMessage (in the CopyDataWM.cs file) has a problem. The error message is "No overload for method 'SendWindowsMessage' takes 5 arguments". However, I am supplying 5 arguments, and the SendWindowsMessage subroutine (defined in the Win32.cs file) accepts 5 arguments... so I don't understand what's the problem.

I would really appreciate it if one of the developers on here could help me!

Brian
 

barnabas1969

Portal Member
July 17, 2011
27
1
Home Country
United States of America United States of America
It is absolutely amazing to me that it has been more than 3 weeks since I posted this and still no response from the developers.

Now, I am trying to create a macro that uses the Load/Set/Save variables functions in Translator... and I can't get it to work. I guess I'm on my own.

I would be happy to donate for this software IF (big IF) I could actually get some support!!!
 

Spragleknas

Moderator
  • Team MediaPortal
  • December 21, 2005
    9,471
    1,822
    Located
    Home Country
    Norway Norway
    Hi.
    Sorry for the lack of response.
    I'm in no position to be of any help but to try to make the team aware of this thread. The devs that are working with IRSS (after and-81 stopped) is very busy these days.

    I can understand your frustration, but please try to keep it nice.
     

    Lyfesaver74

    Public Relations
  • Premium Supporter
  • September 25, 2010
    1,542
    1,122
    Texas
    Home Country
    United States of America United States of America
    barnabas1969 - I understand your anger and frustration, I truly do. To that end I want you to feel assured that Spragleknas has drawn attention to the issue, and someone will assist you soon.

    Much like Spragleknas, I am in no position to help, but developers will have a better understanding of how to assist you. Keep your chin up!
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,544
    8,236
    Home Country
    New Zealand New Zealand
    Hi Brian

    Just to reiterate what has been said here: I'm sorry for your frustration. The difficulty is that nobody is actively developing IRSS... or at least not that I'm aware of (see here). With that said, I'm going to try to help, but please keep in mind that I've never even *used* IRSS let alone looked at the code, so I'm really stepping out on a limb.

    Regarding the earlier error you reported: SendMessage() is a Windows function that expects 4 arguments as specified -->here<--. You won't be able to pass it 5... hence the error.

    Can you be more specific about what you're trying to do now?

    mm
     

    barnabas1969

    Portal Member
    July 17, 2011
    27
    1
    Home Country
    United States of America United States of America
    mm (and the others above),

    Thanks for your response, and I apologize for my rudeness... I edited my post.

    I'm trying to change the program to allow a macro to be run from the Windows command prompt with an optional timeout value. I'm not experienced with C#, so I was finding my way around and reading documentation that I could find on the web.

    The SendWindowsMessage (not to be confused with the Windows function SendWindowMessage) calls SendMessageTimeout with a hard-coded timeout value of 1000 milliseconds. I was attempting to change the SendWindowsMessage function so that it can accept a 5th parameter that defaults to 1000 milliseconds. Then, in the SendCopyDataMessage function, I wanted to split the variable "data" into two separate values... the first one would be the name of the macro to run, and the second would be the timeout... delimited by a pipe character since pipes are not allowed in a Windows filename and thus not allowed in the name of a macro.

    I gave up on it since I had received no response here... and because my workaround works. However, it would still be nice to get this working properly. When a macro contains a pause, you can't run that macro from a command prompt due to the hard-coded timeout. It would be wonderful if this could be fixed, because I can see many uses for macros with pauses that need to be called from the command prompt.

    I've also found another bug that has to do with loading and saving variables in a macro. Whenever I try to save a variable, my VariablesList file gets created with bad data. I found another post (here) that mentions this very bug which was supposedly fixed.

    I'm happy to test and provide feedback. I would like to learn C# and fix some of this stuff myself, but time is limited. If I can get this all working correctly, I will be happy to donate to the project. I understand that it takes money to run a project like this and that very few people actually donate.

    Thank you,
    Brian
     

    Users who are viewing this thread

    Top Bottom