I want to create a GET Album button for update the Album Metadata.
The Album name I want to get from the Folder Names part.
The Demo Folder name is: Jurassic Park. Steven Spielberg. Advanture
Wanted Album name is : Jurassic Park
I have tried with this
@sync:dopusrt /acmd SetAttr {filepath} META album:{file|noext}
This code can update the album metadata with the file name.
I know This Regex can remove everything after first full stop
<from>([^.]+)</from>
<to>\1</to>
But I don't have the idea how to combine it with GET Album button
I am very new in scripting & tried get error & error & error
function OnClick(clickData) {
clickData.func.command.deselect = false;
for (var loc = new Enumerator(clickData.func.sourcetab.selected_files);!loc.atEnd();enumSelected.moveNext()) {
var loc = window.location.pathname;
var dir = loc.substring(0, loc.lastIndexOf('/'));
clickData.func.command.RunCommand('SetAttr "'+loc.item()+'" META "album'"');
It would be a great help if anyone write some code about it
What is the error? What have you tried? Have you made any attempt to understand or debug the problem in your code yourself? Have you looked at the commands your code is generating to see if they make sense? (I showed you how to do that recently in another thread, using DOpus.Output.)
function OnClick(clickData)
{
DOpus.ClearOutput();
var cmd = clickData.func.command;
var test = clickData.func.sourcetab.path
DOpus.Output(test);
}
This code Return full path of the current directory
like: D:\Project Secure\Backup v.3 [02-12-2019]
But I need only the name of current directory like Backup v.3 [02-12-2019] How can I get the current directory name in jscript?
Is there any way to use {sourcepath$|nopath|noterm} in jscript?
Thanks Leo for helping me. Now I can print out my current folder name in a test variable.
function OnClick(clickData)
{
DOpus.ClearOutput();
var cmd = clickData.func.command;
var test = clickData.func.sourcetab.path.filepart
DOpus.Output(test);
}
function OnClick(clickData) {
DOpus.ClearOutput();
var test = clickData.func.sourcetab.path.filepart
clickData.func.command.deselect = false;
for (var enumSelected = new Enumerator(clickData.func.sourcetab.selected_files);!enumSelected.atEnd();enumSelected.moveNext()) {
clickData.func.command.RunCommand('SetAttr "'+enumSelected.item()+'" META "album:'+test+'"');
}
}
This code can change album meta data with the current folder name. now I need to use regex for delete everything after the first dot . from the current folder name.
The Demo Folder name is: Jurassic Park. Steven Spielberg. Advanture
Wanted Album name is : Jurassic Park
This Regex can remove everything after first full stop in rename dialog box
I need to print after the last dot . string part from the current folder name.
The Demo Folder name is: Jurassic Park. Steven Spielberg. Adventure
Now I want to print : Adventure
so I have tried with substring(0, lastIndexOf(".")); Syntax. But That shows Error.
Error at line 4, position 2
Object doesn't support this property or method (0x800a01b6)
How can I print everything after the last . dot from the file name only so I want to Ignore the file extension.
my code is here:
function OnClick(clickData) {
DOpus.ClearOutput();
var test = clickData.func.sourcetab.path.filepart
var splitStr = test.substring(0, test.lastindexOf("."));
Dopus.output(splitStr);
//for (var enumSelected = new Enumerator(clickData.func.sourcetab.selected_files);!enumSelected.atEnd();enumSelected.moveNext()) {
//clickData.func.command.RunCommand('SetAttr "'+enumSelected.item()+'" META "album:'+splitStr+'"');
// }
}
But That shows Error.
Error at line 4, position 2
Object doesn't support this property or method (0x800a01b6)
(*For the language's own functions, methods, variables, etc. Case doesn't matter when calling ActiveScripting objects/methods like DOpus.Output which won't normally care, since for those it's the program that supplies the objects -- Opus in this example -- which interprets the name. But you need to be careful of case for anything built in to JScript.)
The is a big help for me thanks for that. But I want to print Adventure
As I see in your screen shoot It's print Jurassic Park. Steven Spielberg
The Demo Folder name is: Jurassic Park. Steven Spielberg. Adventure
But I want to print : Adventure
how to do that?