Page not found

404

404 Oops! We lost your page...
Home
Grocery Shopping List & Recipe Organizer Software Shop'NCook - Nutrition Script Library Page not found | Shop'NCook

Page not found

404

404 Oops! We lost your page...
Home
Page not found | Shop'NCook

Page not found

404

404 Oops! We lost your page...
Home
Page not found | Shop'NCook

Page not found

404

404 Oops! We lost your page...
Home

How To Write Your Own Nutrition Script

The nutrition scripts are a powerful feature that allows to compute nutritional formulas and customize the display of nutritional information. You need to write the script in a text file, save if with the extension ".txt" and add it to the NutritionScript folder. You will then be able the select it in the nutrition format pull-down menu in the Preferences. An example of a simple script to display the net carb is as follow:

#NEWLINE
Net Carbs: <(CARB-FIBER)-SUGAR_ALCOHOL>g

"Net Carbs: " and "g" are display unchanged. The formula in between < > ((CARB-FIBER)-SUGAR_ALCOHOL) is evaluated, and the result displayed instead. You can specify the following nutrients:

WATER, ENERGY, ENERGY_CAL, ENERGY_KJ, PROTEIN, FAT, ASH, CARB, FIBER, SUGAR, CALCIUM, IRON, MAGNESIUM, PHOSPHORUS, POTASSIUM, SODIUM, ZINC, COPPER, MANGANESE, SELENIUM, VIT_C, VIT_B1, VIT_B2, VIT_B7, VIT_B3, VIT_B6, FOLATE, FOLIC_ACID, FOOD_FOLATE, DFE, VIT_B12, VIT_A, VIT_A_RAE, VIT_A1, VIT_E, VIT_K, ALPHA_CAROTENE, BETA_CAROTENE, BETA_CRYPTOZANTHIN, LYCOPENE, LUTHEIN_ZEOZANTHIN, SAT_FAT, MONOUNSAT_FAT, POLYUNSAT_FAT, CHOLESTEROL, ALCOHOL, CAFFEINE, VIT_D, STARCH, THEOBROMINE, PHYTOSTEROLS, SUGAR_ALCOHOL

Note: When combining different operations - i.e. addition, substraction, multiplication and divisions - make sure to group the operations with parenthesis, otherwise the operations are evaluated from right to left.

You can also use PROTEIN_FACTOR, FAT_FACTOR and CARB_FACTOR, which are the energy per gram of the protein, fat and carbohydrate contents respectively to calculate their contributions to the total energy.

You can combine simple statements to display multiple information. For example, if you wanted to display the total energy and the energy percent contributed by the carbohydrates and proteins, you can write a script with:

Total energy: <ENERGY> <ENERGY_UNIT>
#NEWLINE
Energy percent contributed by proteins and carbohydrates: <((CARB*CARB_FACTOR*100)+(PROTEIN*PROTEIN_FACTOR*100))/ENERGY>%

The #NEWLINE statement indicates to insert a new line. Statements starting with # must always be at the beginning of a line.

You can also use conditional statements. For example:

#IF FIBER<4
Low fiber content!
#ELSE
High fiber content!
#ENDIF

This code will display "Low fiber content!" if the fiber content is less than 4, and "High fiber content!" otherwise.

Some formatting command, for example #TAB (to input a tab) and #NEWLINE (to input a new line), are also available. Commands must always be at the beginning of a line. For more information on the syntax and the commands available in nutrition scripts, consult Shop'NCook web page and the forum.

Copyright Rufenacht Innovative 2004.

Page not found | Shop'NCook

Page not found

404

404 Oops! We lost your page...
Home