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
-
I found a way using the below, however it calls the "orignal" name with the file type... so the result is "original_jpg_low pass". This works for me... but would there be any other function than doc1.name that only yields the name without file type (jpg)?
Thanks a lot.Dim title1 As String [...] With Adjust.ImageCommands.Duplicate(correct_) title1 = doc1.name + " low pass" .Name = title1
0 -
2019-08-15-083714Diet --Below is a section of CODE from one of the APPS that I have written.I believe if you review this and combine the information within with the information you and YURI have provided, you will have the solution to your challenge.I hope this information is helpful.-- Matt-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'Find the extension on the image name
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 With0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions