Set variable to contents of clipboard?

Is there a way to set a variable to the contents of the clipboard?

Yes, of course:

set myVariable to the clipboard

Or, even, copy (the clipboard) to myVariable

Hey guys, thanks for all the responses. I am feeling like a real idiot. I didn’t know you had to write “the clipboard” in the script and I was beating my head against the wall because nothing worked with just “clipboard”.

What does a computer language need definate articles for, anyway? It’s not like there is more than one clipboard!

My bad

Some applications have their own clipboard, or even multiple clipboards.

– Rob