Hi,
I'm looking for a way in OOo basic to check when a file is last changed (modified).
I know there is a function like this in php, but I don't know if there is one in OOo basic...
I want to create a function like this in php, but then in OOo basic:
$file1=x:\test\test.doc;
$file2=c:\test.doc;
$file1modified = date("F d Y H:i:s.", filectime($file1);
$file2modified = date("F d Y H:i:s.", filectime($file2);
if ($file1modified > file2modified){
//copy it to c:\
}
But like I said, I don't know if there is a function for in OOo like the filectime-function in php...
The OOo version i'm using is 2.0.4.17 (No I'm not able to upgrade it, cause it's installed on my work and we can't install another version)
Thx 4 any help!
Greetz
Stievy
[Solved] last change time of file
[Solved] last change time of file
Last edited by stievy on Tue Jul 01, 2008 10:09 am, edited 2 times in total.
OOo 2.0.X on Ms Windows W2k + Novell Suse 10 (Linux)
Re: last change time of file
Check the DocumentInfo,
something like this:
something like this:
Code: Select all
If ThisComponent.hasURL() Then
With ThisComponent.DocumentInfo
If .ModifiedBy <> "" Then
msgbox "Document last changed " & .ModifyDate.Year & "-" & .ModifyDate.Month & "-" & .ModifyDate.Day
Else
msgbox "Document created " & .CreationDate.Year & "-" .CreationDate.Month & "-" & .CreationDate.Day
End If
End With
Else
msgbox "Document was not saved by now"
End If
Re: last change time of file
Thx
Ok this is what I made from it:
Greetz
Stievy
Ok this is what I made from it:
Code: Select all
Function checkVersion (localurl,serverurl)
Dim Dummy()
Dim localFileModifiedDate as String
Dim remoteFileModifiedDate as String
Dim localFileModifiedTime as String
Dim remoteFileModifiedTime as String
localdoc = StarDesktop.LoadComponentFromUrl(localurl,"MyFrame",0,Dummy)
With localdoc.DocumentInfo.ModifyDate
localFileModifiedDate = .Year & "-" & Format(.Month,"0#") & "-" & Format(.Day,"0#")
localFileModifiedTime = Format(.Hours,"0#") & ":" & Format(.Minutes,"0#") & ":" & Format(.Seconds,"0#")
End With
localdoc.close(true)
ServerDoc = StarDesktop.LoadComponentFromUrl(serverurl,"MyFrame",0,Dummy)
With ServerDoc.DocumentInfo.ModifyDate
remoteFileModifiedDate = .Year & "-" & Format(.Month,"0#") & "-" & Format(.Day,"0#")
remoteFileModifiedTime = Format(.Hours,"0#") & ":" & Format(.Minutes,"0#") & ":" & Format(.Seconds,"0#")
End With
ServerDoc.close(true)
If (localFileModifiedDate < remoteFileModifiedDate) Then
'copy it, file on server is newer
Else
If ((localFileModifiedDate = remoteFileModifiedDate) And (localFileModifiedTime < remoteFileModifiedTime)) Then
'copy it, changed the same day
Else
'do nothing, file up to date
Exit Function
End if
End If
End Function
Stievy
OOo 2.0.X on Ms Windows W2k + Novell Suse 10 (Linux)