home *** CD-ROM | disk | FTP | other *** search
- WELCOME TO JCK ENTERPRISES'S (VER0790)
- MEMOS&MORE, THE FILE COMPANION
-
- SAMPLE PROGRAMS =================================================
-
- In most cases, application programs commonly used today allow the
- passing of a filename through the command line for automatic
- loading. The following examples are provided as guides for
- loading files into programs which do not accept filenames as
- command line parameters. Once the process is defined the
- launching of the file from the command line becomes transparent.
-
- Examples are provided for:
-
- 1) Lotus 1-2-3
- 2) DBase III Plus
- 3) AutoCad
-
- The techniques presented in the examples are fairly straight
- forward and can be modified as required. In addition, when
- MEMOS&MORE, THE FILE COMPANION launches a file it writes the file
- name information on the file EXITFILE.&MR in the Memos&More home
- directory as text. It has three lines which offers info on the
- launched file name in the following ways:
-
- 1) Path only;
- 2) Filename & Extension only
- 3) Path, FileName & Extension
-
- This file could be accessed by the application program or by some
- other means for processing.
-
- Example 1: Lotus Spreadsheets ==================================
-
- Lotus 1-2-3 provides a means of taking control upon loading
- through the use of the \0 macro found in a spreadsheet. This is
- invoked after the file is loaded. Lotus 1-2-3 also automatically
- loads a default filename(AUTO123.WK1), if it exists. These
- features have been combined in the following batch file.
-
- Note: This example assumes the following:
- o LOTUS 1-2-3 resides on the D:\LOTUS subdirectory
- o the file AUTO123.MAC resides on the D:\LOTUS subdirectory
- o first parameter( %1 ) is the Lotus worksheet you wish to load
- o you are running MS-DOS 3.30 or higher.
- o You also have the Allways Lotus Add-In package
-
- Sample Call from the Command Line: C:\ >LOTUS work1.wk1
-
- FILE: LOTUS.BAT
-
- @echo off
- .
- .
- . Fill in your stuff here ....
- .
- .
- set prog=123
- set oldpath=%path%
- set path=d:\lotus;d:\lotus\allways;%path%
- : ALLWAYS CHECK ......
- if not exist allways.adn set noall=true
- if "%noall%" == "true" copy d:\lotus\allways.adn allways.adn > nul
- : CHECK IF A PARAMETER IS PASSED IN .... ASSUMED A *.WK1 File ...
- IF "%1" == "" GOTO :SKIP
- ECHO %1 > 123FIL.TXT
- COPY D:\LOTUS\AUTO123.MAC AUTO123.WK1 > NUL
- :SKIP
- d:\lotus\%prog%
- : CLEANUP ALLWAYS STUFF ...
- if "%noall%" == "true" del allways.adn
- : CLEANUP THE PARAMETER STUFF ...
- IF "%1" == "" GOTO :SKIP2
- DEL 123FIL.TXT > NUL
- DEL AUTO123.WK1 > NUL
- :SKIP2
- : CLEAN UP THE ENVIRONMENT VARIABLES ...
- set path=%oldpath%
- set oldpath=
- set noall=
- set prog=
- .
- .
- . Fill in your stuff here ....
- .
- .
- :END
-
- The AUTO123.MAC file is a spreadsheet with the following Macro:
-
- I J K L M
- 1 \0 {WINDOWSOFF}
- 2 {OPEN "123FIL.TXT",R}
- 3 {READLN J10}
- 4 {CLOSE}
- 5 {RECALC J7..J7}
- 6 /fr{ESC}{ESC}
- 7 { J7 Contains: @TRIM(@S(J10..J10)) }
- 8 ~
- 9
- 10 { J10 Gets the file name to load ... }
-
-
- EXAMPLE 2: DBASE III Plus Data Base =============================
-
- DBASE III Plus provides a means of loading a .PRG program file
- from the command line. The file DBLOAD.PRG is a short DBase
- program which loads the desired database filename. The file
- DBLOAD.DBF is a short database consisting of only one character
- field(FNAME) of width 80(Use DBASE to look at the file
- DBLOAD.DBF). The DBLOAD.PRG program uses the DBLOAD.DBF to read
- the file DBFIL.TXT(created in the batch file) into the FNAME
- field and then uses the database specified in FNAME.
-
- Note: This example assumes the following:
- o DBASE resides on the D:\DBASE subdirectory
- o the DBLOAD.DBF & DBLOAD.PRG files also reside on D:\DBASE
- o first parameter( %1 ) is the DBase III Plus file when the
- second parameter ( %2 ) is specified. Other wise %1 is
- considered a .PRG file
- o you are running MS-DOS 3.30 or higher.
-
- Sample Call from the Command Line: C:\ >DBASE mydbf.dbf x
-
- FILE: DBASE.BAT
-
- @echo off
- .
- .
- . Fill in your stuff here ....
- .
- .
- d:
- cd \dbase
- : CHECK IF A SECOND PARAMETER IS PASSED IN .... THEN %1 IS A *.DBF ...
- IF "%2" == "" GOTO :PRG
- ECHO %1 > DBFIL.TXT
- SET PRG=DBLOAD
- GOTO :DBASE
- :PRG
- SET PRG=%1
- :DBASE
- d:\dbase\dbase %prg%
- : CLEANUP THE PARAMETER STUFF ...
- IF "%2" == "" GOTO :SKIPIT
- DEL DBFIL.TXT > NUL
- :SKIPIT
- cd\
- .
- .
- . Fill in your stuff here ....
- .
- .
- :END
-
- The DBASE III Plus program follows:
-
- FILE: DBLOAD.PRG
-
- set delete on
- use C:\DBASE\DBLOAD.DBF
- delete all
- pack
- go top
- append from C:\DBASE\DBFIL.TXT type delimited
- goto 1
- s = Trim(FNAME)
- use &s
-
-
- EXAMPLE 3: AutoCad Drawing Files ================================
-
- AutoCad provides a means to change the default file name at
- startup and the capability to start executing a script file from
- the command line. These features have been combined in the
- following example.
-
- Note: This example assumes the following:
- o AutoCad resides on the C:\ACAD subdirectory
- o the ACADLD.SCR file also resides on C:\ACAD
- o first parameter( %1 ) is the AutoCad .DWG file you wish to
- load
- o you are running MS-DOS 3.30 or higher.
- o you are using AutoCad version 10.
-
- Sample Call from the Command Line: C:\ >ACAD mydwg.dwg f
-
- FILE: ACAD.BAT
-
- @echo off
- .
- .
- . Fill in your stuff here ....
- .
- .
- IF "%1" == "" GOTO :NOFILE
- acad %1 acadld.scr
- GOTO :NOFILE
- :NOFILE
- acad
- :SKIP
- .
- .
- . Fill in your stuff here ....
- .
- .
- :END
-
- The ACADLD.SCR script follows:
-
- FILE: ACADLD.SCR
-
- This text file contains only two (2) lines. The first one with
- only option 2 invoked from the ACAD Main Menu. The second line
- which is blank tells ACAD to use the default filename which was
- passed in on the command line .
-
- line 1: 2
- line 2:
-
- ACKNOWLEDGEMENTS ================================================
-
- o Lotus, 1-2-3 and Allways are registered trademarks of Lotus
- Development Corp.
- o DBase III is a registered trademark of Aston-Tate Corp.
- o AutoCad is a registered trademark of AutoDesk, Inc.
- o MS-DOS is a registered trademark of MicroSoft Corp.