action-color question

just a quick question
does anyone know if there is a quick way to drop the " marks that are produced before and after the hex number?
eg in this example:

 <action-color name="color">

 <action-javascript>
 function fwBeforeEndBody(){
 var col="&color;";
 var headTag = fwDocument.fwTags.fwFind("head");
 if (headTag)
 var cssStyles = headTag.fwAddCSSStyles();{
 cssStyles.fwAddRawln('.MyStyle { color:'+ fwSubstitute(col) + '; }');
 }
 }

would produce this:

    .MyStyle { color:"#0000ff"; }

which is wrong so apart from building up the styles as in tech note 12 in bits is there a way just to drop the quotes?

I am already guessing it’s a no but if anyone does have alternative it would help quite a bit in my scenario. I was thinking Weaver’s switch method might be the way but the action-color seems to always include the quote.

max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Max,

Try replacing this line:

cssStyles.fwAddRawln(‘.MyStyle { color:’+ fwSubstitute(col) + ‘; }’);

with this:

cssStyles.fwAddRawln(‘.MyStyle
{ color:’+fwParameters.color.fwValue.fwHex+ ‘; }’);

and getting rid of this:

var col=“&color;”;

Joe

On 8 Dec 2008, at 22:16, max wrote:

just a quick question
does anyone know if there is a quick way to drop the " marks that
are produced before and after the hex number?
eg in this example:

<action-color name="color">

<action-javascript>
function fwBeforeEndBody(){
var col="&color;";
var headTag = fwDocument.fwTags.fwFind("head");
if (headTag)
var cssStyles = headTag.fwAddCSSStyles();{
cssStyles.fwAddRawln('.MyStyle { color:'+ fwSubstitute(col) +  

‘; }’);
}
}

would produce this:

   .MyStyle { color:"#0000ff"; }

which is wrong so apart from building up the styles as in tech note
12 in bits is there a way just to drop the quotes?

I am already guessing it’s a no but if anyone does have alternative
it would help quite a bit in my scenario. I was thinking Weaver’s
switch method might be the way but the action-color seems to always
include the quote.

max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Jo
thats perfect
works a blooming treat, thanks
:o)

max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Max,
Be aware that fwParameters.color.fwValue.fwHex will fail if the color
is set to ‘None’ in the UI as this can’t be coerced to a hex value.
To get around this try;
if (fwParameters.color.fwValue != “”){
cssStyles.fwAddRawln(‘.MyStyle
{ color:’+fwParameters.color.fwValue.fwHex+ ‘; }’);
}
Regards,
Tim.

FreewayActions.com - Freeware and shareware actions for Freeway
Express & Pro.

Protect your mailto links from being harvested by spambots with Anti
Spam.
Only available at FreewayActions.com

http://www.freewayactions.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Good catch. If you don’t want people to use None as a color then use
the fwParameterChanged(newParam, oldParam) function to revert any
changes to None back to the oldParam, alternatively you can use the
fwParameters.color.fwValue.fwHasValue option too, I seem to remember
having problems matching against the empty string.

Joe

On 9 Dec 2008, at 07:42, Tim Plumb wrote:

Hi Max,
Be aware that fwParameters.color.fwValue.fwHex will fail if the
color is set to ‘None’ in the UI as this can’t be coerced to a hex
value.
To get around this try;
if (fwParameters.color.fwValue != “”){
cssStyles.fwAddRawln(‘.MyStyle
{ color:’+fwParameters.color.fwValue.fwHex+ ‘; }’);
}
Regards,
Tim.

FreewayActions.com - Freeware and shareware actions for Freeway
Express & Pro.

Protect your mailto links from being harvested by spambots with Anti
Spam.
Only available at FreewayActions.com

http://www.freewayactions.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Cheers tim and joe
I sort of thought in the back of my mind that this was something I needed to tackle… in fact after looking at what I may need to do this action my need produce the style like this…

border-color:#CDD2DD black #CDD2DD #CDD2DD;

as well as the choice of just one colour parameter, so quite a bit more work getting all the possible variations!!!

Actually I did have a related question which was why isn’t transparent used in color? was there a reason or just one of those things that never made into the normal freeway setup.

Anyway thanks for all the pointers/pitfall and advise its much appreciated and cuts the time down a by a big chunk.

max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options