GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Combining a script with a normal command?

Someone from the forums here helped me with a small script to make a date folder for the previous day. Now i would like to put a "select none" before the script, to save that step. How can we combine raw command and scripts?

Add the select none command to the script.

Something like:

DOpus.create.command.runcommand(“Select None”);

Thanks Steve. Well, i tried, but i'm not sure where. Just adding select none; at the beginning doesn't work. Here's the script

function OnClick(clickData)
{
	var d = DOpus.Create.Date();
	d.Sub(1,"d");
	var ds = d.Format("D#dd-MMM-yy");

	clickData.func.command.RunCommand("CreateFolder READAUTO=no NAME=\"" + ds + "\"");
}

Now i tried this, using your line, but i guess it is still misplaced or has to be changed to match the old script

function OnClick(clickData)
{
	var d = DOpus.Create.Date();
	d.Sub(1,"d");
	var ds = d.Format("D#dd-MMM-yy");
    DOpus.create.command.runcommand(“Select None”);
	clickData.func.command.RunCommand("CreateFolder READAUTO=no NAME=\"" + ds + "\"");
}

This works fine here. Correctly unselects all selected files before creating the folder. What do you expect it to do?

(I did have to change the quotes around "Select None" for it to work - typed the original on my phone and it inserted the wrong quote type).

Also, not sure why you need to unselect all files first?

1 Like

Ok, that works now, without the other " quotes from the first version, which were slanted.

I needed it, because when a folder was selected, which is the initial state when go into a folder, the script didn't work, using the hotkey. It only works if no folder is selected.

My use case is, when i edit my photo sessions, it is usually at night, next day. So instead using CreateFolder Name "{date|dd-MMM-yy}" READAUTO which i normally would, i need to make a folder for the previous day. But it works now, thank you Steve.

:beers: