Author |
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: December 18 2010 at 15:12 | IP Logged
|
|
|
I am trying condense some formulas to send several text strings with global variables via ph_comsendstring.
This is what I use presently:
ph_comsendstring( 1, "VARIABLE,\x22" + ph_getglobal_s("VARIABLE") + "\x22~r")
I have some strings with many fields and I would like to be more efficent so I tried unsuccessfully the following:
ph_comsendstring( 1, "VARIABLE,\x22" + {VARIABLE} + "\x22~r,\x22")
which returned an error. I use this statement without any issue:
ph_ctlrsq("FUZZY",231," Water: {WATER_PRESSURE_1}PSI~tWind: {WIND_DIR} @ {WIND_SPEED}kts",8,100)
Then I tried this:
ph_comsendstring( 1, "VARIABLE,\x22" + "{VARIABLE}" + "\x22~r,\x22")
It transmitted VARIABLE,"{VARIABLE}" not the contents of VARIABLE.
What am I missing here?
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 21 2010 at 21:42 | IP Logged
|
|
|
Patrick,
Not sure why your last example sent "{VARIABLE}"...it should have worked. However, there is another shorter version which you can try:
ph_comsendstring(1,"VARIABLE,\x22{VARIABLE}\x22~r,\x22")
See what you get with that.
Dave.
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: December 22 2010 at 20:32 | IP Logged
|
|
|
I tried that and I transmitted:
{VARIABLE}
This seems to be specific to ph_comsendstring.
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: December 23 2010 at 05:50 | IP Logged
|
|
|
After getting the PH_Comm plugin running I am experiencing the same thing with ph_picmd.
Here is what I am using to transmit successfully:
ph_picmd(5,"NUVO",1,0,0,"*S5DISPLINES0,0,0,\x22"+ph_getgloba l_s("sb_current_title") + "\x22,\x22" + ph_getglobal_s("sb_album") + "\x22,\x22" + ph_getglobal_s("sb_artist") + "\x22,\x22" + ph_getglobal_s("sb_title") + "\x22~r","")
If I try to use this:
ph_picmd(5,"NUVO",1,0,0,"*S5DISPLINES0,0,0,\x22{sb_current_t itle}\x22,\x22{sb_album}\x22,\x22{sb_artist}\x22,\x22{sb_tit le}\x22~r","")
This is what is transmitted:
*S5DISPLINES0,0,0,"{sb_current_title}","{sb_album}","{sb_art ist}","{sb_title}"
I'm dreading transmitting the strings with 32 variables. I tried using single quotes with the same results.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 23 2010 at 21:04 | IP Logged
|
|
|
This is very bizarre. Ive run some tests and it works for me. The only way I can get the same results as you is if the GV named VARIABLE does not exist...that or I don't use all upper case like {VARIABLE}. Then it indeed fails. Which is definitely why you're getting the results in the second case. While the ph_getglobal_?? functions will work without matching the case, the {GV} form requires all upper case. All global and system variables should be referenced using upper case.
Try changing your second example to upper case and see what happens for you. If your previous example of {VARIABLE} was uppercase (and a GV with an ID of VARIABLE truly exists), let me know and I'll try to determine where the problem may be.
Dave.
|
Back to Top |
|
|
|
|