How to launch an external program
How to launch an external program
Hello,
In VBA, I used the following code in order to launch an external program:
----
cmd = q & VBA.Environ("SystemRoot") & "\system32\cmd.exe" & q & " /c " & drive & " && cd " & q & procPath & q & " && launch.bat"
VBA.Shell cmd, vbHide
----
I could not find how to do the same with OOBasic.
Thanks for your help.
In VBA, I used the following code in order to launch an external program:
----
cmd = q & VBA.Environ("SystemRoot") & "\system32\cmd.exe" & q & " /c " & drive & " && cd " & q & procPath & q & " && launch.bat"
VBA.Shell cmd, vbHide
----
I could not find how to do the same with OOBasic.
Thanks for your help.
Re: how to launch an external program
From the excellent A. Pitonyak's e-book (section 5.33), I manage to launch any program:
Code: Select all
Dim oSvc as object
oSvc = createUnoService("com.sun.star.system.SystemShellExecute")
Rem Launch notepad
oSvc.execute(ConvertToUrl("C:\windows\notepad.exe"), "", 0)
LibreOffice 4.2.3.3. on Ubuntu 14.04
Re: how to launch an external program
question, and very interesting...
if we run for example the '7za' (7-zip cmd program) command-line program, can we also capture its exit ?
the end is the DB file integrity check.
Highly interesting in my opinion ....
if we run for example the '7za' (7-zip cmd program) command-line program, can we also capture its exit ?
the end is the DB file integrity check.
Highly interesting in my opinion ....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Re: how to launch an external program
Just a foggy idea:if we run for example the '7za' (7-zip cmd program) command-line program, can we also capture its exit ?
If you can parametrize the launching command of the software to launch, then you can control the place: where to unpack the file/s/.
And then you can load the extracted file from the known URL by the "LoadComponentFromURL()" API function (as a return value of the function) into an Object type variable.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: how to launch an external program
example of use of that ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Re: how to launch an external program
I do not know anything about the parameters of the launch command of the '7za' (7-zip cmd program) command-line program. I suppose that you need pass two parameters: the URL of the file to unpack, and the URL or path of the target file/directory.example of use of that ?
About the LoadComponentFromURL(): There are many examples in this forum. Search them.
viewtopic.php?f=20&t=57390
https://wiki.openoffice.org/wiki/Docume ... tarDesktop
http://ooo-forums.apache.org/en/forum/v ... 20&t=38778
...etc...
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
- Jurassic Pork
- Posts: 26
- Joined: Wed Oct 25, 2017 7:55 am
- Location: France
Re: how to launch an external program
hello,
with the extension EasyDev (see here) it's easy :
to compress some files and see the crc :
Friendly, J.P
with the extension EasyDev (see here) it's easy :
to compress some files and see the crc :
Code: Select all
REM ***** BASIC *****
Sub Tst_7za()
util = createUnoService("org.universolibre.EasyDev")
res = util.execute(Array("cmd.exe","/c","F:\7zip\7za.exe",_
"a","F:\temp\Files.7z","F:\temp\*.txt"), True)
util.msgbox(res)
res = util.execute(Array("cmd.exe","/c","F:\7zip\7za.exe",_
"h","F:\temp\Files.7z"), True)
util.msgbox(res)
End Sub
Friendly, J.P
OpenOffice 4.1.14 , LibreOffice 7.6.2.1 on Windows 11/ LibreOffice 7.3.7 on Lubuntu 22.04
Re: how to launch an external program
well, the end was just to check the own .odb document integrity... and yes you are using an extenion, exist no way to do it without another extension ?
Anyways, what's the purpose of EasyDev ?
Anyways, what's the purpose of EasyDev ?
Last edited by arfgh on Sat Nov 04, 2017 2:05 am, edited 1 time in total.
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
- Jurassic Pork
- Posts: 26
- Joined: Wed Oct 25, 2017 7:55 am
- Location: France
Re: how to launch an external program
certainly but it will be more complicated or use a python macro
OpenOffice 4.1.14 , LibreOffice 7.6.2.1 on Windows 11/ LibreOffice 7.3.7 on Lubuntu 22.04
Re: how to launch an external program
i see that you used the 'special msgbox' from EasyDev to show the results.
Exist that documentation in pdf ?
Exist that documentation in pdf ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version