or is there something already in photoshop that I am missing

I can write an action that will put it in the right place in a horizontal picture and a separate to put it in a vertical but how do i tell photoshop to decide which picture should get the text layer where? also once it is written it can be put into SIE right?