Just in case you didn't know, Photoshop comes to you with "Adobe ExtendScript Toolkit" - a dedicated scripting application. However, you may use for this purpose any other text processor.
In case the script code was generated with the "ScriptListener" plug-in, every single step there appears as a paragraph, separated with a dashed line:
For example, the piece of code shown on the screenshot 1 applies the "Gaussian Blur" filter with radius equal to 2.5 pixels. If needed, you may replace this value with any other number or variable.
Please note also that the code provided by the "ScriptListener", executes without user interaction. If you want a certain step in your sequence to open a dialog, find the respective paragraph and replace "DialogModes.NO" with "DialogModes.ALL".
Nevertheless, to get most of your scripts you have to add the conditional logic. The code shown on the screenshot 2 turns the image 90° only if its width is greater than its height. Thus, this piece of code ensures that we are working with a portrait-oriented picture.
To solve such a task you need some knowledge of Photoshop scripting. The official (although not thorough), documentation on this subject is available at the Photoshop Developer Center.
Also, there are some informal PS scripting communities, and the PS-Scripts.com forum is, probably, the most competent and useful of those. On this resource, you can find both the answers to you questions and pieces of code generously shared by the skilled coders.