View Single Post
  #1  
Old 30th November 2001, 16:47
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,905
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Creating your own ttstpconv Sample

Below is a sample of device driver which could be used in replace of ttstpconv. The original source was posted by Kevin Brock. I modified it for my use on our system. This is just a sample of what you could do. I have another version that uses a table and tells which macro to launch for excel.
See the attached zip file for a copy of the device data.

Code:
|***************************************************************************
|* tuddcconv2  0  VRC B40C c3 dev 
|***************************************************************************
|* Title                : tuddcconv2 - Download file, start excel, clean up
|* Description:         : This program removes downloads a report, starts excel,
|*                        and cleans up after itself.
|* Original Author      : Kevin Brock
|* Modified by          : Mark Holland
|* Date                 : 11/29/01
|***************************************************************************
|* Category             : Utility
|* Platform             : UNIX
|* 
|* License for tuddcconv2
|*
|* Copyright 2001 by Mark Holland
|*
|* All Rights Reserved 
|*
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation. 
|*
|* Mark Holland and Baanboard.com DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL <author> nor Baanboard.com BE LIABLE FOR ANY
|* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|***************************************************************************
|                                                                                
|*************************** DECLARATION SECTION ***************************
	#pragma nowarnings
	#include <bic_tt>	|include tools functions
	
function main()
{
| This session will run the standard program conversion session
|   ttstpconv using a temporary output file and the arguments
|   passed in 3+ verbatim.
| Arguments are passed from Baan spooler as follows:
|    1 = Name of input (temporary) file contain dev independent report
|    2 = Name of output file
|    3 = Additional arguments (from Device data)
|    4 = Specilar parm for ttstpconv (unknown reason)

	string	tmp.file(1024)		| Temporary file name.
	string	local.path(1024)	| Location on client for report.
	long	rc			| Return code.
	string	appl(132)		| Application to start.
	long	app_id			| Application id.
	string	start(1024)		| Parameter for the app_start
					| function which has application
					| and file to use.

| Convert the report file into the temp file.
	tmp.file = creat.tmp.file$( bse.tmp.dir$() )
	wait.and.activate("ttstpconv", argv$(1), tmp.file, argv$(3),argv$(4))
	
| Set the path on the client's pc and send the file down. Let the user
| enter the path and filename to be downloaded.
	local.path = strip$(spool.fileout)
	
| Copy file to the client.
	send.report.to.client(tmp.file, strip$(local.path))
	
| Start the file.	
	appl = "C:\program files\microsoft office\office\excel.exe"
	start= appl&" "&local.path
	
| Start the apllication	
	app_id = app_start(start,"","","","")
	
|Check status of Application.	
	rc = app_status(app_id)
	if(rc = 0) then
		message("Application start failed.")
	endif

| Remove our work file
	seq.unlink(tmp.file)

}

function send.report.to.client(const string src(), const string dest())
{
        long err

        err = server2client(src, dest, 1)
        if (err) then
            message("Error %d copying file to PC (may not have permission)", 
                err)
        endif
}
Attached Files
File Type: zip tuddcconv2.zip (14.1 KB, 1481 views)

Last edited by mark_h : 3rd May 2006 at 14:14.
Reply With Quote