Home AMX User Forum AMXForums Archive Threads AMX Applications and Solutions

String manipulation on command

Dear Friends,

I would want to parse the commands coming to a virtual variable using string manipulation. Is it possible.
This is what I 'm trying to do. It is goin into while loop, but string manipulation doesnt seem to be taking place. Is it because its a command string manipulation wont happen,.. Looking forward to you guys, Thankyou.

data_event[vdvMatrixAudio1]
{


command:
{

STACK_VAR CHAR sTempVar[50]
STACK_VAR FLOAT fPresetVal

WHILE(FIND_STRING(TunerBuffer,'XCH',1))
{
send_string 0:1:2,"'Test Radio',$0d"
sTempVar=REMOVE_STRING(TunerBuffer,'XCH',1)
// fPresetVal = atof(TunerBuffer)
send_command dvTP_Drawing_AMFM,"'^TXT-9,0,',sTempVar"

}
}
}

Comments

  • You can manipulate strings sent as commands or as strings the same way.

    In your program though, you're not parsing the command, your parsing the variable TunerBuffer which is getting filled somewhere else anytime data is received in the command buffer for vdvMatrixAudio1.

    Usually you would have a line like this under the command: event
    TunerBuffer = "TunerBuffer,DATA.TEXT"
    

    And somewhere else you would have:
    SEND_COMMAND vdvMatrixAudio1, "'XCH88.1'"
    

    I would open up Debug and see what the value of TunerBuffer is when the parsing routine is called, and when it's done. If you're entering the while loop, then you're seeing XCH in TunerBuffer, but the other thing is you're setting sTempVar to everything leading up to and including 'XCH'. If TunerBuffer = 'XCH88.1' as an example, sTempVar is going to equal XCH. Your send command will send back "XCH" to the button 9 on your touchpanel. If TunerBuffer = '88.1XCH' then sTempVar would be 88.1XCH.

    --John
  • you're parsing the variable TunerBuffer which is getting filled somewhere else anytime data is received in the command buffer for vdvMatrixAudio1.
    Just wanted to clarify and rephrase that...
    Anytime data is received in the command buffer for vdvMatrixAudio1, you're parsing TunerBuffer. Your variable TunerBuffer is getting filled somewhere else.

    --John
Sign In or Register to comment.