# V2.39c $puts/$get failure

**URL:** https://community.mp3tag.de/t/v2-39c-puts-get-failure/5695
**Category:** Export
**Created:** [November 5, 2007, 2:12am UTC](https://community.mp3tag.de/t/v2-39c-puts-get-failure/5695 "2007-11-05T02:12:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 5, 2007, 2:12am UTC](https://community.mp3tag.de/t/v2-39c-puts-get-failure/5695/1 "2007-11-05T02:12:04Z")

</div>

The $puts/$get pair in the following Export script fails to behave as specced:

```
$loop(%_path%)Path #%_counter% %_directory%\\%_filename%
$loopend()------
$loop(%_directory%)$puts(side,%_counter%)$loop(%_filename%)Dir #$get(side) File #%_counter% 
$loopend()$loopend()

```

It should generate e.g.

```
Path #1 a\x
Path #2 b\y
Path #3 b\z
------
Dir #1 File #1 
Dir #2 File #1 
Dir #2 File #2

```

but generates

```
Path #1 a\x
Path #2 b\y
Path #3 b\z
------
Dir # File #1 
Dir #1 File #1 
Dir #1 File #2

```

If anyone can suggest a workaround for this script. I'd be grateful. Thanks.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [November 5, 2007, 5:37am UTC](https://community.mp3tag.de/t/v2-39c-puts-get-failure/5695/2 "2007-11-05T05:37:21Z")

</div>

It seems to me that there is still a quirk in the export script language when using outside defined variables inside a loop() block.

Workaround for your case:  
Change "Dir #$get(side)" to "Dir #$add($get(side),1)"

DD.20071105.0736.CET

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 5, 2007, 8:46am UTC](https://community.mp3tag.de/t/v2-39c-puts-get-failure/5695/3 "2007-11-05T08:46:40Z")

</div>

> there is still a quirk in the export script language when using outside  
> defined variables inside a loop() block.

That's for sure!

> Workaround for your case:  
> Change "Dir #$get(side)" to "Dir #$add($get(side),1)"

Thanks. The general-case workaround I've found is illustrated by this:

```
$loop(%_path%)Path #%_counter% %_parent_directory%\\%_directory%\\%_filename%
$loopend()------
$loop(%_parent_directory%)$loop(%_directory%)$puts(side,%_counter%)$loop(%_filename%)GPdir %_parent_directory% Dir $add($get(side),1) File #%_counter% 
$loopend()$loopend()$loopend()

```

failing thus:

```
Path #1 1\a\x
Path #2 1\b\y
Path #3 1\c\z
Path #4 2\a\x
Path #5 2\b\y
Path #6 2\c\z
------
GPdir 1 Dir 1 File #1 
GPdir 1 Dir 2 File #1 
GPdir 1 Dir 3 File #1 
GPdir 2 Dir 4 File #1 
GPdir 2 Dir 2 File #1 
GPdir 2 Dir 3 File #1

```

Here's the worked-around version:

```
$loop(%_path%)Path #%_counter% %_parent_directory%\\%_directory%\\%_filename%
$loopend()------
$loop(%_parent_directory%)$puts(side,0)$loop(%_directory%)$puts(side,%_counter%)$loop(%_filename%)GPdir %_parent_directory% Dir $add($get(side),1) File #%_counter% 
$loopend()$loopend()$loopend()

```

succeeding thus:

```
Path #1 1\a\x
Path #2 1\b\y
Path #3 1\c\z
Path #4 2\a\x
Path #5 2\b\y
Path #6 2\c\z
------
GPdir 1 Dir 1 File #1 
GPdir 1 Dir 2 File #1 
GPdir 1 Dir 3 File #1 
GPdir 2 Dir 1 File #1 
GPdir 2 Dir 2 File #1 
GPdir 2 Dir 3 File #1

```

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 13, 2007, 11:23am UTC](https://community.mp3tag.de/t/v2-39c-puts-get-failure/5695/4 "2007-11-13T11:23:48Z")

</div>

WARNING: both workarounds will break the script when the bug is fixed.
