| 151 | == Appmenu Shell Script == |
| 152 | The script starts running another script which displays the application menu. |
| 153 | {{{ |
| 154 | # sh /usr/sbin/diag/appmenu.sh & |
| 155 | }}} |
| 156 | |
| 157 | {{{ |
| 158 | #!/bin/sh |
| 159 | while : |
| 160 | do |
| 161 | /usr/sbin/diag/appmenu |
| 162 | tmp=$? |
| 163 | case $tmp in |
| 164 | 4) |
| 165 | /usr/sbin/card/ids ;; |
| 166 | |
| 167 | 5) |
| 168 | /usr/sbin/card/dfc ;; |
| 169 | |
| 170 | 6) |
| 171 | /usr/sbin/card/chkwgh ;; |
| 172 | |
| 173 | 8) |
| 174 | /usr/sbin/card/hway ;; |
| 175 | |
| 176 | 9) |
| 177 | /usr/sbin/card/mscalemodbus ;; |
| 178 | |
| 179 | 10) |
| 180 | /usr/sbin/card/mscaleeip ;; |
| 181 | |
| 182 | 12) /usr/sbin/diag/touchcal |
| 183 | if [ $? -eq 27 ] ; then |
| 184 | sh /usr/sbin/diag/cln_nand.sh |
| 185 | exit |
| 186 | fi ;; |
| 187 | |
| 188 | 13) sh /usr/sbin/diag/filemgr.sh ;; |
| 189 | |
| 190 | 14) /usr/sbin/diag/imageview /mnt/nand/cfg/slideshow.cfg ;; |
| 191 | |
| 192 | 21) sh /mnt/nand/bin/cust01.sh ;; |
| 193 | 22) sh /mnt/nand/bin/cust02.sh ;; |
| 194 | 23) sh /mnt/nand/bin/cust03.sh ;; |
| 195 | 24) sh /mnt/nand/bin/cust04.sh ;; |
| 196 | 25) sh /mnt/nand/bin/cust05.sh ;; |
| 197 | 26) sh /mnt/nand/bin/cust06.sh ;; |
| 198 | 27) sh /mnt/nand/bin/cust07.sh ;; |
| 199 | 28) sh /mnt/nand/bin/cust08.sh ;; |
| 200 | 29) sh /mnt/nand/bin/cust09.sh ;; |
| 201 | 30) sh /mnt/nand/bin/cust10.sh ;; |
| 202 | 31) sh /mnt/nand/bin/cust11.sh ;; |
| 203 | 32) sh /mnt/nand/bin/cust12.sh ;; |
| 204 | 33) sh /mnt/nand/bin/cust13.sh ;; |
| 205 | 34) sh /mnt/nand/bin/cust14.sh ;; |
| 206 | 35) sh /mnt/nand/bin/cust15.sh ;; |
| 207 | 36) sh /mnt/nand/bin/cust16.sh ;; |
| 208 | 37) sh /mnt/nand/bin/cust17.sh ;; |
| 209 | 38) sh /mnt/nand/bin/cust18.sh ;; |
| 210 | |
| 211 | 98) /usr/sbin/diag/diag m ;; |
| 212 | |
| 213 | 99) echo "\`" > /dev/carddsp |
| 214 | echo "Restarting...\\r" > /dev/carddsp |
| 215 | cd / |
| 216 | reboot & |
| 217 | exit ;; |
| 218 | esac |
| 219 | done |
| 220 | }}} |
| 221 | |
233 | | == Appmenu Config File == |
234 | | |
235 | | Any one item in the configuration file may end in “~XX” (where XX is a number of seconds for the item to be automatically selected). |
236 | | |
237 | | For example, type: |
238 | | {{{ |
239 | | # cat /mnt/nand/cfg/appmenu.cfg |
240 | | }}} |
241 | | |
242 | | Output: |
243 | | {{{ |
244 | | #!Lineno |
245 | | *04,%d. Truck Storage~08 |
246 | | #05,%d. Digital Fill Control |
247 | | #06,%d. Checkweigher |
248 | | #07,%d. 788 Compatibility |
249 | | *12,%d. Configuration |
250 | | *13,%d. File Manager |
251 | | *14,%d. Slide Show |
252 | | *99,%d. Return to Startup |
253 | | }}} |
254 | | |
255 | | If the first character of a line is a asterisk “*” the next two digits specify the return value when the item is selected. If the first character of a line is a pound sign “#” the item is disabled and will not appear when the menu is displayed. |
256 | | |
257 | | Starting with version 1.19 the [wiki:Docs/Prog/Manual/ConfigurationUtility Configuration Utility] “touchcal” has an option “Configure Menu” which allows the menu to be customized. This feature makes use of the “*” and “#” symbols to enable or disable items on the menu. Also to facilitate this feature instead of having specific items numbers such as “1.”, “2.”, etc… in the configuration file the item numbers are replaced with “%d”. The “appmenu” program will fill in the appropriate item number when “%d” is encountered. |
258 | | |
259 | | This configuration will cause a countdown to appear on the menu next to the “Truck Storage” selection. Another menu choice may be selected by pressing the appropriate number first. Using an arrow key to change the selection will stop the countdown so the menu will stay indefinitely. When the countdown is complete the menu item will be selected automatically. A file /tmp/cntdn is written as a flag so the auto start countdown only occurs on the first power up of the indicator. (/tmp is a ramdisk directory - it does not maintain its contents after reset) |
260 | | |
261 | | If the configuration file specifies seven items or less the application menu is shown on one page. If more items are specified the six items are shown per page with “Prev” and “Next” buttons shown to select pages. Up to five pages are possible. |
262 | | |
263 | | When any of these choices is selected the “appmenu” program terminates back to the script with a return value corresponding to the menu item selected. (The return value is based only on the line count of the appmenu.cfg file, not numbers specified in the configuration file). |
| 303 | The [wiki:Docs/Prog/Manual/ConfigurationUtility Configuration Utility] “touchcal” has an option “Configure Menu” which allows the menu to be customized. |
| 304 | |
| 305 | When any of these choices is selected the “appmenu” program terminates back to the appmenu.sh script with a return value corresponding to the menu item selected. |
269 | | case $tmp in |
270 | | 4) /mnt/nand/apps/ids/ids ;; |
271 | | 5) /mnt/nand/apps/dfc/dfc ;; |
272 | | 6) /mnt/nand/apps/chkwgh/chkwgh ;; |
273 | | 7) cd /mnt/nand/apps/788IDS |
274 | | /mnt/nand/bin/cardbas 788IDS.77X |
275 | | cd /mnt/nand/bin ;; |
276 | | }}} |
277 | | |
278 | | If the value is equal to 4 the program “ids” is called. If the value is 5 the program “dfc” is called. If the value is 6 the program “chkwgh” is called. If the value is 7 the script will change directory to /mnt/nand/apps/788IDS and call the program “cardbas” to run the 788 program “788IDS.77X”. When finished the script will change the current directory back to /mnt/nand/bin. |
| 311 | tmp=$? |
| 312 | case $tmp in |
| 313 | 4) |
| 314 | /usr/sbin/card/ids ;; |
| 315 | |
| 316 | 5) |
| 317 | /usr/sbin/card/dfc ;; |
| 318 | |
| 319 | 6) |
| 320 | /usr/sbin/card/chkwgh ;; |
| 321 | |
| 322 | |
| 323 | }}} |
| 324 | |
| 325 | If the value is equal to 4 the program “ids” is called. If the value is 5 the program “dfc” is called. If the value is 6 the program “chkwgh” is called. |
| 326 | |