iuovchin
12th April 2016, 09:24
Hello. I have this situation where i run an app with app_start() command and while this app is running i need do lock the session untill the app will be closed.
I tried app_status() command, but problem is that i don't know how to disable entire session and how to return some value from the app that will indicate, that app is closed.

bhushanchanda
12th April 2016, 11:04
Hi,

You can use a while loop for app_status()

Here is an example -


Reference (http://www.baanboard.com/baanboard/showthread.php?t=9595&highlight=attrib)

app.id = app_start("winword " & target, "","","","")
while app_status(app.id)
suspend(3000)
|* wait 3 seconds before checking the next time
endwhile

Also, if on LN, you can use start.application.local() with waitFlag as true.

Ajesh
12th April 2016, 19:59
Well, you can write


string command_line
boolean appl.status
long exit_code

appl.set("0112233",APPL.EXCL)
appl.status = start.application.local(command_line,true,exit_code)
if appl.status then
while (exit_code <> exit_code_external_application)
suspend(x) | Any appropriate value like Bhushan suggested.
endwhile
appl.delete("0112233")



Puts the application lock on the current session and as long as the exit code of the external application is not matched the session will be suspended and after the exit code of the external application is matched , the lock of the current session will be released.