Home AMX User Forum NetLinx Studio

SEND_STRING Questions

I'm trying to wrap my head around some SEND_STRING commands...Not so much the commands themselves, but the string formatting.

For Instance, I have this command which works (SONY VISCA Camera Control)
SEND_STRING dvCamera, "$81,$01,$06,$01,$10,$10,$03,$02,$FF"

How is that different than let's say one of these commands (which don't work, so what am I sending?)
SEND_STRING dvCamera, "'$81,$01,$06,$01,$10,$10,$03,$02,$FF'"
SEND_STRING dvCamera, "$81$01$06$01$10$10$03$02$FF"
SEND_STRING dvCamera, '$81,$01,$06,$01,$10,$10,$03,$02,$FF'

Finally, I"d like to replace the $10s with a integer variable, how would I do that?

Thanks.

Comments

  • HedbergHedberg Posts: 671
    jabramson wrote: »
    I'm trying to wrap my head around some SEND_STRING commands...Not so much the commands themselves, but the string formatting.

    For Instance, I have this command which works (SONY VISCA Camera Control)
    SEND_STRING dvCamera, "$81,$01,$06,$01,$10,$10,$03,$02,$FF"

    How is that different than let's say one of these commands (which don't work, so what am I sending?)
    SEND_STRING dvCamera, "'$81,$01,$06,$01,$10,$10,$03,$02,$FF'"
    SEND_STRING dvCamera, "$81$01$06$01$10$10$03$02$FF"
    SEND_STRING dvCamera, '$81,$01,$06,$01,$10,$10,$03,$02,$FF'

    Finally, I"d like to replace the $10s with a integer variable, how would I do that?

    Thanks.

    The differences are the differences between a string expression and a string literal, the command which you note that works is a string expression which is a concatenation of integers and string literals and variables that resolve to integers. In the case above, all you have are integers designated by hex notation. You have no string literals or variables in the expression.

    The first of the examples which you list as not working is a string expression (delimitted with double quotes) containing nothing but a single string literal (delimitted with single quotes). The second doesn't work because you don't have commas between the integers that you want to send and you are probably just sending a single 8bit integer, The last is a single string literal. It includes the $ characters and the commas.

    The classic example in demonstrating how this works. All of the following will send the string 'HELLO'
    send_string dvDevice,'HELLO'
    send_string dvDevice,"'HELLO'"
    send_string dvDevice,"'H','E','L','L','O'"
    send_string dvDevice,"$48,$45,$4c,$4c,$4f"
    send_string dvDevice,"72,69,76,76,79"
    send_string dvDevice, "72,$45,'LL','O'"
    a = 'H'
    b = 'E'
    c = 'L'
    d = 'O'
    send_string dvDevice,"a,b,c,c,d"
    

    The final hello shows how to include a variable in a string expression.
  • jabramsonjabramson Posts: 106
    That helps a lot, thanks!
Sign In or Register to comment.