alejandro
3rd May 2002, 01:15
This code is a continuation of this thread (http://www.baanboard.com/baanboard/showthread.php?threadid=1844) .
It will work for:
BaaN IV c4
Unix
Windows 98
In other environments not tested.
The thread related shows how to call a Server File Browser in BaaN
This code shows the windows dialog open file. It works to select a file or a folder. The code has two parts:
tccomfindwinf.exe: A VB script that must be compiled and stored in the server.
tccomfindwinf: 3GL script that has to be called to execute tccomfindwinf.exe and take the file or folder name selected.
Here is the code:
PeterH
17th April 2003, 12:59
To get the visual basic code working on a w2k system I had to make the following changes:
Original code:
Dim fname As String
filebox.lpstrFile = Space(255)
Changed to:
Dim fname As String * 255
filebox.lpstrFile = fname
Alejandro thanks.
dorleta
13th June 2003, 10:59
another solution maybe
I have down the java class to local probably it is not neccesary and with a little modification you can get a file in the server or local pc in all the systems win, unix...
code of the baan dll:
function extern string aemcs.expl.local.file()
{
long dummy, fich, dummy2
string destino(50)
string bufer(80)
dummy = remove.local.file("c:\tmp.txt")
dummy = server2client("/interfaz/Explorador.class", "c:\Explorador.class", false, false)
remove.local.file("c:\tmp.txt")
dummy2 = app_start("javaw Explorador", "c:\\", "", "", "")
if dummy2 < 0 then
return("")
endif
destino = creat.tmp.file$()
fich = -1
while fich < 0
dummy = client2server("c:\tmp.txt", destino, false )
while dummy < 0
dummy = client2server("c:\tmp.txt", destino, false )
endwhile
fich = seq.open(destino, "r")
dummy = seq.gets(bufer, 1000, fich)
while dummy < 0
dummy = seq.gets(bufer, 1000, fich)
endwhile
seq.close(fich)
file.rm(destino)
endwhile
return(bufer)
}
code of the java class:
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;
public class Explorador extends Frame
{
public Explorador()
{
this.addWindowListener (new WindowAdapter(){
public void windowClosing(WindowEvent e){
dispose();
System.exit(0);
}
});
}
public static void main(String args[])
{
String Cadena = new String();
Explorador f = new Explorador();
f.setSize(10,10);
f.show();
f.hide();
FileDialog diag = new FileDialog(f, "Seleccionar Fichero", 0);
diag.show();
Cadena = diag.getDirectory() + diag.getFile();
System.out.println(Cadena);
// para crear un puntero de lectura de el fichero es obligatorio
// el bloque try ya que hace un throws a una excepción (ver ayuda)
try {
FileWriter fr1 = new FileWriter("c:\\tmp.txt");
BufferedWriter bw = new BufferedWriter(fr1);
PrintWriter salida = new PrintWriter(bw);
salida.println(Cadena);
salida.close();
}
// se recoge la excepción
catch(java.io.FileNotFoundException fr1) {
System.out.println("Archivo no encontrado: " + fr1);}
catch(java.io.IOException ioex) {};
System.exit(0);
}
}
NPRao
13th January 2005, 21:42
Latest feature ->
SSA ERP LN 6.1 Programmer's Guide
dir.select.dialog.local()
--------------------------------------------------------------------------------
Syntax
long dir.select.dialog.local( ref string dirname )
Description
This shows the Windows Browse For Folder dialog, to allow the user to select one new or existing folder (directory) on the client.
Arguments dirname
Output argument which will contain the full path of the directory selected by the user.
Return values
1 A directory selected by the user
0 No directory selected. Folder browser dialog canceled by the user.
-1 Error occurred
Context
ttdllbw library function.