GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Create folder from clipboard text, but modify it first

I want to copy text from a browser and create a folder with text in clipboard can do that with
CreateFolder FROMCLIPBOARD

But if the text has . or _ or - between words how can I remove them before creating the folder

onedot3

You can do that using a script:

function OnClick(clickData)
{
	var cmd = clickData.func.command;
	cmd.deselect = false;

	if (DOpus.GetClipFormat() != "text")
		return;

	var strClip = DOpus.GetClip("text");
	strClip = strClip.replace(/[._-]/g," "); 

	var cmdLine = 'CreateFolder NAME="' + strClip + '"';
//	DOpus.Output(cmdLine);
	cmd.RunCommand(cmdLine);
}
1 Like

Thanks Leo
It works great

onedot3

Hello, in addition to the above.

Is there a way to create a list of folders based on a list?

I.e. I have a plain text file

folder1
folder2
folder3

Creates 3 folders on launching the script.

rgrds

You can paste a list of folders (one per line) directly into the Create Folder dialog, if that's all you need.

1 Like

Ok, always using ctrl+n on automatic, I didn't notice the tickbox. Excellent!

If you paste multiple lines into the single-line version, it automatically changes as well.

1 Like