change filename after editing image
Hi,
I struggle to find a way how to change a file name from "xyz" to "xyz_corrected".
I load image "original", then apply a 2d filter creating a new image.
The .name function allows me to define a string as the new file name, however I delete the original name.... while I actually would like to add the string "_corrected" to the end of the original file name.
I struggle to find a way how to change a file name from "xyz" to "xyz_corrected".
I load image "original", then apply a 2d filter creating a new image.
The .name function allows me to define a string as the new file name, however I delete the original name.... while I actually would like to add the string "_corrected" to the end of the original file name.
.Name = "low_pass"
0
Best Answer
-
Hi Diet,
You can use doc1.FileName property to get the full file name of the original file and the System.IO function to get the name without extension, like this:Sub PrintDocName Dim doc1 As IMcDocument=ThisApplication.ActiveDocument Dim oldName As String=System.IO.Path.GetFileNameWithoutExtension(doc1.FileName) Debug.Print(oldName) End Sub
Yuri0
Answers
Thanks a lot.
Dim MyIndex1 As Integer = _
InStrRev(Trim(textBox_FullExperimentLogFileName.text), ".")
'Build the full name for the txt file
Dim MyFullFileNameTifFile As String
'IF THE CURRENT WELL NAME IS NOT BLANK
If _
( _
Trim(textBox_CurrentWellName.text) <> "" _
) _
Then
'USE THE NAME OF THE CURRENT WELL IN THE NAME
MyFullFileNameTifFile = _
Left(Trim(textBox_FullExperimentLogFileName.text), MyIndex1 - 1) & _
" -- " & _
AlcesNow () & _
" -- " & _
"WELL_" & _
textBox_CurrentWellName.text & _
".tif"
Else
'USE 000 IN THE NAME
MyFullFileNameTifFile = _
Left(Trim(textBox_FullExperimentLogFileName.text), MyIndex1 - 1) & _
" -- " & _
AlcesNow () & _
" -- " & _
"WELL_" & _
"000" & _
".tif"
End If
'Save the active image in the appropriate TIF FILE
With Application.DocumentCommands.SaveAs(Nothing)
.FileName = _
MyFullFileNameTifFile
.Run(image2)
End With