_getText !

Topics related to the iOS and/or Apple Watch app.
Post Reply
Issachan
Posts: 1
Joined: Sun Jan 03, 2016 11:21 am

_getText !

Post by Issachan » Fri May 06, 2016 12:36 pm

Hi guys,
I have a cool script made by Dave for updating text on a label button "POWER", I would like to update an image of another button "COLOUR" based on the text of the "POWER" label.
I tried with _getText.
Script like this

_getText('POWER'); {
if ('POWER', 'STANDBY'); {
return 'COULOUR[@]DirecTVRemote/round_amber_40px.png';
} else if ('POWER', 'ON'); {
return 'COULOUR[@]DirecTVRemote/round_red_40px.png';
}
}

i also tried with
_setImage('COLOUR', 'DirecTVRemote/round_red_40px.png');
but fail :p

Can someone help please ? thanx.

User avatar
Dave
Site Admin
Posts: 79
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: _getText !

Post by Dave » Sun May 08, 2016 12:39 am

I believe the script should look something like this:

var buttonText = _getText('POWER');
if (buttonText == 'STANDBY') {
return 'COULOUR[@]DirecTVRemote/round_amber_40px.png';
} else if (buttonText == 'ON') {
return 'COULOUR[@]DirecTVRemote/round_red_40px.png';
}

The _setImage script looks correct, you just need to ensure that the image name EXACTLY matches the name you provide, including upper/lower case, etc.

Hope this helps.

Post Reply