The rope or cord used to open or shut something is called a drawstring.