Vienna to Salzburg - you have two options 1) OeBB trains which can be purchased in advance from oebb.at for 19 Euro or 2) Westbahn trains which you purchase on the train from the conductor.
Salzburg to Melk - again, there are a couple of options, but are you planning to spend the night? I truly suggest visiting this area as a day trip from Vienna. If you insist on doing it this way, then you again have two options - 1) take an OeBB train which will require one change and buy the ticket in advance from oebb.at to save money or 2) if you want to be more flexible but still economical, then take the Westbahn train to St.Pölten and then switch in St.Pölten to a regional train to Melk. The Westbahn ticket can be purchased aboard the train and the regional ticket can be purchased at the train station in St.Pölten as there are no savings on regional trains.
Melk to Bratislava - As with Melk, I really don't understand the itinerary as Bratislava is really a day trip from Vienna. Again, there are two ways - 1) buy the entire journey in advance online for specific trains at oebb.at, note you'll have to make at least two changes or 2) buy a regional ticket at the Melk train station to St.Pölten, then take the Westbahn train from St.Pölten to Vienna Hauptbahnhof. Once at Hauptbahnhof, buy another regional ticket to Bratislava.
Bratislava to Vienna - I suggest the bus, actually, for this route as the bus station is in the center of town and the train stations are not. You can buy the bus ticket online. If you insist on the train, then buy the regional ticket on your day of travel.
A pass makes absolutely no sense, unless you are talking about the Einfach-Raus ticket, which is a regional group ticket offered by OeBB.