| View previous topic :: View next topic |
| Author |
Message |
Lucifer Sam Newbie


Joined: 16 Apr 2009 Posts: 4
|
Posted: Fri Apr 17, 2009 5:59 pm Post subject: [SOLVED] How can I enumerate all open files? |
|
|
Hi all,
I'm trying to learn OOo Basic programming - I'm an experienced programmer, and am fairly happy with OOo Basic itself, but the API is a completely different matter altogether. It's a little daunting to say the least
I'd like to (eventually) write a global find and replace function that works across all open files, but first I need to be able to enumerate all the open files (or maybe just all open writer files?).
From what I've read this should be possible, but I haven't found a way of doing it!
Can anyone help me with an overview of what's involved?
Any pointers, help or hints would be very gratefully received
Cheers
Luc 
Last edited by Lucifer Sam on Sun Apr 19, 2009 2:12 pm; edited 1 time in total |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Sat Apr 18, 2009 2:08 am Post subject: |
|
|
Hello
You ask for all open files. I think that is not possible with macro inside OOo. You have to go back to OS. But reading your post you mean maybe: all files who are on the OOo Desktop. That is possible within OOo with macros.
I hope this helps you
Romke
| Code: | Sub Documents_Iteration
Dim oDesktop As Object, oDocs As Object
Dim oDoc As Object, oComponents As Object
oComponents = StarDesktop.getComponents 'Haalt een object op
oDocs = oComponents.createEnumeration 'Het opgehaalde object laat het maken van een enumeratie toe
'Ga werken met de enumeratie
Do While oDocs.hasMoreElements
oDoc = oDocs.nextElement
select case oDoc.implementationname
case "SwXTextDocument"
if instr( oDoc.title,"input" ) <> 0 then
gotorecord(oDoc,"Inputveld",403)
oDoc.CurrentController.Frame.ContainerWindow.toFront
end
end if
case else
msgbox oDoc.title & " " & oDoc.implementationname
end select
' oDoc.CurrentController.Frame.ContainerWindow.toFront()
'oDoc.CurrentController.Frame.Activate()
loop
End Sub
|
|
|
| Back to top |
|
 |
Lucifer Sam Newbie


Joined: 16 Apr 2009 Posts: 4
|
Posted: Sat Apr 18, 2009 4:01 am Post subject: |
|
|
| RPG wrote: | Hello
You ask for all open files. I think that is not possible with macro inside OOo. You have to go back to OS. But reading your post you mean maybe: all files who are on the OOo Desktop. That is possible within OOo with macros.
|
Yes - that is exactly what I meant - thanks very much, now I hope to be able to implement a "global" search & replace across all files (that Ooo has open!).
Thanks very much Romke
Luc |
|
| Back to top |
|
 |
|