home *** CD-ROM | disk | FTP | other *** search
- echo off
- echo DVScr - batch to control convscr using 4dos
- echo By Yaniv Golan All Rights Reserved March 92.
- echo.
- rem check flags :
- iff "%1" == "/?" then
- echo Usage : DVSCR options filename
- echo options : /s convert script file (.dvs) to text file (.txt)
- echo /t convert text file (.txt) to script file (.scr)
- echo filename : if the file name is 2 characters long it is first
- echo assumed to be of the form xx-scrip.[dvs\txt]. if
- echo such file cannot be found, or if the length of the
- echo name is more then two characters, the filename is
- echo treated as a fully qualified name, with an extension
- echo according to the options setting.
- echo.
- echo bugs, comments etc. to Yaniv Golan s2942275@techst02.technion.ac.il
- echo.
- goto end
- endiff
- rem if number of parameters ins't 2, and 1st one isn't /?, then it
- rem is a error :
- iff %# LT 2 then
- echo Missing parameters. Type DVSCR /? for help.
- goto end
- endiff
- rem .txt to .dvs :
- iff %@lower[%1]==/t then
- set dvs_src_ext=txt
- set dvs_dst_ext=dvs
- set dvs_kbd_str="t"
- else
- rem .dvs to .txt :
- iff %@lower[%1]==/s then
- set dvs_src_ext=dvs
- set dvs_dst_ext=txt
- set dvs_kbd_str="s"
- else
- rem 1st parameter wasn't /t or /s, so it's a error.
- echo Incorrect option specified. type DVSCR /? for help.
- goto end
- endiff
- endiff
- rem if 2nd param is only 2 chars, try to see if it's xx-scrip.???
- iff %@len[%2] == 2 then
- set dvs_src_name=%2-scrip.%dvs_src_ext
- set dvs_dst_name=%2-scrip.%dvs_dst_ext
- if it isn't, try to see maybe it is xx.???
- if not exist %dvs_src_name goto long_name
- else
- if 2nd param is longer then 2 chars, or if the 2 chars version doesn't exist :
- :long_name
- set dvs_src_name=%2.%dvs_src_ext
- set dvs_dst_name=%2.%dvs_dst_ext
- rem if this too fails, then the file doesn't exit.
- iff not exist %dvs_src_name then
- echo File doesn't exist.
- goto end
- endiff
- endiff
- rem make the string which will be pushed to the kbd buffer:
- set dvs_kbd_str=%dvs_kbd_str 13 "%dvs_src_name" 13 "%dvs_dst_name" 13 "x" 13
- rem push the string
- keystack %dvs_kbd_str
- rem ... and run convscr.
- convscr > nul
- iff %? != 0 then
- echo An error was encountered during conversion.
- else
- echo Done.
- :end
-