Page 1 of 1

Active Fixture - Field 889

PostPosted: Fri Sep 23, 2016 3:39 pm
by Robertspark
This is a bit of a stange question, but I was wondering if: AS3.Getfield(899) , which is suppose to return the field value as a string could be changed from
"Active Fixture: G54" / "Active Fixture: G55" / "Active Fixture: G56" / "Active Fixture: G57" / "Active Fixture: G58" / "Active Fixture: G59"

to just return "G54", "G55", "G56", "G57", "G58" & "G59"

I have been failing to run a switch statement within a macro, and I'm guessing its because the switch statement is not happy with the "Active fixture:" part of the string returned?

I know on the Offsets tab the "Active fixture: G5x" is displayed, but is it required / can it be changed?

Thanks,

Rob

(i could probably use if /if else statements instead of switch)

Re: Active Fixture - Field 889

PostPosted: Fri Sep 23, 2016 5:03 pm
by cncdrive
Hi Rob,

Terry asked the same a week or so ago and I see 2 ways to get this info,
one is to check the 889 field the way you mentioned, but that contains a string with some text as you mentioned.
So, if you want to check it this string then do it with string.contains or string.indexof to see if G54 or G55 etc. is part of that string,
then you can decide which fixture is active even with the string contains more text not only the G54 or G55 etc.

Or you can read the buttonstate of the G54, G55 etc. buttons to get the information about which fixture is active.

Re: Active Fixture - Field 889

PostPosted: Fri Sep 23, 2016 6:06 pm
by Robertspark
Balazs, many thanks I tried using trim() but wasn't successful to truncate the string.

I'll have a go at either one of your solutions.

Re: Active Fixture - Field 889

PostPosted: Fri Sep 23, 2016 8:40 pm
by CNC22369
I needed to do something similar in some macros and ended up with this alternate 4-line approach.
The following code displayed (2nd box) just the G5x part of the 899 string.

char[] delimiters = { ' ' }; //delimiter(s) used for string split (a space)
string actfix899 = AS3.Getfield(899); //read text field 899
MessageBox.Show(actfix899); //display field before split (for test purposes)
string[] actfixtemp = actfix899.Split(delimiters); //split string by delimiter(s)
string actfix = actfixtemp[2]; //grab G5x segment of split string array
MessageBox.Show(actfix); //display G5x string segment after split (for test purposes)

Frank

Re: Active Fixture - Field 889

PostPosted: Fri Sep 23, 2016 8:42 pm
by Robertspark
Blimey, thanks Frank, much appreciated