Split clipboard into two files

i need a button to split clipboard into two files
so i ead up with 2 txt files a.txt and b.txt
one for line 1 3 5 7 and so on
and one for 2 4 6 8 10 and so on

here is the clip board text

I Can't Escape from You (Love and Hate)
Act
Pieces of Modesty (Intro) / I Call for You
Modesty
Precious Little Diamond (Special Remix)
Fox the Fox
Don't You Go
Celebrate the Nun
Walk Away
The Game
A Decade of Thoughts
Elegant Machinery
So Many People (Census Mix)
Hubert Kah
Right on Target
Patrick Cowley
Rain in the Summertime
The Alarm
My Heart's Desire (Demo 1988)
The Beloved
Do I
Eddie Murphy
Don't Stop [Extended Mix]
The Mood
Hypnotic Tango (Instrumental)
My Mine
Reduced to Tears
In Parallel
Change in Mood
Kids in the Kitchen
Impulse of Love
Mike Hutend

thank you for your help

You could do that using scripting, which gives you access to the clipboard text and the ability to create files.

It seems quiet esoteric though! How did the two files get interwoven in the first place? e.g. If you're copying tabular data off a webpage and the browser is mixing two adjacent tables, there are probably better ways to get just one table or the other.

will the clipboard text is
track name
and artist name
or can be
artist name
track name

so i need two text files one for artist name and track name

a lot of the time music iam working with has no tags and file names like 1 2 3 and in no database i might find some info on some webpage and the tables are messup
the tagging tool i use need the info on each line
so i need ..... the two text files
strip line 1.3.5.7.9 to a.text and strip line 2.4.6.8 to b.txt and so on

Are you then using the text to rename some corresponding files? You could do everything in one go if that's the aim.

yse line 13579 and 246810 get written to tags of music file then the tag info gets used to rename files

Here's an example button script that will split the clipboard text into two arrays, for the odd and even lines.

What you do next depends on what you want to do with them exactly.

function OnClick(clickData)
{
	if (DOpus.GetClipFormat() != "text")
		return;

	var clipLines = String(DOpus.GetClip("text")).split("\n");
	var evenLines = [];
	var oddLines = [];

	for(var i = 0; i < clipLines.length; ++i)
	{
		if ((i%2) == 0)
			evenLines.push(clipLines[i]);
		else
			oddLines.push(clipLines[i]);
	}

	DOpus.Output("--- Even Lines: ---");	
	DOpus.Output(evenLines);
	DOpus.Output("\n\n--- Odd Lines: ---");	
	DOpus.Output(oddLines);
}

i would be happy with the two text files made in current folder for now

how do i go about doing this ?

no one ?

function OnClick(clickData)
{
	if (DOpus.GetClipFormat() != "text")
		return;

	var clipLines = String(DOpus.GetClip("text")).split("\r\n");
	var evenLines = [];
	var oddLines = [];

	for(var i = 0; i < clipLines.length; ++i)
	{
		if ((i%2) == 0)
			evenLines.push(clipLines[i]);
		else
			oddLines.push(clipLines[i]);
	}

	var fso = new ActiveXObject("Scripting.FileSystemObject");
	var path = DOpus.FSUtil.Resolve(clickData.func.sourcetab.path) + "\\";
	writeLines(fso, path, "Lines - Even.txt", evenLines);
	writeLines(fso, path, "Lines - odd.txt", oddLines);
}

function writeLines(fso, path, name, lines)
{
	var file = fso.CreateTextFile(path + name, true);

	for (var i = 0; i < lines.length; ++i)
	{
		file.WriteLine(lines[i]);
	}

	file.Close();
}

thank you works great ,,,, trying to learn Scripting so i don't need to keep asking for help .... hope i can get my head around it all 10000 more dopus videos would help :yum: