# Script Functions

**URL:** <https://community.mp3tag.de/t/script-functions/1077>\
**Category:** Development\
**Created:** [June 11, 2004, 1:21pm UTC](https://community.mp3tag.de/t/script-functions/1077 "2004-06-11T13:21:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)\
**Post date:** [June 11, 2004, 1:21pm UTC](https://community.mp3tag.de/t/script-functions/1077/1 "2004-06-11T13:21:47Z")

</div>

Can you confirm that **$upper** and **$caps** don't work anymore in export?  
And what exactly is **$mul("x", y)** for?

---

<div class="post-metadata">

**Author:** ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)\
**Post date:** [June 11, 2004, 3:21pm UTC](https://community.mp3tag.de/t/script-functions/1077/2 "2004-06-11T15:21:27Z")

</div>

> [@](#):
>
> Can you confirm that **$upper** and **$caps** don't work anymore in export?

No, both functions are working fine here. Can you please post or mail your export configuration.

> [@](#):
>
> And what exactly is **$mul("x", y)** for?

Multiply "x" with "y". Some user wanted to mass-add the SONGLEN field (time in milliseconds), so I've added this function to add this field by using a formatstring like **$mul("%\_length%", 1000)** at Actions, Format value.

Best regards,  
~ Florian

---

<div class="post-metadata">

**Author:** ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)\
**Post date:** [June 11, 2004, 4:01pm UTC](https://community.mp3tag.de/t/script-functions/1077/3 "2004-06-11T16:01:13Z")

</div>

They all work in the Exportheader here, but not in the record or footer. No matter how simple the export line is.  
But

> [@](#):
>
> $upper("%\_extension%")

also makes it fail in the header.  
I mailed you a test config.

---

<div class="post-metadata">

**Author:** ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)\
**Post date:** [June 12, 2004, 5:37pm UTC](https://community.mp3tag.de/t/script-functions/1077/4 "2004-06-12T17:37:10Z")

</div>

This is an issue with the parser for the script functions I can't resolve. It took me the whole day to realize that, but I don't see a solution for that ☹

Background:

$upper("%\_extension%")  
This line will expand the _%\_folderpath%_ parameter to an absolute folderpath like _C:\Music\</i\> so it becomes  
 \<a href="file:///C:\Music **"** \>$upper("%\_extension%")  
Please note the bold part which will mask/escape the quote. This way, the parser assumes, that \>$upper( belongs into the quotes and won't detect the function name._

You can resolve this problem, by adding an additional space after the placeholder:  
$upper("%\_extension%")

Best regards,  
~ Florian

---

<div class="post-metadata">

**Author:** ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)\
**Post date:** [June 13, 2004, 8:42am UTC](https://community.mp3tag.de/t/script-functions/1077/5 "2004-06-13T08:42:30Z")

</div>

Ok thank you for researching this problem. 🙂

> [@](#):
>
> They all work in the Exportheader here, but not in the record or footer. No matter how simple the export line is.

Do the functions (with simple usage) work for you everywhere?

---

<div class="post-metadata">

**Author:** ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)\
**Post date:** [June 13, 2004, 8:53am UTC](https://community.mp3tag.de/t/script-functions/1077/6 "2004-06-13T08:53:10Z")

</div>

QUOTE (d4n0 @ Jun 13 2004, 11:42 AM)

> [@](#):
>
> They all work in the Exportheader here, but not in the record or footer. No matter how simple the export line is.

Do the functions (with simple usage) work for you everywhere?

  
Yes, they work flawless here after removing the obvious _\<td ..._ lines. Please send me your modified export configuration if you still encounter problems.

Best regards,  
~ Florian

---

<div class="post-metadata">

**Author:** ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)\
**Post date:** [June 13, 2004, 11:43am UTC](https://community.mp3tag.de/t/script-functions/1077/7 "2004-06-13T11:43:39Z")

</div>

Sorry I get it now, this line will screw all lines after it and not only its own line.  
It's ok now.

---

<div class="post-metadata">

**Author:** ![Etz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/etz/32/7648_2.png) [@Etz](https://community.mp3tag.de/u/Etz)\
**Post date:** [June 25, 2020, 10:35am UTC](https://community.mp3tag.de/t/script-functions/1077/8 "2020-06-25T10:35:43Z")

</div>

**$mul("%\_length%", 1000)** - it seems to always return 0 😀

---

<div class="post-metadata">

**Author:** ![Etz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/etz/32/7648_2.png) [@Etz](https://community.mp3tag.de/u/Etz)\
**Post date:** [June 25, 2020, 10:43am UTC](https://community.mp3tag.de/t/script-functions/1077/9 "2020-06-25T10:43:52Z")

</div>

Because...it really should be: **$mul(%\_length%, 1000)** 🤦‍♂️

But still looks odd, 5:59 is definitely not 5000 milliseconds...should be 359456  
By the looks of it, truncates everything after first : and simply uses only first number for calculation.

For example 2:19.31 became 2000 ms, which is definitely wrong (it is mixtape, over 2 hours long) ...

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [June 25, 2020, 1:51pm UTC](https://community.mp3tag.de/t/script-functions/1077/10 "2020-06-25T13:51:45Z")

</div>

> [@Etz](#):
>
> truncates everything after first : and simply uses only first number for calculation

The $mul() function multiplies numbers - so you have to supply a number and not a formatted value.  
Have a look at the help on more variables:

> **[Format Strings and Placeholders – Mp3tag Documentation](https://docs.mp3tag.de/format/)**
>
> Documentation on format strings and placeholders to describe the structure of file names and imported data. Mp3tag is the universal Tag Editor.

you probably get better results with `%_length_seconds%`

---

<div class="post-metadata">

**Author:** ![Etz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/etz/32/7648_2.png) [@Etz](https://community.mp3tag.de/u/Etz)\
**Post date:** [June 25, 2020, 2:07pm UTC](https://community.mp3tag.de/t/script-functions/1077/11 "2020-06-25T14:07:06Z")

</div>

Yes, I know...but I was referring to @Florian's answer...

It works fine with `%_length_seconds%`, catch is that `%_length_seconds%` is already rounded value and there seems to be no way to retrieve actual milliseconds at the moment.
