ActionsDev
4 replies to this thread. Most Recent
max
5 Aug 2010, 10:14 am
Adjusting code within action-markup custom
Morning all
just a question about action-markup
Am I able to add some adjustment to the code within the action-markup chunk of code from the action palette? here is what I am doing:
<action-color name="color1">
<action-markup custom name="myMarkup">
some code #999999 some code
</action-markup>
I am sure I can….. but I just cant remember how it was done… for some reason I thought it was something like:
<action-color name="color1">
<action-markup custom name="myMarkup">
some code #&color1; some code
</action-markup>
but alas nope that’s not it and the poor brain cells are maximum capacity… so I cant even find it in the tech-notes or manuals… :o(
Can any one remember the correct way to do it?
cheers max
it’s better to be lucky than clever.. :o)
Joe Billings
5 Aug 2010, 10:22 amThat’s it, you just need to use fwSubstitute() on it once you have it.
var markup = fwSubstitute(fwMarkups.myMarkup);
Joe
On 5 Aug 2010, at 11:13, max wrote:
Morning all
just a question about action-markupAm I able to add some adjustment to the code within the action-markup chunk of code from the action palette? here is what I am doing:
<action-color name="color1"> <action-markup custom name="myMarkup"> some code #999999 some code </action-markup>I am sure I can….. but I just cant remember how it was done… for some reason I thought it was something like:
<action-color name="color1"> <action-markup custom name="myMarkup"> some code #&color1; some code </action-markup>but alas nope that’s not it and the poor brain cells are maximum capacity… so I cant even find it in the tech-notes or manuals… :o(
Can any one remember the correct way to do it?
cheers max
Tim Plumb
5 Aug 2010, 10:37 amHi Max, There are two ways to do what you want. In ‘classic’ (non-JavaScript) actions you can use internal references to the value of other controls.
For example;
<action name="Acrobat" title="Link to PDF" preview-text="PDF &Name;"height=12>
<action-text name="Name" default="Download" required />
Here we can see the value provided by the ‘Name’ parameter is echoed to the preview text of the main action tag.
These still work in JavaScript actions but I doubt the replacement will work in your markup block.
The best solution to this is to use token replacement in your action to replace markers for the user defined values.
For example;
var theMarkup = fwMarkups["myMarkup"].toString();
theMarkup = theMarkup.replace(/__color1__/g,
fwParameters["color1"].fwValue.fwHex);
theMarkup = theMarkup.replace(/__color2__/g,
fwParameters["color2"].fwValue.fwHex;
etc.
Your markup would look like this;
<action-markup custom name="myMarkup">
some code __color1__ some code
some more code __color2__ some more code
</action-markup>
You can then output the markup to the document, write it to an external file or do what you need to do with it.
The benefit of this technique over the classic method is that you can check that the values you need are all present and correct. For example if you wanted the user to select a color and they chose ‘none’ then you could either stop the publish with an error (maybe a little harsh) or better still substitute your own, default, color into the output.
I hope this helps. Regards, Tim.
On 5 Aug 2010, at 11:13, max wrote:
Morning all just a question about action-markup
Am I able to add some adjustment to the code within the action- markup chunk of code from the action palette? here is what I am doing:
<action-color name="color1"> <action-markup custom name="myMarkup"> some code #999999 some code </action-markup>I am sure I can….. but I just cant remember how it was done… for some reason I thought it was something like:
<action-color name="color1"> <action-markup custom name="myMarkup"> some code #&color1; some code </action-markup>but alas nope that’s not it and the poor brain cells are maximum capacity… so I cant even find it in the tech-notes or manuals… :o(
Can any one remember the correct way to do it? cheers max
FreewayActions.com - Freeware and commercial 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
Tim Plumb
5 Aug 2010, 10:39 amAha! Yes that would also work (albeit without the validation goodness of using token replacement). Regards, Tim.
On 5 Aug 2010, at 11:21, Joe Billings wrote:
That’s it, you just need to use fwSubstitute() on it once you have it.
var markup = fwSubstitute(fwMarkups.myMarkup);
Joe
FreewayActions.com - Freeware and commercial 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
max
5 Aug 2010, 10:48 amOh blooming hell I remember the substitute now…. AAAHHH!!! Thanks Joe and Tim
All the best Max
it’s better to be lucky than clever.. :o)
