morpheus
7th August 2002, 12:53
Hello,
I want to call an executable file from BaaN. How do I do that?
Version - BaaN IV c4.
OS - Windows NT.

mark_h
7th August 2002, 14:28
You can use the app_start command. Follow this http://www.baanboard.com/programmers_manual_baanerp_help_functions_client_file_access_app_start
link to the Baanboard Wiki.

Mark

steveauckly
7th August 2002, 14:29
|First, load the dll
dll_id = load_dll("${BSE}\tools\ttB40_c\ottdll\odllbw")

|Second, get the function you want from the dll - this one starts an application
func_id = get_function(dll_id, "app_start" )

|Third, execute the function with parameters - this one starts notepad and brings up a file called example.txt
e = exec_function(dll_id, func_id, app_id, "notepad.exe example.txt", "", "", "", "")

morpheus
7th August 2002, 14:38
Mark,
In the meantime I tried my hands on run.prog(). I am able to execute the exe (wordpad in this case) at the background. But, once the session is over, I can see the exe still running at the background, from the NT Task Manager!!
Now, how do I stop that exe once the session is over!!?

~Vamsi
7th August 2002, 18:32
run.prog -> runs on the Baan application server
app_start -> runs on the Baan client (provided the client is BW)

So where do you want to run your app today?;)

morpheus
8th August 2002, 07:02
Hello,
I do understand the difference between run.prog() and app_start(), but the query is to HOW to stop the exe at the background once the session is over!!?:confused:

NPRao
8th August 2002, 09:08
Hi morpheus,

I dont think you can control the applications from the BaaN server end to the client end.

But you might invoke the task manager in the Windows, where you can choose the particular application to be killed/end-task.

e = app_start("C:\WINNT\system32>taskmgr", "", "", "", "")

Hope that helps you out.

morpheus
8th August 2002, 10:43
Hello Rao,
That's what I was thinking of. Will give it a try.
Thanks everybody...

~Vamsi
8th August 2002, 13:03
Somewhere along the way I lost whats happening here:
In the meantime I tried my hands on run.prog(). I am able to execute the exe (wordpad in this case) at the background. But, once the session is over, I can see the exe still running at the background, from the NT Task Manager!!
Now, how do I stop that exe once the session is over!!?

If you initiated wordpad using run.prog then it must be running on the server. This is based on Baan documentation :). (I do not have the experience of having tried this with Baan on NT server). At this point starting the task manager using app_start may not be a good idea. This is because run.prog is executing away on the server and task manager is brougt up on the client screen. Nothing to kill here. Unless you are running BW on the Baan server.

Now lets talk about having started the application on the client. This would be similar to having started a windows based editor when editing program scripts. The Baan session can be put in a waiting mode until the editor program stops running. To acheive this use app_status() in a loop.app.id = app_start(...)
while app_status(app.id)
suspend(3000) |wait 3 seconds before checking the next time
endwhile
|go on with the session here
This solution makes the user quit the application before he can close the Baan application. Not automatic, but forces the user.

morpheus
8th August 2002, 14:10
Hello! Vamsi,
Thanks for the post.
The BW is running on the BaaN application server.

NPRao
8th August 2002, 20:49
Vamsi,

That was a good tip... it works...!!!

Thanks! :)

telgar
8th August 2002, 21:01
Yes the app_start command is the easiest I have found

morpheus
10th August 2002, 07:49
Hello,
I have a doubt here.
If we run a batch file in the DOS mode, which is calling some exe, then at the end we notice that the exe as well as the batch file terminates once the steps of the batch file are over.
Now, can't we achieve this from BaaN, if we activate that batch file from BaaN!!?:rolleyes:

aotaduy
28th January 2003, 21:04
I have tried

app_start() and is not present on BaaN IV documentation

How can i do it:(

Alfred Spiegler
29th January 2003, 14:11
Hello,

use following code:

#pragma used dll "ottdllbw"


start.client.program("excel.exe c:\test.xls", "C:\Programme\Microsoft Office\Office")

(Parameters: Application, Parameter for application,
path of application)

Regards, Alfred:cool:

aotaduy
29th January 2003, 18:42
Im in
Baan IV c4 sp4

and i cant use the functions you have listed:

start.client.application()
app_start()

i cannot see ottdllbw in the session ttadv2131m000 "Mantain Libraries"

Im missing something ?

Thank you

Alfred Spiegler
29th January 2003, 18:56
This code is for BaanIV c4. I used it in variouse programs. You cannot see the mentioned standard dll in tools session, but shurely the object code of this dll is in your application path.

Alfred Spiegler
29th January 2003, 19:31
sorry, but i forget a few lines to copy in my post...

declaration:
#pragma used dll "ottdllbw"

choice.cont.process:
on.choice:


start.client.program("excel.exe c:\test.xls",
"C:\Programme\Microsoft Office\Office")


functions:
function start.client.program(string command(200),
string ppath(200))
{ long retval, still_running

retval = app_start(strip$(command), strip$(ppath), "", "", "")
still_running = app_status(retval)

while still_running <> 0
still_running = app_status(retval)
suspend(300)
endwhile
}

aotaduy
30th January 2003, 18:16
Im answering myself

in BaaN IV c4 sp4

is

#prama used dll "ottdllbw"



app_start("notepad.exe", "c:\winnt\", "", "", "")

is about the same in earlier posts, but i guess thet others has errors, this is the one who works.
:D

P.D: Alfred i havent see your post with the complete code sorry