# Copy music metadata to clipboard

**URL:** https://resource.dopus.com/t/copy-music-metadata-to-clipboard/36159
**Category:** Help & Support
**Tags:** commands
**Created:** [July 18, 2020, 7:21pm UTC](https://resource.dopus.com/t/copy-music-metadata-to-clipboard/36159 "2020-07-18T19:21:33Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![lxp](https://resource.dopus.com/user_avatar/resource.dopus.com/lxp/32/33734_2.png) [@lxp](https://resource.dopus.com/u/lxp)
#### Post date: [July 18, 2020, 9:32pm UTC](https://resource.dopus.com/t/copy-music-metadata-to-clipboard/36159/3 "2020-07-18T21:32:17Z")

</div>

This will copy `mp3songlength` of all selected files into the clipboard. Values will be in seconds.

```javascript
function OnClick(clickData) {
    var tab = clickData.func.sourcetab;

    var result = '';

    for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {
        var item = e.item();
        var tmp = item.metadata.audio.mp3songlength;
        if (typeof tmp == 'undefined') continue;
        result += tmp + '\n';
    }

    if (result == '') return;

    DOpus.SetClip(result);
}

```

[Song Length.dcf](https://resource.dopus.com/uploads/short-url/dwd4zk0xPZAYezZQ1WlRCV8I2tq.dcf) (1.2 KB)

* * *

> [@How to use buttons and scripts from this forum](https://resource.dopus.com/t/how-to-use-buttons-and-scripts-from-this-forum/3546):
>
> This post explains how to add buttons to toolbars and menus, and also applies to raw commands for things like standalone hotkeys. For how to use Script Add-Ins, please scroll down to the post below this one. See Also: The manual has more detail in…

---

_[View the full topic](https://resource.dopus.com/t/copy-music-metadata-to-clipboard/36159)._
