LAUNCH
From CometWiki
(New page: LAUNCH Syntax: LAUNCH Windows-program-or-document Placement: Place the LAUNCH command after the REPORT command. Discussion: Under Comet98 and greater, the LAUNCH command launches a...)
Newer edit →
Revision as of 13:01, 5 June 2009
LAUNCH Syntax: LAUNCH Windows-program-or-document Placement: Place the LAUNCH command after the REPORT command. Discussion: Under Comet98 and greater, the LAUNCH command launches a Windows application or document. Here are some ways the LAUNCH command can be used:
Launching a Windows program
LAUNCH c:\msoffice\excel\excel.exe
Launching a Windows program and passing it a file name
LAUNCH c:\msoffice\excel\excel.exe c:\budget\1998.xls
Launching a spreadsheet file
LAUNCH c:\budget\1998.xls
When an "xls" file is launched, Windows automatically runs the Excel program (based on the file extension).
Launching a text file LAUNCH c:\text\sample.txt
When a "txt" file is launched, Windows automatically runs the associated text editor (Notepad, Wordpad, etc.).
Launching an intranet document LAUNCH c:\intranet\home.htm
When a local "htm" file is launched, Windows automatically runs the default web browser and displays the HTML document.
Launching an Internet document (web page) LAUNCH http://www.signature.net/signature/index.html
When the launch value starts with "http://", Windows runs the default web browser, connects to the Internet (if not already connected), and displays the named web page.
History: This command was added in version 99.01. Example: The following report erases and then creates a data file named TEMPFILE.CSV ("CSV" means "comma separated values") on directory DSK. The PRINTER statement includes a "D" parameter, which specifies a delimited format for the output data. The report inputs data from the CUSTOMER file and outputs data to the TEMPFILE.CSV file.
After the report has been processed, the Reporter launches the Excel spreadsheet program which opens the TEMPFILE.CSV file.
ERASE TEMPFILE.CSV,DSK PRINTER TEMPFILE.CSV,DSK,D INPUT CUSTOMER REPORT PRINT CUST.NUMBER;CUST.NAME;CREDIT.LIMIT;CURRENT.AR; AR.OVER.30.DAYS;AR.OVER.60.DAYS;AR.OVER.90.DAYS; AR.OVER.120.DAYS LAUNCH c:\msoffice\excel\excel.exe c:\comet\dsk\tempfile.csv
Notes: The Launch command expects the target file to be local to the client PC. If this is not the case you may need to execute a copyfile program prior to the launch, then launch the local copy of the file.
The Enter command can be used to run your copyfile program. Before writing your own copyfile program you might try using the CUtlCpy utility which is released as part of the UTL directory:
ERASE MyTextFile.txt,DSK PRINTER MyTextFile.txt,DSK INPUT CUSTOMER REPORT PRINT CUST.NUMBER;CUST.NAME;CREDIT.LIMIT;CURRENT.AR; AR.OVER.30.DAYS;AR.OVER.60.DAYS;AR.OVER.90.DAYS; AR.OVER.120.DAYS ENTER CUtlCpy "MyTextFile.txt,DSK,MyPersonalTextFile.txt,$(CATEMP),Y,Y,T"
CUtlCpy includes an option to launch the destination file after doing the copy so in this case you don't even need the Reporter launch!