Script: {namePART only} for Report command.

Features wanted...
Post Reply
Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Script: {namePART only} for Report command.

Post by Stefan »

I am working on an BatchMaker-Script
and want to use the name-part of an file name only.

For the script first i use smtg like:
$filelist = getinfo('SelectedItemsPathNames', '|');
$file=gettoken($filelist, 1, "|");
$name = regexreplace($file, ...);
$exte = regexreplace($file, ...);


Then i think about to use the "report" command,
but {name} gives me the fullname incl. the extension.

An possible output of my script could be for example:
::text report("REN {fullname} {fullpath}\{name}_backup.{ext}<crlf>",1);

Question:

Is there an native report-token to give me the file name without the extension?
Or could this be added as e.g. {namepart}?

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script: {namePART only} for Report command.

Post by serendipity »

Stefan wrote:I am working on an BatchMaker-Script
and want to use the name-part of an file name only.

For the script first i use smtg like:
$filelist = getinfo('SelectedItemsPathNames', '|');
$file=gettoken($filelist, 1, "|");
$name = regexreplace($file, ...);
$exte = regexreplace($file, ...);


Then i think about to use the "report" command,
but {name} gives me the fullname incl. the extension.

An possible output of my script could be for example:
::text report("REN {fullname} {fullpath}\{name}_backup.{ext}<crlf>",1);

Question:

Is there an native report-token to give me the file name without the extension?
Or could this be added as e.g. {namepart}?
Variable <curbase> gives you the "file name without the extension".
More variables here:
http://88.191.26.34/XYwiki/index.php/Sc ... #Variables

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Script: {namePART only} for Report command.

Post by Stefan »

serendipity wrote:
Stefan wrote:I am working on an BatchMaker-Script
and want to use the name-part of an file name only.

For the script first i use smtg like:
$filelist = getinfo('SelectedItemsPathNames', '|');
$file=gettoken($filelist, 1, "|");
$name = regexreplace($file, ...);
$exte = regexreplace($file, ...);


Then i think about to use the "report" command,
but {name} gives me the fullname incl. the extension.

An possible output of my script could be for example:
::text report("REN {fullname} {fullpath}\{name}_backup.{ext}<crlf>",1);

Question:

Is there an native report-token to give me the file name without the extension?
Or could this be added as e.g. {namepart}?
Variable <curbase> gives you the "file name without the extension".
More variables here:
http://88.191.26.34/XYwiki/index.php/Sc ... #Variables
Thanks, but <curbase> give you only the "file name without the extension" for the currently focused file.
This will not work for an whole list of files.

I need an token for the report command.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script: {namePART only} for Report command.

Post by serendipity »

Stefan wrote:
serendipity wrote:
Stefan wrote:I am working on an BatchMaker-Script
and want to use the name-part of an file name only.

For the script first i use smtg like:
$filelist = getinfo('SelectedItemsPathNames', '|');
$file=gettoken($filelist, 1, "|");
$name = regexreplace($file, ...);
$exte = regexreplace($file, ...);


Then i think about to use the "report" command,
but {name} gives me the fullname incl. the extension.

An possible output of my script could be for example:
::text report("REN {fullname} {fullpath}\{name}_backup.{ext}<crlf>",1);

Question:

Is there an native report-token to give me the file name without the extension?
Or could this be added as e.g. {namepart}?
Variable <curbase> gives you the "file name without the extension".
More variables here:
http://88.191.26.34/XYwiki/index.php/Sc ... #Variables
Thanks, but <curbase> give you only the "file name without the extension" for the currently focused file.
This will not work for an whole list of files.

I need an token for the report command.
Oh I see, you can use command ID #113 (menu "File>To Clipboard>Item Base")

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Script: {namePART only} for Report command.

Post by Stefan »

Thanks :D

See,
i already have an collected list of files (with: $filelist = getinfo)
from which i already get the base name of each item (with: $basename = regexreplace(gettoken($filelist, ...)
This all works already pretty fine!

But i thought i could use REPORT-command for my script,
and there i miss the {basename}-token, from the report-command.

Just to make the script straight forward, without workarounds and novice-simple :lol:

Like:
::text report("REN {fullname} {fullpath}\{name}_backup.{ext}<crlf>",1);
but:
::text report("REN {fullname} {fullpath}\{namebase}_backup.{ext}<crlf>",1);

admin
Site Admin
Posts: 66347
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Script: {namePART only} for Report command.

Post by admin »

ok.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Script: {namePART only} for Report command.

Post by Stefan »

admin wrote:ok.
v8.70.0150 - 2009-12-15 12:46
+ SC Report(): Added special field {Basename}. Return the base (file
name without extension) of each file. Folder names are returned unchanged.
Works (i have tested this here: http://www.xyplorer.com/xyfc/viewtopic. ... 762#p40762)

Thank you.

Post Reply