0

I have a long code with various outputs. I am saving the customized results table in the directory where the image I am working on is: dir = getDirectory("image"); but I would like to save that .txt file also in a new directory, newdir, which is something like Q:\ME1-A-S-Lin\KJ\OrT\Imaging\TXTResults\ I do not what the Macro to make me select the folder, as would happen with getDirectory("Choose directory")

Can anyone help me?

LJR
  • 1
  • 2

1 Answers1

0

I'm not sure I understand the question. Do you want to prompt the user to choose an output directory?

Otherwise, you can simply declare your output variables as strings and use them with the "saveAs" function:

outputPath_1 = "myString1";
outputPath_2 = "myString2";

saveAs(Results_1, outputPath_1 + \\ + Results_1 + ".txt");
saveAs(Results_2, outputPath_2 + \\ + Results_2 + ".txt");

This is if the outputs are always in the same directories. You can of course relate them to some other directory if they are nearby. So, if your macro file was in:

Q:\ME1-A-S-Lin\KJ\OrT\Imaging\

And you wanted your results in:

Q:\ME1-A-S-Lin\KJ\OrT\Imaging\TXTResults\

Then:

thisFileDirectory = File.Directory;
outputPath = thisFileDirectory + "\\TXTResults";
saveAs(Results, outputPath + \\ + Results + ".txt");

Or something like that anyway