On Wed, Jun 27, 2007 at 09:37:47AM +0100 or so it is rumoured hereabouts,
CP Hennessy thought:
> On Tuesday 26 June 2007 21:29:35 Conor Daly wrote:
> > I've recorded a little macro in Openoffice.org 2.04 but I want to finish
> > it with a call to festival. Is there an equivalent to the c 'system()'
> > function? All I want is something like:
> >
> > system("festival --tts /tmp/text")
>> It is possible using the interface :
>http://api.openoffice.org/docs/common/ref/com/sun/star/system/XSystemShellExecute.html> of the service :
>http://api.openoffice.org/docs/common/ref/com/sun/star/system/SystemShellExecute.html
> Obviously you will have to change the default security settings for this to
> work.
I'm a total newbie here. I know none of the syntax and the last time I
used MS VBA was about 8 years ago or more.
Is it simply a matter of running a system.execute() call? Or do I have to
declare some instance of an object first?
Code recorded by macro recorder pasted below...
The festival subroutine is what has been recorded in the new document, the
festival1 subroutine is what has been recorded in the original document.
The plan would be to merge these into one when I figure out how to call
creation of a new document and switching into it. The
'system.execute(...)' is my attempt at a system call which fails with 4
"BASIC syntax error. Unexpected symbol: .." messages.
All hints gratefully accepted...
Conor
############################################
REM ***** BASIC *****
Sub Main
End Sub
sub festival
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
rem ----------------------------------------------------------------------
dim args2(2) as new com.sun.star.beans.PropertyValue
args2(0).Name = "URL"
args2(0).Value = "file:///tmp/festival.txt"
args2(1).Name = "FilterName"
args2(1).Value = "Text"
args2(2).Name = "SelectionOnly"
args2(2).Value = true
dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args2())
system.execute("festival -tts /tmp/festival.txt")
end sub
sub festival1
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
end sub
############################################
--
Conor Daly <conor.daly at cod.homelinux.org>
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/G/S/O d+(-) s:+ a+ C++(+) UL++++ US++ P>++ L+++>++++ E--- W++ !N
PS+ PE Y+ PGP? tv(-) b+++(+) G e+++(*) h-- r+++ z++++
------END GEEK CODE BLOCK------
http://www.geekcode.com/http://www.ebb.org/ungeek/
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!