Script command: Send text file content to clipboard

Send the contents of the specified file to the clipboard.
CopyContent c:\test.txt

Send the contents of the file with the extension txt in the specified folder to the clipboard.
CopyContent c:\temp PATTERN *.(txt|vbs) FILEINFO TRIM

Send file content to clipboard for all selected TXT files only.
CopyContent PATTERN *.TXT


Hi @qiuqiu that sounds very useful.
Should CopyContent {file} work?
Would you please provide install instructions for the command?

CopyContent {filepath} or CopyContent "{filepath}"

This command is still not recognized {file}

Thank you, but strangely I'm not getting the command to work.

Here's the Command, taken from the raw file on GitHub:

And here's the button (I've tried with or without the quotes):


Do you know what I'm doing wrong?

See the Script Add-Ins part of How to use buttons and scripts from this forum - #2 by Leo

Not the first time I install a script... Yesterday I tried the regular approach, copying CopyContent.vbs.txt to AppData\Roaming\GPSoftware\Directory Opus\Script AddIns, but the button calling CopyContent said "unknown function". Looking at Prefs / Toolbars / Scripts, under CopyContent it says Failed (init)

That's why since qiuqiu mentioned commands I tried the old approach of creating a user command directly in the Customize menu.

You can fix things by search & replace on this:

  • Find: Dopus.Strings.Get("desc") (2 occurrences)
  • Replace: "Send text file content to clipboard."


  • Find: Dopus.Strings.Get("group")
  • Replace: "File Command"

I'm not sure why Dopus.Strings.Get isn't working, but I can't get it to work either. The XML at the bottom has some unusual formatting and case in places, but it doesn't seem to be (just) that which is causing the problem. I'll take a look in more detail next week, as either something is wrong in Opus or the documentation (or I'm just confused myself).

Big thanks, Leo! :grin: :bowing_man:
Have a fun weekend.

Found the problem: Script resources don't work if the file is saved with Unix-style line endings. I'm guessing GitHub converts line endings to that format for some reason.

We'll make that work in the next update, but you can also fix it for now by copying the text and pasting it into a new file.

Fix for script resources with Unix-style line endings is in the beta released today: Directory Opus 12.24.1 (Beta)

Fantastic. Nice sleuthing, Leo. :grin:
That kind of things does pop up every once in a while… Line endings, BOM or no BOM… But not so often that I remember to think of it.
Wishing you a great week.

1 Like