Home Image-Pro Automation (Macros, Apps, Reports)
Options

Macro editing - help needed

I’m trying to analyse percentage staining of tissue for a drug trial. I’m blinded as to what groups each same has been assigned to, so it’s really important that I can keep track of the file names.

 

What I’m trying to do is (always) subtract the background light image from the active image before then applying filter ranges, counting and exporting to excel

 

I’m using the macro wizard but I’m having a problem. When it subtracts the background it creates a new image, and renames this filename_BGSubtracted, but then when I try to batch process using this macro it renames every new image file as filename_BGSubtracted (whatever the original image I used to record the macro). This means that when it exports the data to excel everything is named the same and I can’t keep track of my samples.

 What I need is its original filename with BGSubtracted added to it.

The relevant bit of my macro code is below – I’m guessing I need to change something in the line where is says name, but I don’t know how to phrase it (sorry – I’m a biologist not a coder!)

Any help or suggestions welcomed,

Thankyou, Ceri

 

    Public Function ceri_test() As SimpleScript

        ceri_test = New SimpleScript

        Dim doc1, image1, doc2

        Dim var1 = "background_subtract_tif", doc3, window1, window2

 

        With Application.RibbonCommands.SelectRibbonTab(ceri_test)

            .TabName = "Process"

            .Run()

        End With

 

        With Application.DocumentCommands.Active(ceri_test)

            .Run(doc1)

        End With

 

        With Adjust.ImageCommands.Duplicate(ceri_test)

            .Name = "Pre 020 CHN M Plac PLGF0004_BGSubtracted"

            .Visible = True

            .Run(doc1, image1)

        End With

 

        

        

 



 

Answers

  • Options
    Hi Ceri,

    Just remove the line 

     .Name = "Pre 020 CHN M Plac PLGF0004_BGSubtracted"

    from your macro, so the image will use the original name and not the fixed one.

    Yuri

  • Options
    Thankyou so much :)

Sign In or Register to comment.