Read .rtf file in adobe photoshop using javascript

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: xbytor, DavideBarranca, Paul MR

Post Reply
yogeshwaran1991
Posts: 1
Joined: Tue May 08, 2018 2:11 pm

Read .rtf file in adobe photoshop using javascript

Post by yogeshwaran1991 » Tue May 08, 2018 2:25 pm

I have a script i want to read .rtf file format in my photoshop.
whats wrong in this code? Im using this in MAC . In mac we have only Rtf file format so help me out


var txt= File ('~/Desktop/test.rtf');

if (txt.exists == true) {
txt.open("r");
var contentStr = txt.read();
txt.close();
var str = contentStr.split ("\n");
}

var dlgMain = new Window('dialog', 'CURRENT UPDATES');
dlgMain.marginLeft = 15;
dlgMain.center();


dlgMain.alertBtnsPnl = dlgMain.add('panel',undefined, '');
dlgMain.alertBtnsPnl.alignment='left';
dlgMain.alertBtnsPnl.preferredSize = [200,200];

dlgMain.alertBtnsPnl.cmb= dlgMain.alertBtnsPnl.add("group");
dlgMain.alertBtnsPnl.cmb.orientation = 'column';
dlgMain.alertBtnsPnl.cmb.alignChildren = 'fill';
dlgMain.alertBtnsPnl.cmb.alignment = 'left';

dlgMain.alertBtnsPnl.alignChildren = "left";
dlgMain.alertBtnsPnl.mh= dlgMain.alertBtnsPnl.add("group");
dlgMain.alertBtnsPnl.mh.orientation = 'column';
dlgMain.alertBtnsPnl.mh.alignChildren = 'fill';
dlgMain.alertBtnsPnl.mh.alignment = 'left';

with (dlgMain.alertBtnsPnl) {
cmb.txt = cmb.add('statictext', undefined, 'xxxxx');
cmb.txt.preferredSize = [1,1];
mh.add('statictext', undefined, 'UPDATES: ');
//mh.add('statictext',undefined, '1. If received ins. "Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible".');
mh.add('statictext',undefined,str[6]);
//mh.add('statictext',undefined, ' Need to do Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible.');
mh.add('statictext',undefined,str[8]);
}
dlgMain.show();

Post Reply