#!/bin/ksh # # SeeToys - mock up inventory screen to demonstrate FacetWin's PC Command # # 11/15/97 Eric Yundt, FacetCorp Tech Support # BASEDIR=. SCREENDIR=$BASEDIR/. SEQ="\033[2]" IMAGEDIR=I: EXT=GIF clear echo "\nThis demo expects I: to be mapped to the Inventory Images directory. If you don't have it mapped, please map I: to where the GIF images are stored." # # It could be automapped it like so: # #echo -n "${SEQ}net use i: \\\\\\\\center\inv-images\r" # sleep 2 echo "\nUse \"j\" to scroll down and \"k\" to scroll up at Inventory Screen." sleep 1 echo "\nUse \"v\" to view images at Inventory Screen." sleep 1 echo "\nCurrently available images are:\n" echo "\tplush pooh bear" echo "\tsugar plum barbie" echo "\tbig robot buddy-pal" echo "\tred wagon classic" sleep 5 ############################################################################ ## ## This goes thru DOS Prompt to default Windows image viewer. ## VIEWCOMMAND="" ## ## ## This uses DOS batch file (which can be started minimized) to launch ## viewer. For example: ## ## "seeimage.bat": ## ---------------------------------------------- ## start %1 ## ---------------------------------------------- ## ## Or to navigate a tricky or long pathname directly. ## For example: ## ## "seeimage.bat": ## ------------------------------------------------------ ## c:\progra~1\common~1\micros~1\photoed\photoed.exe %1 ## ------------------------------------------------------ ## # VIEWCOMMAND="c:\seeimage.bat" ## ## ## Without using a DOS batch file sometimes more care must be taken ## to protect special characters from the "echo" command or UNIX shell. ## For example, "\c" (as in \common) is special to the "echo" command ## and must be protected and then the extra backslash must be protected ## from the UNIX shell. ## # VIEWCOMMAND="c:\progra~1\\\\common~1\micros~1\photoed\photoed.exe" ## ## # VIEWCOMMAND="C:\\\\viewers\\\\acdc\\\\acdsee.exe" ## ## [ "$VIEWCOMMAND" ] && $S=" " || S="" SMSO=`tput smso` RMSO=`tput rmso` CIVIS=`tput civis` CNORM=`tput cnorm` HOME=`tput home` LINENUM=5 ReadKey(){ KEY=`dd bs=1 count=1 2>/dev/null` return $KEY } ShowData(){ I=0 while [ $I -lt $LASTLINE ] do [ $I = "$1" ] && echo "| $SMSO${LINE[$I]}$RMSO |" \ || echo "| ${LINE[$I]} |" I=`expr 1 + $I` done } PaintScreen(){ echo -n $CIVIS$HOME echo "$SCREENHEAD" ShowData $1 echo "$SCREENFOOT" } ###################################################################### # # Load screen pieces # SCREENFILE=$SCREENDIR/screen_head.1 [ -f $SCREENFILE ] && SCREENHEAD1=`cat $SCREENFILE` || { echo "\n\tMissing \"$SCREENFILE\".\n" exit 1 } SCREENFILE=$SCREENDIR/screen_head.memo [ -f $SCREENFILE ] && SCREENMEMO=`cat $SCREENFILE` || { echo "\n\tMissing \"$SCREENFILE\".\n" exit 1 } SCREENMEMOPAD=" |" SCREENMEMOPAD=`echo "$SCREENMEMOPAD" | cut -c\`expr "$SCREENMEMO" : '.*'\`-` SCREENMEMO="$SMSO$SCREENMEMO$RMSO" SCREENFILE=$SCREENDIR/screen_head.2 [ -f $SCREENFILE ] && SCREENHEAD2=`cat $SCREENFILE` || { echo "\n\tMissing \"$SCREENFILE\".\n" exit 1 } SCREENHEAD=`echo "$SCREENHEAD1$SCREENMEMO$SCREENMEMOPAD\n$SCREENHEAD2"` SCREENFILE=$SCREENDIR/screen_foot [ -f $SCREENFILE ] && SCREENFOOT=`cat $SCREENFILE` || { echo "\n\tMissing \"$SCREENFILE\".\n" exit 1 } ###################################################################### # # Read screen data lines # I=0 while read LINE[$I] do I=`expr 1 + $I` done < $SCREENDIR/screen_data LASTLINE=`expr ${#LINE[*]} - 1` LASTINDEX=`expr ${#LINE[*]} - 2` ###################################################################### # # Paint Screen and process keystrokes until done # clear PaintScreen $LINENUM stty opost min 1 time 0 -icanon -echo KEY=none while [ $KEY != q -a $KEY != Q ] do ReadKey case $KEY in j) ### down 1 line [ $LINENUM -lt $LASTINDEX ] && LINENUM=`expr 1 + $LINENUM` ;; k) ### up 1 line [ $LINENUM -gt 0 ] && LINENUM=`expr $LINENUM - 1` ;; v) ### view image PARTNO=`echo \`echo "${LINE[$LINENUM]}" | cut -c1-8\`` echo -n "$SEQ$VIEWCOMMAND$S$IMAGEDIR$PARTNO.$EXT\r" # # echo -n "$SEQ$VIEWCOMMAND$S$IMAGEDIR$PARTNO.$EXT\r" \ # | od -c ; sleep 5 # ;; q) ### quit ;; esac PaintScreen $LINENUM done stty icanon echo echo -n $CNORM #+-----------------------------------------------------------------------------+ #| Store #: 7803 7:45 AM November 28, 1997 | #| Manager: George Lightfoot Shopping Days: 28 | #| Voice : 972-985-9901 *** Sale Thru Monday, Joe handles returns *** | #+-----------------------------------------------------------------------------+ #| | #| In Store Inventory Floor Cap: 83% Warehouse Cap: 91% | #| | #| PART# DESCRIPTION LOCATION P1 P2 IN HOLD | #| ------- --------------------- ------------ ------ ------ ---- ---- - | #| JB3201 red/blue beanie baby 23D / BR15C 12.24 17.49 121 8 ^ | #| HA1550 squatting teddy bear 12A / BR09 30.65 43.78 17 5 | | #| FP192 mini robo-crasher 15A / LFR7A 10.82 15.45 47 2 O | #| HO1118 red 6-wheel wagon 9B / BRA 16.08 22.97 38 3 | | #| FWL001 hook-n-ladder truck 22A / LFL2B 5.72 8.17 23 0 | | #| 1QNN035 plush pooh bear 43C / LFL3A 19.58 27.97 87 11 | | #| AFR1234 malibu beach barbie 18A / BL5A 11.28 16.11 41 3 | | #| SP1400 punch-nose clown 3E / BR082A 3.06 4.37 12 0 | | #| KM11117 rush limbaugh doll 22A / RFL1B 4.80 6.86 20 0 | | #| PCC4P4F crash-m/stack-m car 26B / RBR3A 1.67 2.39 35 1 | | #| 15ANSI long-hair pony 11A / FLR6A 6.63 9.47 22 7 | | #| BMA5022 big-daddy briefcase 35F / RFR3C 9.86 14.09 19 4 v | #+-----------------------------------------------------------------------------+ # O)rder, S)hip, V)iew, A)dd, D)elete, M)odify, S)ales, P)rint, H)old, Q)uit