andy2609
30th May 2012, 19:09
Hi

I am successfully reading specified files from client directories in a 4GL program using client2server. This all works well and is OK when the name of the file to be moved to the server is known.

However, is there a method of reading a client directory to determine the files that are present? Obviously, 'dir.open' and 'dir.entry' can be used for server directories, but is there an equivalent for client directories or, if not, does anyone know of an alternative method that can be used?

Thanks in advance.
Andy

zardoz
30th May 2012, 19:29
This exists in LN, I don't remember if already present in Baan IV....

dir.select.dialog.local()

Syntax:
#include <bic_desktop>

function 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
ref string 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
This function is implemented in the 4GL Engine and can be used in all script types.

günther
31st May 2012, 10:23
Hi Andy.

Have a look at http://www.baanboard.com/baanboard/showthread.php?t=62410.

Regards
Günther

andy2609
31st May 2012, 12:38
Hi Zardoz

Thanks for your response. However, the include bic_desktop is not available on this installation.

In any case, what I am trying to do is to enable a Baan program to read the contents of a client directory without user interaction and then to move the files to the O/S (with client2server) for processing.

Thanks
Andy
(As an additional note - I inadvertently checked the Baan IVc4 box instead of Baan Vb, which is the system I am working on, when I submitted this post!)

günther
31st May 2012, 12:44
Hi Andy.

Here's a code snippet that I'm using:


rc = app_start("cmd.exe /C " &
"dir /B " & strip$(dir.client) & "\" & file &
" >" & strip$(dir.f),
"", "", "", "")

if rc > 0 then
wait(rc, WTHANG)
endif

MY.DELAY(1.0) | might by essantial to wait at 1 second!

long i
for i = 1 to 10
rc = client2server(dir.f, dir.t, TRUE, TRUE)
if rc = 0 then
break
endif
MY.DELAY(1.0)
endfor

MY.DELAY(1.0)
remove.local.file(dir.f)


Regards
Günther

andy2609
31st May 2012, 13:21
Thanks Gunther

This code is useful, but in the situation I have, the command prompt (cmd.exe) will not necessarily be available to the users and I will need to preserve the original file names when moving them to the server.

I really need to be able to just read the client directory file names and then retrieve them one by one.

Regards
Andy

günther
31st May 2012, 14:03
Andy,

my piece of code does exactly what you want. call the dos command "dir", output to a file on the client pc, transfer that file to the server -- read that file and you know the files on the client.

Günther

andy2609
31st May 2012, 19:37
Hi Gunther

Sorry, I misinterpreted what you had written. This works perfectly, of course. Thank you very much!

Andy