this actually looks kind of promising.
i copied your code into a file i called metadata1.js, and recorded an action that does nothing but open a file and run the script.
i think it worked because the files all closed shortly after they opened. the script must have dine that because it wasn't part of the action.
anyway, i expected the script to create a file on my desktop called dementions.txt.
that didn't happen.
i then created the file myself and ran a batch with the action, hoping the file would have some data in it after the batch completed, but no.
so obviously i'm missing something.
sorry to be such a dolt.
also, can i get a variable for color space?