In medicine, automatism refers to a set of brief unconscious behaviors. These typically last for several seconds to minutes or sometimes longer, a time during which the subject is unaware of his/her actions. This type of automatic behaviour often occurs in certain types of epilepsy, such as complex partial seizures in those with temporal lobe epilepsy, or as a side effect of certain medications, such as zolpidem.
There are varying degrees of automatism. Some may include simple gestures, such as finger rubbing, lip smacking, chewing, or swallowing, or more complex actions, such as sleepwalking behaviors. Others may include speech, which may or may not be coherent or sensible. The subject may or may not remain conscious otherwise throughout the episode. Those who remain conscious may be fully aware of their other actions at the time, but unaware of their automatism.
In some more complex automatisms, the subject enters into the behaviors of sleepwalking while fully awake up until the moment it starts. In these episodes, which can last for longer periods of time, the subject proceeds to engage in activities s/he routinely performs, such as cooking, showering, or driving along a familiar route, or may even carry on conversation. Following the episode, the subject regains consciousness, often feeling disoriented, and has no memory of the incident.
Treatment for automatism 
Automatism in progress cannot be stopped without advanced medical intervention, which may become necessary in rare instances when it lasts longer than 10 minutes with no sign of stopping. Witnesses should allow the subject to exhibit the automatic behavior and not restrain him/her unless failing to do so would be hazardous. Removing objects that person may use harmfully, such as knobs from a stove or car keys is recommended.
Automatism itself is medically harmless, and unlike other seizure types, the subject's actions are less likely to result in physical injury in the subject or others. While the subject is likely to have his/her eyes open at the time and is able to see the surrounding environment (unless blind), she/he may or may not be able to respond to verbal commands from others regarding his/her actions.
See also