OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[SOLVED] How can I enumerate all open files?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Lucifer Sam
Newbie
Newbie


Joined: 16 Apr 2009
Posts: 4

PostPosted: Fri Apr 17, 2009 5:59 pm    Post subject: [SOLVED] How can I enumerate all open files? Reply with quote

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 Rolling Eyes

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 Evil or Very Mad


Last edited by Lucifer Sam on Sun Apr 19, 2009 2:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2697
Location: Apeldoorn, Netherland

PostPosted: Sat Apr 18, 2009 2:08 am    Post subject: Reply with quote

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
View user's profile Send private message
Lucifer Sam
Newbie
Newbie


Joined: 16 Apr 2009
Posts: 4

PostPosted: Sat Apr 18, 2009 4:01 am    Post subject: Reply with quote

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 Smile
Luc
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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