Copy link to clipboard
Copied
Hi experts,
my script like this:
var file = new File("~/Desktop/Book contents and page number.txt");
for(var i = 0; i < app.selection.length; i++) {
if (app.selection.hasOwnProperty ( "baseline" )) {
myContents = app.selection.contents;
WriteToFile(file, myContents);
}
else if (app.selection.constructor.name == "Cell") {
myCellCeontents = app.selection.cells.everyItem().texts.everyItem().contents;
myCellCeontents += "\r";
WriteToFile(file, myCellCeontents);
}
else exit ();
}
function WriteToFile(file, text)
{
file.encoding = "UTF-8";
file.open("w");
file.write(text);
file.close();
file.execute();
}
for report my selection contents.
but
after run script
see screen movie:

my come out like this:
2014,HK$’000,,,,921, ,,34,321, ,,4,250, ,,662, ,,45,11,027, ,,, ,,555,5,087, ,,5,642,
it isn't my goal.
how can I make the result like this:
2014
HK$’000
921
34,321
4,250
662
45
11,027
555
5,087
5,642
thanks
regard
John
Hi John,
Change the else if code to the following
else if (app.selection[0].constructor.name == "Cell") {
myCellCeontents = app.selection[0].cells.everyItem().texts.everyItem().contents;
WriteToFile(file, myCellCeontents.join("\n"));
}
-Manan
Copy link to clipboard
Copied
Hi John,
Change the else if code to the following
else if (app.selection[0].constructor.name == "Cell") {
myCellCeontents = app.selection[0].cells.everyItem().texts.everyItem().contents;
WriteToFile(file, myCellCeontents.join("\n"));
}
-Manan
Copy link to clipboard
Copied
thank you Man,
thank so much.
John
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more