Hi Stuart!
This seems to be a matter of missing slashes, eg. the first two in
file:// already belong to the scheme part of the URL and not to it´s path.
Something like the following worked for me:
Sub FindFile()
Dim oFileAccess As Object
Dim rVal as Boolean
Set oFileAccess = CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
rVal = oFileAccess.exists("file://///Olympus/stuart/test.sxc")
End Sub
I am wondering myself why it´s five slashes and not four as I would have
expected - maybe there´s still a bug in there or my understanding is
wrong - will have to ask around. Maybe the third slash is to start the
path and than the next two are to indicate that it´s a network path or
something like this, not sure! But well five slashes is what actually works.
Kind regards,
Bernd Eilers
Stuart Duckworth wrote:
Hello,
First a little introduction as I'm new here.
My name is Stuart. I use Open Office at home and Star Office at work.
I am not new to computers or programming but I am fairly new to
programming and macros in Open Office, and I am new to networking. My
learning curve is very shallow, it's a very complicated system, but I
am enjoying it.
At work I maintain a network of six computers running various
flavours of MS Windows, depending on their age, and one on which, for
reasons of security and cost, Centos Linux runs a Samba server to act
as a file server for the network.
I have been writing Star Basic macros to automate Star Calc file
creation and management.
I have discovered that while I can use UNO services to access files
on the individual computers accessing them on the server gives
variable results.
This is a routine that I wrote to confirm the existence of a file on
the server:
Sub FindFile()
Dim oSM As Object
Dim oFileAccess As Object
Dim rVal as Boolean
Set oSM = CreateObject("com.sun.star.ServiceManager")
Set oFileAccess = _
oSM.createInstance("com.sun.star.ucb.SimpleFileAccess")
rVal = oFileAccess.exists("file:///Olympus/stuart/test.sxc")
End Sub
When I run that routine rVal does not return True when the file
exists on the server(Olympus) but if I substitute
"file:///D:/stuart/test.sxc" where D is the local machine's hdd and
test.sxc does exist, then rVal returns True
I have had similar results using the Dir runtime function in Basic.
These results could suggest that Star Office is unable to access
files on Olympus but if I insert this line into a routine:
Set oDoc = oDesk.loadComponentFromURL _
("file:///Olympus/stuart/test.sxc", "_blank", 0, arg())
it finds and opens the file from the server.
So I have variable results of file access on the server and I need to
be able to test for the existence of files so that I can either load
them for editing or automatically create them.
I think I must be doing something wrong, but I don't know what it is.
Can anyone help, please?
Stuart
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]