Script Reading Doors

We've all seen automatic doors in Real Life - a person walks into range of the sensor and the door opens. As long as there is someone in the sensor's area the door stays open. Not in the future. There the doors only close if the characters are staying in the room, and if they're going straight out again, then the door conveniently stays open for them. They can have a chat where each person is on the opposite side of an open door, but as soon as the conversation is over, the door will close, without either person moving.

Also, when a person walks past a door with no intention of using it, the door will not open.

So, how do the doors know when to open? They must have read from the script.

Films -- Live Action

 * Played with in Airplane! II: The Sequel where the doors on the space station can only be opened and closed if you 'shh' at it.

Literature

 * In Hitch Hikers Guide to The Galaxy, the automatic doors on the Heart Of Gold are characters in their own right. It is their pleasure to open for you and their satisfaction to close again with the knowledge of a job well done.
 * Zaphod even tried to instruct a door how to open stealthily so he can get the jump on his unwanted boarders in one chapter of the third book. The door does exactly as he asks, then completely blows it by asking him if that's what he wanted.

Live Action TV

 * Any amount of times on Star Trek. Oddly, the unaired Pilot "The Cage" has a door that opens when two characters walk into range, despite the fact that they were only running to get a view of the transporter.
 * Particularly obvious in one episode of Star Trek: The Next Generation, when Picard makes a speech, and then walks towards the door. Then he pauses, right at the door, before he turning back and giving a final comment to cap his speech. The door doesn't open until it's quite sure he's finished.
 * In a possible case of Reality Is Unrealistic, the TNG-era Star Trek production team once actually tried installing real automatic doors on the set rather than paying extras to pull back prop doors. It didn't work because--yes--the doors opening and closing at 'natural' times often spoilt dramatic moments in the script.
 * Another notable example: in "The Naked Time", Spock begins to feel the effects of a waterborne inhibition-removing chemical, and ducks into an empty briefing room. As soon as he's out of sight, he slumps back against the doors, which fortunately stay closed.
 * In Stargate Atlantis, one of the main characters has just had a heart-to-heart with his girlfriend, and as he walks away the door stay open just long enough for him to have a longing look back before closing -- despite the fact that he's only just outside the door (and therefore presumably still in the sensor's range). In another episode, the doors to the conference room close just in time to keep the last guy inside, and they don't open when he steps back, then forward again.
 * In every incarnation of the Stargate franchise, the eponymous device will stay on for as long as is needed before the characters go through, and will shut down the instant the last character that's leaving steps through (unless the script calls for it to stay open), without any indication or way for it to know who's going to go through or how long to stay open.
 * Similarly, the incoming visitors never step through the Stargate until the iris is open-- despite them having absolutely no way to tell how long it takes Hammond to make the decision to open the iris. (And sometimes it's a long time.) This can be handwaved by SG-1 members by saying their radio device has a feature that tells them when the iris is open, but it also happens with non-SG-1 members.
 * Sometimes, it is plot-relevant for the gate not to do that: Then it might shut down just when somebody is desperately running toward it, leaving them to thud to the ground on the far side of the inactive gate.
 * THE BLIND KUNG FU MASTA! was tripped up by the 'star trek doors' twice. First time it closed while he was still between the doors. The second time he was far enough away and the door closed... preventing anyone from hearing his speech (something about apples.)

Western Animation

 * Subverted in the first episode of Futurama, where they seem to be time based and when Fry spent too much time gawking at them, they closed on him, twice.

Real Life

 * Given the numerous breakthroughs made in human-robotics interfacing since the new millennium, most anticipatory door effects could be emulated (through rarely are) with contemporary smart-door technology.
 * Person-sensors (motion, infrared, whatever) could track the trajectory of a moving person and only open if he or she would intersect the doorway.
 * People interacting in a doorway face each other and express themselves, where people who are not interacting don't. A computer could easily interpret these behaviors.
 * Identified persons (via ID transponders or biometrics) may be allowed through a door or barred from entering an area. Similarly, the door control system may know exactly where a specific person is going, and only open doors too and from that location.
 * An idiosyncratic door system could be used to add an uncanny element (or sheer comedy) into a highly automated facility. Though this is rarely used or regarded in media.