I wasn't a big fan of Trieste. I spent a night there. I'm glad I did, because I skipped it a few years ago and always wondered what it was like. Yes, it's an interesting town but still feels like a "big, noisy Italian city" in many ways (even though it has deeper Austrian roots than Italian). The huge main square is really cool. I did an easy hike on the Strada Vicentina (less about "hiking" which is not hard but more about the views). Otherwise, I didn't find it particularly charming or compelling as a place to spend time. I wouldn't regret never visiting again.
(You can find my pictures from last May by visiting my Portland Bridges website listed in my profile and searching for "trieste." It is pretty when all lit up at night.)
Ljubljana on the other hand is one of my favorite cities in Europe. It's pretty small for a city but has beautiful architecture and a lot of charm - a very walkable, vibrant town with big pedestrian areas. There's even a cute castle up on top of the hill overlooking the town. It's gotten more touristy since I first visited in 2009, but compared to say Venice or Dubrovnik it's not touristy at all.
The Rick Steves Croatia/Slovenia book probably gives you all you need to know about the area on a short visit. On my first real trip to Slovenia, I visited Ljubljana, then rented a car and drove to Lake Bled. On the way to Bled I detoured to the cute town of Skofja Loka (worth a few hours to stop), then drove the scenic detour up the mountain via Jamnik and Kropa - breathtaking scenery in places, a lovely drive. I explored Bled and nearby Lake Bohinj for a few days, then drove the Julian Alps Loop (described well in Rick's book) over the twisty road over the Vrsic Pass and down into the Soca Valley. I spent a night in the little town of Kobarid mostly for the World War I museum (which I assume would hold little interest to you) then returned the car in Piran, a lovely town on Slovenia's tiny coastline.
On a later trip, I explored Croatian Istria: Rovinj, Pula, and a few hill towns. I absolutely loved Rovinj - similar to Piran with its Venetian bell tower on the hill, but it's small. Rovinj is touristy and small. Pula is much bigger, more of a "working town" so less touristy but less charming. I wasn't really impressed with Pula. The arena is well preserved, but I'd seen the coliseum in Rome and the other ruins in Pula similarly didn't do much for me. The hill towns were more interesting - Gronjan was my favorite, Motovun is nice but more touristy. They take some time to get to though.
If I could have skipped Pula, I wouldn't have minded. The hill towns I liked better.
If you really have only a few days, personally I'd stick to Slovenia: Ljubljana, near Bled, and maybe Piran. If "a few days" means two or three, that's barely enough time to do justice to those places.