Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: ph_comsendstring and global variables Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: December 18 2010 at 15:12 | IP Logged Quote patrickm

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 View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 21 2010 at 21:42 | IP Logged Quote dhoward

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: December 22 2010 at 20:32 | IP Logged Quote patrickm

I tried that and I transmitted:

{VARIABLE}

This seems to be specific to ph_comsendstring.

Back to Top View patrickm's Profile Search for other posts by patrickm
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: December 23 2010 at 05:50 | IP Logged Quote patrickm

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 View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 23 2010 at 21:04 | IP Logged Quote dhoward

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum