Hi Andreas,

Your Star Basic macro looks very interesting. It is not super complex 
(initialization, a loop, and a super simple supporting function). Has anyone 
given it a test drive?

As I read the macro, the while loop looks suspect. Isn't it testing the length 
of a directory name [ dir("path/file.ext") ] instead of a file name? And, won't 
it operate on no more than one entity? I thought the idea was to automatically 
open zero or more office document files when soffice starts running.

It also could probably be made more robust by adding a supporting function that 
validates the file's extension. Just a thought.

-- 
Jim

-----Original Message-----
From: "Andreas Säger" <[email protected]>
To: [email protected]
Sent: Thu, 28 May 2015 15:35
Subject: [libreoffice-users] Re: open files automatically

-------->8========

Sub onApplicationStart()
   oSrv = createUnoService("com.sun.star.util.PathSettings")
   sPath = PathConcat(oSrv.Work, "AutoStart")
   sDir = PathConcat(sPath, "*.*")
   s = dir(sDir)
   while len(s)
      sPathName = PathConcat(sPath,s)
      StarDesktop.loadComponentFromURL(sPathName, "_blank", 0, Array())
      s = dir()
   wend
End Sub

Function PathConcat(s1, s2)
   if right(s1,1) <> "/" then s1 = s1 & "/"
   PathConcat = s1 & s2
End Function

-- 
To unsubscribe e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to