Basically you have two major options here:
1) Start with Czech Republic:
a) purchase in advance discounted Spar type ticket Wien-Praha online from Austrian railways (
https://ticket.oebb.at/bin/frame_ticket.pl?ticket=jticket.pl?ABBFSEL=8101865&ANBFSEL=5400201&LANG=EN - from 29 euro). And then take a side trip to C. Krumlov and back by bus or train.
b) use EURegio ticket (can be bought any type, stable fare) - such route explained here -
http://europetrainsguide.com/forum/index.php/topic,15.0.htmlFrom the new European timetable there is no more daytime train from Praha to Krakow, which probably means no more 19 euro discounted tickets (
https://eshop.cd.cz/international/search_cd-pkp.aspx). Regular tariff on the route is 36.8 euro, but you can save if you break your ticket via border - Praha-Bohumin Czech domestic ticket 445CZK (17 euro) + Bohumin-Krakow (15 euro).
If you stay in Krakow couple days you can "hunt" for same type - Spar discounted ticket Krakow-Budapest (25 euro), need to be purchased in advance and at the station. In case you are not able to purchase the one - get Krakow-Bratislava ticket (app. 45 euro)+ Bratislava-Budapest ticket purchase in Slovakia (12 euro one way)
Budapest-Wien starts from 13 euro (but again - such tickets need to be purchased at least three days in advance at the station) or 24 euro regular one way tariff.
2) Start with Hungary: Wien-Budapest (online and in advance from OEBB website - 19 euro).
Budapest-Krakow starts from 25 euro (at least three days in advance at the station) or regular tariff - app. 65 euro. Or as in previous paragraph - Budapest-Bratislava-Krakow with breaking your ticket via Slovakia.
Krakow-Praha - same as explained above, but vice versa. Then side trip to C.Krumlov +
Praha-Wien from 19 euro (some time in advance here -
https://eshop.cd.cz/international/search_cd-obb.aspx) or again via C.Budejovce.
In case both variants are too expensive for you, then we can propose even cheaper way to travel to all of the above places, but it will be rather complicated thing and require "tricky" ticket selection
And feel free to ask question (in case something isn't clear enough)