Add Tab Space to text
Hi guys… I would like a Javascript to add tab space
to the selected text as shown on the image attached.
Could you please help me?
Many thanks in advance 🙂

Hi guys… I would like a Javascript to add tab space
to the selected text as shown on the image attached.
Could you please help me?
Many thanks in advance 🙂

Hi W_J_T,
not bad. Perhaps this additions are also helpful for Puthoskey :
// tabulator_replaceSpaceWithTabulator.jsx
// required: a selected text frame
// https://forums.adobe.com/thread/2076401
function addTabs() {
var doc = app.activeDocument;
var txt = doc.selection[0];
if (txt.typename == "TextFrame") {
// useful complement, based on code IMHO written by Jongware
tabInf = new Array(1);
tabInf[0] = new TabStopInfo;
// set here the tabulator position in pt/px
tabInf[0].position = 55;
curTxtString = txt.contents;
// curTxtString = curTxtString.replace('NAME:', 'NAME:\t').replace('ADDRESS:', 'ADDRESS:\t').replace('DATE:', 'DATE:\t').replace('PHONE:', 'PHONE:\t');
// !!! Do not forget to replace the spaces too !!!
curTxtString = curTxtString.replace('NAME: ', 'NAME:\t').replace('ADDRESS: ', 'ADDRESS:\t').replace('DATE: ', 'DATE:\t').replace('PHONE: ', 'PHONE:\t');
txt.contents = curTxtString;
for (i=0; i<txt.paragraphs.length; i++) {
txt.paragraphs.tabStops = tabInf;
}
}
}
addTabs();
Have fun
![]()
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.