I have a WordPad document with all the names of the images saved.
Hello, I am trying to open a bunch of images from a text document with macro Scripting. Could really use some help
Apart from using elbow grease, if it is a one-off, you could do a smart find-and-replace creating the following in a text editor:
Change all begin of lines, except first line, with ,"
Change all end of lines with "
On first line, add myFiles = newArray("
On last line, add );
So you have the following general structure:
myFiles=newArray("firstfile.tif" ,"secondfile.tif" ,"lastfile.tif");
Now, with this array filled, you want to have a variable that holds the path to the files (if not already in your WordPad file), and add a for loop that opens each file as in open(path+myFiles[i]). (Don’t use File.open, as that will create a new file).
Alternative method would be to save your WordPad file as plain text (without any markup!) and File.openAsString(path) that file, processing the string line by line (using split to get individual lines) and opening the files accordingly. Best check for availability of said files in the loop. This part of the functions is your friend.
The File>Import>Stack From List command will open all the images listed in a text file as a stack. Each entry on the list must be a full file path, for example “C:/Users/wayne/stack/file001.tif”.