# Variables in Source Scripts

**URL:** https://community.mp3tag.de/t/variables-in-source-scripts/51644
**Category:** Web Sources Discussion
**Created:** [January 18, 2021, 6:44pm UTC](https://community.mp3tag.de/t/variables-in-source-scripts/51644 "2021-01-18T18:44:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![taggert](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@taggert](https://community.mp3tag.de/u/taggert)
#### Post date: [January 18, 2021, 6:44pm UTC](https://community.mp3tag.de/t/variables-in-source-scripts/51644/1 "2021-01-18T18:44:46Z")

</div>

Is there a way to set a variable in a source script so that when an include file is called the variable can either be evaluated (ie T/F) or written to a tag (ie itunes country searched = and language=)?

some psudeo code:

%country%="us"  
%language%="gb\_en"

...

call include file

output to "COUNTRY"  
If %country tag% does not exist  
say %country%  
End If

output to "SUPPORTED LANGS"  
append %language% to "SUPPORTED LANGS"  
Thanks

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [July 21, 2023, 9:25pm UTC](https://community.mp3tag.de/t/variables-in-source-scripts/51644/2 "2023-07-21T21:25:31Z")

</div>

It's got my vote +1

I wonder of it could do this also:

```auto
RegexReplace "\d±" %var%

```

---

<div class="post-metadata">

### Author: ![rboss](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@rboss](https://community.mp3tag.de/u/rboss)
#### Post date: [August 18, 2023, 5:53pm UTC](https://community.mp3tag.de/t/variables-in-source-scripts/51644/3 "2023-08-18T17:53:28Z")

</div>

Please check my iTunes script:

> [@\[WS\] iTunes source script with multiple search criteria](https://community.mp3tag.de/t/ws-itunes-source-script-with-multiple-search-criteria/47197):
>
> Greetings to the Mp3Tag community. After using @pone's WS iTunes script(s) for years, I've finally decided to take up scripting and give it a shot at creating a tool with the functions I wanted. And the main one was the ability for a script that could be used internationally, i.e. I could somehow define what country the script would query. This made sense to me, since if there was an artist from a certain country, or if an album had a localized special edition, I would want to get metadata …

You can set which country you want to get iTunes tags from, and has language options too.

---

<div class="post-metadata">

### Author: ![AreDigg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AreDigg](https://community.mp3tag.de/u/AreDigg)
#### Post date: [August 18, 2023, 6:40pm UTC](https://community.mp3tag.de/t/variables-in-source-scripts/51644/4 "2023-08-18T18:40:54Z")

</div>

This is an old thread that was resurrected, but what I do is to use Set.

```auto
Set "CountryTag" "us"
Set "LanguageTag" gb_en"

```

then later

```auto
OutputTo "COUNTRY"
IfOutput "CountryTag"
	SayOutput "CountryTag"
EndIf

OutputTo "SUPPORTED LANGS"
SayOutput "LanguageTag"

```

to avoid them written to the files or reset them to be false

```auto
Set "CountryTag"
Set "LanguageTag"

```
