Home AMX User Forum NetLinx Studio

Transform string to variable name

Is there any way to transform a string to a device name?

We would like to receive a variable name on a DATA_EVENT something like
"'vdvSomething; blahblah'"

and then send 'blahbla' to the vdvSomething device with SEND_COMMAND....

anyone got an idea how to transform 'vdvSomething' to a variable name?

Comments

  • ericmedleyericmedley Posts: 4,177
    I don't know if there's any way to cull the compiled code for what you chose to call the device. However, if you made your own array that mirrored whatever you called the device in code you could get what you're looking for.

    Just match up the device number with the cell in the array and send the master or whatever a string.
  • AMXJeffAMXJeff Posts: 450
    Is there any way to transform a string to a device name?

    We would like to receive a variable name on a DATA_EVENT something like
    "'vdvSomething; blahblah'"
    

    and then send 'blahbla' to the vdvSomething device with SEND_COMMAND....

    anyone got an idea how to transform 'vdvSomething' to a variable name?

    Our you could just:
    "'33001:1:0; blahblah'"
    
    
  • Spire_JeffSpire_Jeff Posts: 1,917
    You could also do a switch()...case: that parses the command to remove the device and then sends the remaining data as necessary. But, all of these methods require you to create a finite list of devices you can send to. If you wanted to be able to send to any device, you might be able to do something in Duet that would allow this.

    Jeff
Sign In or Register to comment.