get the name of the open files
Hi,
I need to get the names of the opened images ( not only the active one) so I can use them as variable to activate the different opened images when needed.
Thank you
0
Best Answer
-
It looks like in your macro you activate different image (doc3), which is not the results of the operations in the macro nor the original image, that's why it's identified by name.
You should come up with a workflow where you either start from a single image or use all it's derivatives, or, if it's not possible, record a macro when you Load images from disk and do further processing. Then you can just make the Open command interactive (set .FileNames = Nothing) and the rest will be the same.
Yuri0
Answers
Here is the example:
If you just want to write a macro that does multi-image processing, which starts from a single image (e.g. you extract channel, create mask, apply filter, do arithmetic operation between these images,...) then you should just activate macro recording and do your steps, all operations and activations will be recorded properly (without names), so you can then run the macro on any other image.
Yuri
Thank you. I started by recording a macro. But in the code of the macro, it actually put the full name of one of the file:
Public Function Test() As SimpleScript Test = New SimpleScript Dim doc1, image1, doc2 Dim var1 = "jet1_25nmGFP170307_001_TIF", doc3, image2, doc4 With Application.DocumentCommands.Active(Test) .Run(doc1) End With With Adjust.ImageCommands.Convert(Test) .Destination = Image.ConvertTypes.Mono16 .ConvertOption = Image.ConvertOptions.Scale .Visible = True .Run(doc1, image1) End With With Application.DocumentCommands.Activate(Test) .Run(image1, doc2) End With With Application.DocumentCommands.Activate(Test) .Run(var1, doc3) End With With Adjust.ImageCommands.Convert(Test) .Destination = Image.ConvertTypes.Mono16 .ConvertOption = Image.ConvertOptions.Scale .Visible = True .Run(doc3, image2) End With With Application.DocumentCommands.Activate(Test) .Run(image2, doc4) End With End Function