| View previous topic :: View next topic |
| Author |
Message |
Lazar Botescu Newbie

Joined: 19 May 2012 Posts: 2
|
Posted: Sat May 19, 2012 10:48 am Post subject: [SOLVED][Basic]Open and close an extern applic by the MACROS |
|
|
Hello,
I use an external application (server type) for reading some data by DDE in a BASIC macro.
I need from time to time to close and re-open the server application.
No problem to open the application by SHELL command, but realy I didn't arrive to close it by the macro,. The macro needs to work without an operator survey.
It is a litle data logger from a PLC to a PC. Who needs help to relise such an application I'm redy to help him.
Thank you in advance![/quote] _________________ AOO3.4 User
Last edited by Lazar Botescu on Fri Jun 08, 2012 6:02 pm; edited 1 time in total |
|
| Back to top |
|
 |
Lazar Botescu Newbie

Joined: 19 May 2012 Posts: 2
|
Posted: Fri Jun 08, 2012 5:56 pm Post subject: |
|
|
Hello again,
I found a solution! But if you have another ideea please to let me know.
My solution for closing the external application is to use a batch.bat file (named "stop.bat" in my exemple) with only one line:
taskkill /f /im applext.exe
where applext is my external application.
then, when I want to close application I'm calling:
xShell = createUnoService("com.sun.star.system.SystemShellExecute")
xShell.execute("C:\path\stop.bat", "", 0, true)
For open the application I used two solution. One is :
xShell = createUnoService("com.sun.star.system.SystemShellExecute")
xShell.execute("C:\path\applic1.fcs", "", 0, true)
The second is:
Shell "C:\path\applext.exe"
As you can see, SHELL acts only on the .exe application, but xShell can acts direct on the file .fcs (in my case) created with the .exe application.
Now my little data logger can work alone and close and re-open the server application eatch time it detect that the comminication PLC to PC seems not to be good.
Maybe that can help you to close and re-open an external application. For me is working perfect.
Lazar _________________ AOO3.4 User |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|