# Suggestion: 'Splice' command for WS

**URL:** https://community.mp3tag.de/t/suggestion-splice-command-for-ws/61854
**Category:** Web Sources Discussion
**Created:** [August 18, 2023, 6:17pm UTC](https://community.mp3tag.de/t/suggestion-splice-command-for-ws/61854 "2023-08-18T18:17:31Z")
**Posts on this page:** 5
**Page:** 1

<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, 6:17pm UTC](https://community.mp3tag.de/t/suggestion-splice-command-for-ws/61854/1 "2023-08-18T18:17:31Z")

</div>

Hello everyone.

I'm developing a (new) iTunes script and I've hit a wall. I'll try to explain my problem:

I would like to be able to select/input cover size for an iTunes source script. So far I've been able to 'cheat' a value in the "CurrentUrl" output, as

Total output:  
output["CurrentUrl"]= [https://itunes.apple.com/lookup?media=music&entity=song&limit=200&country=jp&width=1200&id=505371XXX](https://itunes.apple.com/lookup?media=music&entity=song&limit=200&country=jp&width=1200&id=505371XXX) where **&width=1200** is the value I want.

This would be "easily" achieved if there was a way to 'splice' an output S into the current buffer, as in (example):

Script-Line : xx  
Command : splice  
Parameter 1 : Output "CurrentUrl" (or another)

Output : \>\<

Line and position:  
results  
.... ^

would return

Line and position:  
res**[itunes.apple.com/lookup?media=music&entity=song&limit=200&country=jp&width=1200&id=50537145](http://itunes.apple.com/lookup?media=music&entity=song&limit=200&country=jp&width=1200&id=50537145)**ults

or some command akin to `Replace` where the second parameter would be an output. Then with further processing I could get the "1200" value to the artwork url.

PS: I know about 'Adjust cover' that would achieve the same purpose for this example, but a 'Splice' command could have other uses regarding WS scripting.

Thank you.

---

<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: [November 24, 2023, 2:47pm UTC](https://community.mp3tag.de/t/suggestion-splice-command-for-ws/61854/2 "2023-11-24T14:47:42Z")

</div>

With version 3.22 and the addition of a configuration schema, the previous suggestion becomes (more) viable.

Instead of 'cheating' a value in `CurrentUrl`, I'm revising the suggested 'splice' command into a `SayVar "key"` command, with the idea of user inputs from the dedicated Settings menu item being called directly in the script.

Example:

Currently, adding an input box in the settings file, like

```auto
  "type": "number",
	  "key": "testNumber",
	  "title": "Enter cover size",
	  "description": "Enter a number",
	  "default": 42

```

and calling it in the script, using `IfVar`

```auto
IfVar "testNumber" "42"
	...
	replace "600x600bb" "42x42bb"
EndIf

```

is working. This example allows to define a cover size in the settings menu, and get the cover art in that size; but only if the input is "42".

For this example to work with any input number, it would imply coding `IfVar` clauses for every numeric value, which is impractical. Instead, with a dedicated command, the value would be called directly into the current buffer, like

```auto
...
replace "600x600bb" ""
SayVar "testNumber"
Say "x"
SayVar "testNumber"
Say "bb"
...

```

which would return the same results as before (42x42bb), but would also allow for any numeric/string value to be used.

Another example would be to get the current values on the settings schema in an output, like

```auto
OutputTo "CurrentSettings"
Say "testChoices:"
SayVar "testChoices"
Say "|"
Say "testEnter:"
SayVar "testEnter"
Say "|"
Say "testNumber:"
SayVar "testNumber"
Say "|"
Say "testCheck:"
SayVar "testCheck"
Say "|"
...

```

which would be useful, for example, in debugging.

This is merely a (revised) suggestion for consideration. Feedback would be appreciated.

---

<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: [November 24, 2023, 4:24pm UTC](https://community.mp3tag.de/t/suggestion-splice-command-for-ws/61854/3 "2023-11-24T16:24:05Z")

</div>

I also want something like `SayVar "variable"`. And in the `[IndexUrl]`/`[AlbumUrl]` and `[SearchBy]` the possibility to use `$var(variable)`.

---

<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: [November 25, 2023, 3:55pm UTC](https://community.mp3tag.de/t/suggestion-splice-command-for-ws/61854/4 "2023-11-25T15:55:58Z")

</div>

> [@AreDigg](#):
>
> And in the `[IndexUrl]`/`[AlbumUrl]` and `[SearchBy]` the possibility to use `$var(variable)`.

I would like to be able to do that too, but from my current understanding of the WS framework structure, I don't think that will be a possibility (for now / if ever). And since it's already possible to call settings' %variables% from a script with `IfVar` in `[ParserScriptIndex]` and `[ParserScriptAlbum]`, I'd like to believe that the groundwork for a possible `SayVar` is already laid out, and this suggestion isn't too far-fetched.

---

<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: [December 25, 2023, 11:20pm UTC](https://community.mp3tag.de/t/suggestion-splice-command-for-ws/61854/5 "2023-12-25T23:20:27Z")

</div>

I've had a breakthrough regarding this topic, and managed to call a number input from 'Settings' and import it into an %output% in an efficient manner. For anyone interested, please check

> [@An efficient method for assigning numeric inputs into %output%](https://community.mp3tag.de/t/an-efficient-method-for-assigning-numeric-inputs-into-output/63206):
>
> I had been working on a way to select/input cover size for an iTunes source script for quite some time; and with the new features of Mp3Tag v3.22+, I developed a method to do it (more or less). Since this method can work with any number, and I was unable to find any topic (other than my [own](https://community.mp3tag.de/t/suggestion-splice-command-for-ws/61854)) regarding this subject, I've created this topic to explain how I did it, so other authors can benefit from it. Until v3.22, there was only one field available for direct user input - [SearchBy]. With v3.22…
