vahdani
5th April 2006, 16:14
Hi all,
this is my solution for the general problem of selecting local files. Please follow the instrauction in the README file.
Notes:
Although located on the server, the BaanFileSelector.exe is of course run on the client and not on the server! It will be copied automatically to the Windows Temp directory if not already there and then started. To find out the location of the Temp directory on your PC you can type the following in your dos box:
cd %TEMP%
The program generates a text file in this temp directory which will then be copied back to the server for interrogation
You can do a stand alone test of the exe by copying it to your PC and running it. The usual windows file selector dialog should come up. If you select a file and exit a file BaanFileSelector.txt should be generated in the same directory.
Andreas
6th April 2006, 09:56
Hi vahdani,
nice idea!
We do it the same way for some years now. Only difference is that the program is located on our server and we transfer and execute it to/on client from the Baan Session. No requirement to install on client and it also works with WebTop.
Next Step (if i will find the time) is to make the FileSelector Program platform independent (java ?) so it can also be used from a Linux-Client.
Andreas
vahdani
6th April 2006, 11:25
Hi Andreas,
I think I caused some misunderstanding in my description: My solution works exactly like yours. The BaanFeleSelector.exe is on the sever and will be copied to the client if not already there.
As for platform independence: This is not going to be easy as long as there is nothing comparable to bwdll for Linux.
en@frrom
3rd August 2006, 15:50
Hi Vahdani,
I have a suggestion for a serious practical improvement. Right now I cannot determine the file types to be looked for. It would be very handy if I can for instance send an optional variable along in the Baan function, with the file type(s) which the file browser dialog should display, and maybe another parameter indicating whether the user is allowed to choose different file types in the dialog, just like regular Windows functionality...
For instance, for a data import program I want users to be able to see only txt-files..
Would be great if you added this feature to your program..
Regards,
En
vahdani
7th August 2006, 19:13
Hi En!
Thank you for your very good suggestion. Here a new version with filter functionality that you requested. Please note that the old exe must be removed from client Temp folder (see README.txt file enclosed).
There is now an extra paramter for filter string in the form of:
description1|filter1|description2|filter2|...
example: "All files| *.*|pdf files |*.pdf"
en@frrom
9th August 2006, 10:40
Thanks for this updated version. It works fine. Just had to do 2 little changes to the script to get it working: you probably forgot to include
#pragma used dll ottdllbw
and I gave the path in function server2client instead of the non-declared variable you used..
Thanks a lot!
george7a
28th November 2006, 12:13
In LN the following functions are available (from ottdllbw)
function extern long seq.open.dialog.local(
boolean mselect,
const string defaultname(),
const string directory(),
const string filter(),
ref string filename() )
Descr : Show the Windows file-open dialog to allow the user to select one or more files.
Pre :
Post : When multiple select was specified and more than one files selected by the user
some state information is saved for subsequent calls to seq.open.dialog.next()
This state information is set in xmlFileNameNodes and xmlCurFileNameNode.
Input : mselect when true multiple select is allowed by the user.
defaultname The default filename shown in the file-open dialog
directory The startup directory for this dialog. In case of an empty string
the My Documents directory will be the default.
filter Specifies all possible file extensions for the file. The string must
contain pairs of strings that are separated by a "|" character.
The first string in each pair is a filter name. The second string must
be a filter pattern. Multiple filters patterns can be specified by separating
them with a semicolon.
Output : filename Will contain the full pathname of the file selected by the user. In case
mselect is true, possible other selected filenames can be retrieved using
function seq.open.dialog.next().
Return : > 0 Number of files selected by the user.
0 No files selected (cancel pressed by the user)
-1 Error occurred.
|******************************************************************************|
function extern boolean seq.open.dialog.next(
ref string filename() )
Descr : Retrieve the next full pathname of the file selected by the user in a previous
seq.open.dialog.local() function. This function should only be used when a previous
call to seq.open.dialog.local() returned a value greater than 1.
Pre : State information is set in xmlFileNameNodes and xmlCurFileNameNode.
Post : xmlCurFileNameNode updated. When the last node was retrieved, the xmltree referred
to by xmlFileNameNodes is deleted and these variables are set to 0.
Input : -
Output : filename Will contain the full pathname of a file selected by the user.
Return : true when succesfully retrieved the next file name.
false when failed to retrieve the next file name.
function extern long seq.open.local(
const string filename(),
string mode(2),
[ long remove.after.use ],
[ long read.only ] )
Descr : this function opens the file, specified by the file argument, on the client.
A pointer is returned to be used to identity the filepointer(fp) in the
subsequent operations
Pre : -
Post : file is opend on the client system.
Input : see param list
<optional> remove.after.use remove local file when file is closed
<optional> read.only when value <> 0 the file attribute 'read-only' will be set
This is used by script editors like CodeWright to display a file in
read-only mode
Output : -
Return : >0 success; file pointer returned for use in the local subsequent operations.
<=0 error; that is, the file could not be opened.
|**********************************************************************|
function extern long seq.saveas.dialog.local(
const string defaultname(),
const string directory(),
const string filter(),
ref string filename() )
Descr : Show the Windows file-save-as dialog to allow the user to select one new or
existing file to save.
Pre : -
Post : -
Input : defaultname The default filename shown in the file-save-as dialog
directory The startup directory for this dialog. In case of an empty string
the My Documents directory will be the default.
filter Specifies all possible file extensions for the file. The string must
contain pairs of strings that are separated by a "|" character.
The first string in each pair is a filter name. The second string must
be a filter pattern. Multiple filters patterns can be specified by separating
them with a semicolon.
Output : filename Will contain the full pathname of the file selected by the user.
Return : 1 One file selected by the user.
0 No files selected (cancel pressed by the user)
-1 Error occurred.
|*********************************************************************|
function extern long dir.select.dialog.local(
ref string dirname() )
Descr : Show the Windows Folder browser dialog to allow the user to select one new or
existing folder (directory)
Pre : -
Post : -
Input : -
Output : dirname Will contain the full pathname of the directory selected by the user.
Return : 1 One directory selected by the user.
0 No directory selected (cancel pressed by the user)
-1 Error occurred.
- George
kysersoze12
26th March 2007, 12:04
Excellent utility .