We proposed a model for all-optical switching in a medium consisting of four-level vee-cascade atomic systems excited by coupling, probe, and signal fields. It is shown that, by changing the intensity or the frequency of the signal field, the medium can be actively switched between either electromagnetically induced transparency (EIT) or electromagnetically induced absorption (EIA), which has behavior of all-optical switching. As a result, a cw probe field is switched into square pulses by modulating the intensity or the frequency of the signal light. Furthermore, width of the square probe pulses can be controlled by tuning the switching period of the signal field. Such a tuneable all-optical switching is useful for finding related applications in optic communications and optical storage devices.