• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Save the contents of the clipboard to a variable

Participant ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

Hello

 

I haven't found an easy solution here to work with the clipboard contents by placing it in a variable, to modify it. Using paste() it will be placed in the document. But first I want to format it and delete some of its parts.

 

Regards

TOPICS
Scripting

Views

173

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

Create TextFrame, paste clipboard, read contents - do what you need. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

(...and after all delete the TextFrame.)

Only this workaround is possible?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

It should be possible in official / latest version of JS - but InDesign's version is limited and outdated - and I'm not JS guy, sorry.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

No problem. Thanks for your answer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

You're welcome. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

Okay, I did that. But I realized this way I couldn't do what I wanted:

 

1. I copy some values ​​from a PDF in Acrobat

2. I select one or more cells in a table in InDesign

3. I paste the (edited) content of my clipboard into the table/cells

 

This would not work in the workflow if I let InDesign create a TextFrame first. Then my selection is lost.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

Rememmber your selection first.

 

Create a new, invisible document - work there - close - go back to your original document.

 

Selection in InDesign is per Document.

 

There is always more than one way to skin the proverbial cat 😉

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

What do you mean by “remember”? 😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

quote

What do you mean by “remember”? 😞


By @_AWID_

 

You can save selection to a variable:. 

var myCurSel = app.activeDocument.selection;

 "selection" is a collection like everything else - Stories, Tables, TextFrames, etc.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

it looks like a good option 🙂

I´ll try as soon as I can. Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

On some platforms, clipboard operations are available from the platform scripting system.

var text = app.doScript("the clipboard as text",ScriptLanguage.APPLESCRIPT_LANGUAGE);

On other platforms, search recommends to use the HTMLFile object.

https://stackoverflow.com/questions/19696308/how-can-i-use-clipboard-in-vbscript

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

Yes, on Windows, in VB6 it's built-in. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 22, 2025 Jan 22, 2025

Copy link to clipboard

Copied

I actually work on a Mac.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 23, 2025 Jan 23, 2025

Copy link to clipboard

Copied

LATEST

Here's how to get the clipboard contents.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines