Scientists at Strathclyde University are developing new manufacturing techniques to allow medicines tailored to individual patients' needs to be produced in small quantities on demand.
They believe advances made by the university's CMAC (Continuous Manufacturing and Crystallisation) centre will revolutionise the way pharmaceuticals are made over the coming decade.
The technology could bring particular benefits to cancer patients, children, elderly people and those requiring palliative care - all groups with complex and often highly personal needs.
A switch to personalised pills would also save the NHS drugs budget millions of pounds per year, scientists say, by reducing the amount of medicine prescribed but never taken or thrown out after exceeding its use-by date.
Strathclyde University's work on personalised pills complements medical research, also led in Scotland, to help doctors prescribe drugs tailored precisely to their patients' needs.
The Glasgow University-led Stratified Medicine Scotland Innovation Centre, under construction at the new South Glasgow Hospitals Campus, will focus on examining the genetic makeup of patients and their differing responses to drugs. The research will help doctors create more personalised and effective forms of treatment for their patients.
Scientists at Strathclyde University spoke publicly for the first time about their hopes for the groundbreaking new technology yesterday, as the £50 million CMAC centre was officially opened by Business Secretary Vince Cable.
Professor Alastair Florence, the director of the centre, said it would allow pills to combine different drugs and deliver precisely tailored dosages for individual patients.
He said: "What we have been learning in recent years about how to treat patients more effectively has clear implications for pharmaceutical manufacturers ... that they need to make specific medicines tailored for specific patients.
"Traditional manufacturing infrastructure is really poorly set up to do that at present. The innovations we are developing at CMAC will enable a new way of manufacturing.
"Potentially medicines could be made in hospitals within a decade. This is about creating a factory in a fume cupboard."
Personalised pills would require major changes to licensing regimes, which are geared towards mass-produced generic medicines.
However, Strathclyde University scientists are due to meet European and US regulators later this year to discuss their work.
The research has been backed by major pharmaceutical firms GSK, Novartis and AstraZeneca, as well as Cancer Research UK.
Industry and charities have provided £22.8m of funding with a further £25m from the UK Government - including £11.4m from the Higher Education Funding Council for England. Scottish Government and European Union funding bodies have also backed the centre.
Scientists from Glasgow, Heriot-Watt, Edinburgh, Cambridge, Loughborough and Bath universities are also involved in the Strathclyde-led work.
Opening the centre, Mr Cable said: "As part of the UK, Scotland not only benefits from strong research investment but the rest of the country also benefits from the excellent innovation and entrepreneurial spirit we see in Scottish universities.
"Our continued investment in this area will strengthen our global position, creating new jobs and maintaining the UK as a world leader in medical research."
The Scottish Government has insisted a UK-wide science funding framework could be maintained under independence.