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

Copy image to clipboard

New Here ,
Jan 18, 2025 Jan 18, 2025

Copy link to clipboard

Copied

I am trying to write a script that coping the current page as an image to the clipboard.

My approach is to export the current page as a PNG image, and copy it with `nircmd clipboard copyimage` shell command.

I tried using `app.doScript` to run `nircmd`, but without success.

 

Note: Although I succeeded to do it with a bridge to photoshop:

var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = "var f = File('" + tempFile.fsName + "');" +
    "app.open(f);" +
    "app.activeDocument.selection.selectAll();" +
    "app.activeDocument.selection.copy();" +
    "app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);" +
    "app.close(f);" +
    "f.remove();";
bt.send();

but it opens the photoshop program, and it's annoying.

TOPICS
How to , Scripting

Views

162

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 18, 2025 Jan 18, 2025

Copy link to clipboard

Copied

Why do you need to have it in the clipboard? 

 

What is your end goal? 

 

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
New Here ,
Jan 18, 2025 Jan 18, 2025

Copy link to clipboard

Copied

I want to paste the image outside of Indesign, like in WhatsApp, and send it to the customer. 

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 19, 2025 Jan 19, 2025

Copy link to clipboard

Copied

@yoav_4837

 

As @Dirk Becker suggested - doing it in the "native" scripting language - AppleScript on a Mac - VisualBasic on a PC - would be much easier.

 

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 18, 2025 Jan 18, 2025

Copy link to clipboard

Copied

Hi @yoav_4837 I have no experience with this specifically, but I wondered if it would work to re-import the image (particular formats might be better than others?) into Indesign and select/copy it via indesign (I mean copy the placed image, not the graphic frame, or try both). The question is, what exactly does it put on the clipboard and is it paste-able in other apps? Just wondering if you've tried it.

- Mark

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
New Here ,
Jan 18, 2025 Jan 18, 2025

Copy link to clipboard

Copied

Yes, I have tried.
When I copy an Image from Indesign, it's available (as an image) only in the clipboard of the program. Outside it behaves like an empty clipboard.

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 19, 2025 Jan 19, 2025

Copy link to clipboard

Copied

InDesign keeps an own clipboard "scrap".

Clipboard externalization is a costly process, similar to an export multiplied by the number of supported flavours.

Not sure what triggers externalization, as your switching to WhatsApp (deactivating InDesign) apparently did not.

Or did you forget to activate WhatsApp?

 

Alternatively, ask the search engine or AI of your choice for a program in the environment of your choice (VBScript? Powershell?) to load the exported png file into the Windows clipboard.

When I did, the vbscript would use the user32 dll with commands such as OpenClipboard, while the Powershell script would rely on ImageMagick. I did not test either, typing this on a Mac.

For comparison, the Mac clipboard is directly scriptable.

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
New Here ,
Jan 19, 2025 Jan 19, 2025

Copy link to clipboard

Copied

LATEST

I tried with claude.ai, and the code I received doesn't compile.

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