Zach Braff, Jason Bateman, and Amanda Peet are all stars of highly praised but little watched TV shows: “Scrubs,” “Arrested Development,” and “Studio 60 on the Sunset Strip,” respectively. They do their darnedest to make “The Ex” work, and in the process demonstrate that talented actors can turn a so-so script into something mildly worthwhile, but come on, they’re not miracle workers.

In this uneven, occasionally farcical comedy, Braff and Peet play a married couple, Tom and Sofia, who have a baby and move back to Sofia’s Ohio hometown so that Tom can take a job at his father-in-law’s advertising agency. Called Sunburst, it’s one of those touchy-feely modern offices where they say things like “shift the paradigm,” ride Segways, and toss around an invisible “Yes Ball” as a means of inspiring creativity. Sofia’s father, Bob (Charles Grodin), doesn’t run the place, but he’s high enough up the ladder that he could secure a spot for his son-in-law.

Bob hands Tom’s training duties over to Chip Sanders (Bateman), a smarmy, wheelchair-bound man who dated Sofia back in high school. He’s like the son Bob never had, while Tom is like the directionless, financially insolvent son-in-law Bob does have.

Tom is inclined to be jealous of Chip anyway, considering he once dated (and slept with) Tom’s wife, but Chip makes it worse by being a smug jerk. He sabotages Tom’s work and plays mind games with him, using his disability to his advantage and making Tom appear insensitive. He does it all subtlely, of course, so that he remains spotless in the eyes of his other co-workers.

Meanwhile, Sofia is bored at home with the baby and unhappy not to have found any new friends since moving back to Ohio. She lets a neighbor kid, Wesley (Lucian Maisel), come hang out, just so she’ll have someone to talk to.

Written by newcomers David Guion and Michael Handelman, the film is best when it avoids the physical comedy and sticks with the verbal. SNL’s Amy Poehler and Fred Armisen wring laughs out of average dialogue as two Sunburst employees, and Bateman and Braff have amply proven their agility with comedic delivery already. They’re both playing their TV characters, really: Bateman’s Chip is smarter than everyone else and can insult you without you knowing it, while Braff’s Tom is all goofy and soft-voiced, even when he’s trying to be angry. Peet, sadly, isn’t given much to do, but she does it with her typical smart-pretty-girl boldness.

The film is considerably less inspired when it dabbles in slapstick, which director Jesse Peretz invariably stages in a way that is too big and broad for what is supposed to be a subversive, character-driven comedy. It’s not enough for Tom to get fired from a restaurant job for insubordination; it has to be a huge food fight between him and his boss (Paul Rudd in a brief cameo). The childbirth scene can’t be wacky in the usual ways; it has to involve Tom tackling an anesthesiologist to secure Sofia’s much-needed epidural. Not that any of the film is “believable,” particularly, but it’s usually closer to reality than that.

And so it goes. It’s good to see Braff doing something other than the mopey emo thing in movies (“The Last Kiss” — ugh), and it’s good to see Bateman in movies at all. Their efforts elevate “The Ex” into something worth watching. Just imagine what they could do with a script that was really good to begin with.