how to paste text from clipboard to javascript dailogue box's text area automatically

here is script which save document as .psd. In this script i have to enter name manually. Please guide me what should I change so that clipboard text automatically get pasted in text area of dailoge box shown in screenshot. One of my friend told me to use
function pasteit(theField)
{document.execCommand('Paste');
}
but I dont know where i should put this
Second : in output folder If there is already a psd file with same name than can we save new psd with sequence number.
Here is script
//////////////////////
try{
//Code you want to execute
if (app.documents.length > 0) {
var myDoc = app.activeDocument;
var myDocName = myDoc.name;
var myFolder = new Folder('~/Desktop/output'); // change location to your own folder
if (!myFolder.exists) myFolder.create();
var myDialog = new Window('dialog', 'GIVE NAME FOR THIS PSD');
myDialog.size = {width:400, height:100};
var myEditText = myDialog.add('edittext');
myEditText.active = true;
myEditText.preferredSize = {width:200, height:20};
var myNewName = myEditText.text;
var myGroup = myDialog.add('group');
myGroup.orientation = 'row';
var myOkBtn = myGroup.add('button', undefined, 'Save', {name:'ok'});
var myCancelBtn = myGroup.add('button', undefined, 'Cancel', {name:'cancel'});
if (myDialog.show() == 1) {
var myNewName = myEditText.text;
if (myNewName != "") {
myNewName += '.psd';
var myNewFile = new File(myFolder.fsName + '/' + myNewName);
var id51 = charIDToTypeID( "save" );
var desc8 = new ActionDescriptor();
var id52 = charIDToTypeID( "As " );
var desc9 = new ActionDescriptor();
var id53 = stringIDToTypeID( "maximizeCompatibility" );
desc9.putBoolean( id53, true );
var id54 = charIDToTypeID( "Pht3" );
desc8.putObject( id52, id54, desc9 );
var id55 = charIDToTypeID( "In " );
desc8.putPath( id55, new File( myNewFile ) );
var id56 = charIDToTypeID( "LwCs" );
desc8.putBoolean( id56, true );
executeAction( id51, desc8, DialogModes.NO );
var myLastPsd = app.activeDocument.fullName.toSource();
try {
var myPrefsFolder = new Folder( Folder.userData.absoluteURI + '/TempScriptData' );
if (!myPrefsFolder.exists) myPrefsFolder.create();
var myTempFile = new File(myPrefsFolder.fsName + '/TempData.txt');
myTempFile.open("w");
myTempFile.write(myLastPsd);
myTempFile.close();
}
catch (err) {
alert("Failed to create a temp file. -- Error: " + err.message);
exit();
}
}
}
}
else {
alert("THERE IS NO PSD DOCUMENT OPEN.");
}
}catch(e){
//If Code didn't execute then goes here, and executes code within this block
}
////////////
Thanks & have a nice day
