L. Huinder
21st July 2009, 20:38
We are in the proces of moving from a Unix to Windows server and I am now facing a problem in a report script.

How can I translate these Unix commands into Windows commands?
I think the part of the script where the problem occurs is this:


command = "mv /baan/bse/folder/file1 /baan/bse/folder/file1.old"
shell(command,0)
fo = seq.open("/baan/bse/folder/file1","w")
lattr.print = false


The shell(command,0) creates the problem as this only runs under Unix. I am aware that the "mv" should also be replaced by "move"

Anyone any suggestions?

sushil
21st July 2009, 20:49
try this ,

app_start("cmd /c move <path>\file1 <dest_path> ","","","","")

http://www.baanboard.com/programmers_manual_baanerp_help_functions_client_file_access_app_start

NPRao
22nd July 2009, 00:02
Huinder,

Refer to the links -

file.mv function in BaanIV (http://www.baanboard.com/baanboard/showthread.php?t=32339&highlight=file.mv)

file.mv() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_directory_file_operations_file_mv)

sushil
22nd July 2009, 10:07
Instead of Direct command , i think you might need to add "cmd"

command = "cmd /c move baan\bse\folder\file1 baan\bse\folder\file1.old"
shell(command,0)

NPRao
22nd July 2009, 20:21
Instead of Direct command , i think you might need to add "cmd"
Sushil,

Your suggested code is not platform independent.

If file.mv() then it works on both Unix and Windows platforms.

sushil
22nd July 2009, 21:31
you are right , i just gave user "options" - so that he can try file.mv() which is platform independant.

or just add 'cmd /c...' to his existing piece of code , which he needs to run on windows Platform.

L. Huinder
23rd July 2009, 08:20
If I leave the line
shell (command,0)

I get message: FATAL ERROR: PTY error: 'No more pty's available' (e=0) GEEF <RETURN>

The shell(command,0) is a UNIX command?

matigro
23rd July 2009, 16:49
Yes, it is.
In Windows(tm) you can use:
exec.string ="cmd /C " & "my_program.exe"
app_start(exec.string, path.to.app, "", ret.app, ret.err) |* IN BaanIV
or
start.application.local(exec.string, true, flag.ret.application) |* In LN


You can read documentation here:
http://www.baanboard.com/programmers_manual_baanerp_help_functions_starting_and_stopping_programs_shell

NPRao
23rd July 2009, 21:34
If I leave the line
Code:

shell (command,0)

I get message: FATAL ERROR: PTY error: 'No more pty's available' (e=0) GEEF <RETURN>

The shell(command,0) is a UNIX command?
Huinder,

Please refer to the documentation. It is not a Unix command but works only on Unix platform.

shell()
Syntax

long shell( string command(.), long mode )

Description

This starts the vt200 compatible terminal emulator to execute the command specified in the command argument. The shell (for example, UNIX, VMS, or MPE) process is connected with the bshell by means of a pseudo tty. Running a shell does not block the bshell. You can switch to another window and perform other tasks.

The file.mv() should work, did you test it yet?