$did(dialogname,id).text
Eg.
$did(Music,1).text returns the text in id 1 of the "Music" dialog.

Type "/help dialogs" and scroll down to the $did section.