Copy link to clipboard
Copied
Hi experts,
Is that possible to make script for InDeisgn copy as plain text.
thanks
John
Copy link to clipboard
Copied
Hi John,
What specifically do you mean by copy as plain text. The contents property of a story is a string that you can use as needed. Please provide more details if i misunderstood your problem
-Manan
Copy link to clipboard
Copied
Hi Man,
for example:
If I copy some text from InDesign files, and I want to paste to some where without formatting, I have to press ctrl + shift + v,
for I need a script for copy without formatting, something like copy from notes pad.
thanks
John
Copy link to clipboard
Copied
How about creating your new textframe in which you want to paste or use a preexisting object within which you want to paste the content. And then just inserting the stories content to it. For ex run the following code with a textframe whose content you need to copy. It will create a new textframe overlapping the original with content but no formatting
var sourceTf = app.selection[0]
var destination = app.activeDocument.textFrames.add()
destination.geometricBounds = sourceTf.geometricBounds
destination.contents = sourceTf.parentStory.contents
-Manan
Copy link to clipboard
Copied
Thank you Man,
thank you for your help.
but what I want just something like copy from indesign then paste to notes pad, then copy back.

is that possible?
thanks
regard
John
Copy link to clipboard
Copied
Should be possible, once the data is copied you could call up and paste text into notepad using AppleScript/VBScript. But i am not clear as what purpose does this solve, if you have to bring the content back into InDesign, why paste it in Notepad in between?
-Manan
Copy link to clipboard
Copied
Another idea:
Use an event-listener function attached to the "Paste" menuAction. Its first job is to examine the properties of the current selection (the place where the Paste is about to occur). If it's a column in a table, then the function calls preventDefault() to stop the Paste and instead uses Paste Without Formatting.
I've used an approach like that to prevent editors from overriding an applied paragraph style by pasting into it. I don't work with tables very much and would not be surprised if that isn't a little more complicated. I'd suspect, for example, that you might end up with all of the copied text in the first cell of a selected column. But the event-listener function could determine if there are multiple cells in the selection prior to pasting and, maybe figure out some way to distribute the clipboard contents appropriately.
I've always found it tricky to determine the contents of the clipboard before pasting. The best I've come up with is to create a temporary document, paste into it and use the normal Adobe scripting tools to figure out what's what.
Bob
Copy link to clipboard
Copied
Hi,
Not too sure what was wanted, but the script below may give you some ideas. It requires that the text frame holding a table be selected. The script (written in AppleScript) copies the table temporarily just long enough to convert the table to text and write the text to a plain text file with utf8 plain text encoding. The file is created on the user's desktop and named "testFile.txt". The text for this file is tab/return delimited and could be reimported into the original table or used to create another table wherever. Hope this helps.
tell application "Adobe InDesign CC 2019"
set selList to selection
set selItem to class of item 1 of selList
try
set tableRef to table 1 of item 1 of selList
on error
activate
display alert "Requires text frame with table to be selected"
return
end try
copy
paste
set tableRef to table 1 of item 1 of selection
set frameRef to parent of tableRef
tell tableRef to convert to text
set textStr to contents of contents of frameRef
set myTestFile to my writeToFile(textStr)
delete frameRef
end tell
on writeToFile(textStr)
set fileFolder to path to desktop from user domain as string
set filePath to fileFolder & "testFile.txt"
set fileRef to open for access file filePath with write permission
write textStr to fileRef as «class utf8»
close access fileRef
return fileRef
end writeToFile
Copy link to clipboard
Copied
Hi Man,
I just want to move the column text from one to other, but not always the next.
but each column has different format, design, color, type face, font size. ext.
so, I just want to change the contents, but not others.
thanks
regard
John
Copy link to clipboard
Copied
Hi Man,
Could you please show me how to make this script?
John
Copy link to clipboard
Copied
Thank you Robert,
John
Copy link to clipboard
Copied
Thank you Hopkins
thank you so much.
but all I have just the PC.
I can't try the applescript.
John
Copy link to clipboard
Copied
Hi Man,
is that possible to use vb script in setClipboard format.
something like this:
Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, features);
thanks
regard
John
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more