Hi Arnaud_N
I fear I am showing my stupidity, because I really am having trouble here.
All I want to do, as I said earlier, was copy a file to another location as a backup. Using the code from the Language Reference, as follows:
Var dlg As New SaveFileDialog
Var f As FolderItem
Var newFile as FolderItem
Var txtType As New FileType
txtType.Name = “Text File (*.txt)”
txtType.MacType = “TEXT”
txtType.Extensions = “txt”
Var htmlType As New FileType
htmlType.Name = “HTML File (*.htm, *.html)”
htmlType.MacType = "HTML "
htmlType.Extensions = “htm”
Var csvType As New FileType
csvType.Name = “CSV File (*.csv)”
csvType.MacType = “TEXT”
csvType.Extensions = “csv”
Var xlsType As New FileType
xlsType.Name = “Excel File (*.xls)”
xlsType.MacType = "XLS "
xlsType.Extensions = “xls”
'put in my .sqlite here
var sqliteType as New Filetype
sqliteType.Name = “SQLite File (*.sqlite)”
sqliteType.MacType = “SQLITE”
sqliteType.Extensions = “sqlite”
dlg.InitialFolder = SpecialFolder.Desktop
dlg.promptText = “Prompt Text”
dlg.SuggestedFileName = “Suggested Filename”
dlg.Title = “Title Property”
dlg.Filter = txtType + htmlType + csvType + xlsType + sqliteType
f = dlg.ShowModal
If f <> Nil Then
If Right(f.Name, 3) = “txt” Then
MsgBox(“1”)
ElseIf Right(f.Name, 3) = “htm” Then
MsgBox(“2”)
ElseIf Right(f.Name, 3) = “csv” Then
MsgBox(“3”)
ElseIf Right(f.Name, 3) = “xls” Then
MsgBox(“4”)
elseif Right(f.Name,6) = “sqlite” then
MessageBox (“5”)
//what goes here.
f.CopyTo newFile
End If
Else
// user canceled
End If
Under message box 5, I need to get the name in the suggested file name box, and I have tried everything I can think of… dlg.suggestedname, f.name, and so many other things I’ve lost track. I’ve looked in the Introduction to Xojo programming PDF I have, but I just can’t get it to work. What the honk allows me to give newFile a new name so it can be copied. I’m really stumped.
I’m sorry…
Oh… just to let you know I haven’t been sitting on my hands. This works… just too dang specific…
dim f, f2, fa as FolderItem
dim thedate as new date
dim thedatestring as string
thedatestring = str(thedate.SQLDate)
MsgBox thedatestring
f = GetFolderItem(“”).child(“workTime_.sqlite”)
fa = GetFolderItem(“”).child(“backup”)
f2 =GetFolderItem(“backup”).child(“workTime_”+thedatestring+“.sqlite”)
if fa.exists = false then
fa.CreateAsFolder
f.CopyFileTo f2
MsgBox “File backed up as : workTime_”+thedatestring+“.sqlite”
else
f.CopyFileTo f2
MsgBox “File backed up as : workTime_”+thedatestring+“.sqlite”
end if
Regards