Home Image-Pro Plus Automation with Macros

Naming User Defined Positions in Stage-Pro

Hi all,

I have an automated stage with a 4 slide holder and use Stage-Pro.  The software designates the User Defined Positions as 0-3 and then I have to save the run as "sample_" so the software saves the images as "sample_UDP0_XYF000 ZF00.tif".  The problem is I have 4 different samples being run at once so after I batch process-count/measure and save the data, I have to do a lot of transformations with the labeling to portray the correct sample number.  I was wondering if there was a macro or a way to label each User Defined Position when it is saving the images to save some time?  For example, can I ask it to save UDP0 as sample1, UDP1 as sample 2, UDP2 as sample 3, and UDP3 as sample 4?

Thanks!
Jena

Best Answers

  • Answer ✓
    Jena --

    I believe that I understand the challenge.

    Your current use of IMAGE-PRO PLUS and STAGE-PRO generates files named like


    You would like to be able to configure IMAGE-PRO PLUS and STAGE-PRO to generate files named like


    I do not know if that is possible but I can point you to what may be a reasonable solution.

    If you can open a COMMAND WINDOW and select the appropriate SUBDIRECTORY / FOLDER, then you can issue commands like the following

        rename sample_udp0*.* SampleA____*.*

    to change all of the FILE NAMES that start with

        sample_udp0

    to start with

        SampleA____

    This is shown below. 

    PLEASE NOTE!

    It seems that the FROM and TO have to need to be the SAME LENGTH in the RENAME COMMAND or you end up with a CHARACTERS from the FROM if the TO is too short or over-writing CHARACTERS in the *.* part of the FROM if the TO is too long.

    In the TO is shorter than the FROM case a

        rename sample_udp1*.* SampleA*.*

    yields

        SampleAUDP1_XYF000 ZF000.tif
        SampleAUDP1_XYF001 ZF000.tif

    In the TO is longer than the FROM case a

        rename sample_udp1*.* SampleA1234567890*.*

    yields

        SampleA12345678900 ZF000.tif
        SampleA12345678901 ZF000.tif


    You can also use a RENAMING UTILITIES like those reviewed at

        https://www.maketecheasier.com/bulk-rename-utilities-windows/

    I do not have any experience with these UTILITIES but I believe a customer uses the first one named

        Bulk Rename Utility

    A little IMAGE-PRO PLUS MACRO could also be written to perform this RENAMING OPERATION.

    I hope this information is useful.

    -- Matt

    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-


  • Answer ✓
    When researching codes to run on the Command Center, I was able to find a better program on my computer - PowerShell.  It was able to do what I was looking for! Thanks!

Answers

  • Thank you Matt for the information.  I will try that.  Previously after batch processing, I was trying to rename them in Excel but my files were so large (over 1 million rows in Excel) that Excel would stop working or glitch when running the macro.  This may be a fix to do it before batch processing since it'll be a little less data to deal with.  I will see how this works.
  • 2017-03-14-113241

    Jena --

    I am glad to help.

    If this was something that I was doing repeatedly, I would attempt to build a .BAT BATCH FILE that would prompt me for the

        TO STRING

    and then build and execute the COMMAND.

    I have not tested this but something like the CODE shown below would probably work.

    I think you would have to run the BATCH FILE from within the folder that contains the TIF FILES for this to work.

    I hope this information is helpful.

    -- Matt

    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

    @echo off

    echo "Enter SAMPLE NAME for 'sample_udp0'..."
    set /p MyToString0=

    echo "Enter SAMPLE NAME for 'sample_udp1'..."
    set /p MyToString1=

    echo "Renaming sample_udp0 files!"
    rename sample_udp0*.* %MyToString0%*.*

    echo "Renaming sample_udp1 files!"
    rename sample_udp1*.* %MyToString1%*.*

Sign In or Register to comment.