Truncating names of selected files
-
- Posts: 111
- Joined: 30 Jan 2018 14:58
Truncating names of selected files
Would like to have a RegEx or a script (as needed) that would take a list of selected file(s) and truncate the name to X characters but leave the extension untouched. Have tried several Scripting Commands to do this which initially seemed so simple but they have all ended in spectacular failure.
Re: Request help with one task
And you aren't posting them, because...?Have tried several Scripting Commands
Code: Select all
$max = 8;
foreach($item, <get SelectedItemsPathNames |>, , "e") {
$base = gpc($item, "base");
if (strlen($base) > $max) { renameitem(gettoken($base, $max, "", , 1), $item, 1+4); }
}
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 111
- Joined: 30 Jan 2018 14:58
Re: Truncating names of selected files
To highend:
Nota bene - Primus: Thank you for taking the time to fabricate the code. Does precisely what was needed!
Nota bene - Secundus: "And you aren't posting them, because...?" Doing so would have only demonstrated my puerile level of scripting experience. We have not all been blessed with your level of technical acumen.
Nota bene - Primus: Thank you for taking the time to fabricate the code. Does precisely what was needed!
Nota bene - Secundus: "And you aren't posting them, because...?" Doing so would have only demonstrated my puerile level of scripting experience. We have not all been blessed with your level of technical acumen.
Re: Truncating names of selected files
What it would have demonstrated is what logic you've tried to use to solve the problem and scripting is 80% logic and only 20% coding (finding the right commands and reading their help file entries)Doing so would have only demonstrated my puerile level of scripting experience
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 111
- Joined: 30 Jan 2018 14:58
Re: Truncating names of selected files
Your observation closely parallels one made by Thomas Edison: Invention is 10% inspiration and 90% perspiration....and scripting is 80% logic and only 20% coding...
That said, you premise is well taken. Will keep that in mind before making the next (infrequent) post.
-
- Posts: 111
- Joined: 30 Jan 2018 14:58
Has there been a code change?
Autumnal greetings highend,
To be concise wonder if Don has made changes to XY since you authored the script. It no longer works. Instead get an Error Message stating, "Invalid Image File".
To be concise wonder if Don has made changes to XY since you authored the script. It no longer works. Instead get an Error Message stating, "Invalid Image File".