repeating the last action on selected files.
-
kotlmg
- Posts: 321
- Joined: 30 Jun 2010 17:14
repeating the last action on selected files.
let us say i have one text file by name
introduction to railway signalling and telecommunications.txt. now using f2, i will delete telecommunications, and the file will become introduction to railway signalling and.txt. i want to apply the same previous action of deleting those many characters in all selected files retaining their extensions.
or
like in msword, we can vertically highlight text by pressing alt and drawing the area to select the content. i want to rename selected files by drawing the area to my liking and keeping the extensions as it is.
is this possible with script? can anyone help me.
introduction to railway signalling and telecommunications.txt. now using f2, i will delete telecommunications, and the file will become introduction to railway signalling and.txt. i want to apply the same previous action of deleting those many characters in all selected files retaining their extensions.
or
like in msword, we can vertically highlight text by pressing alt and drawing the area to select the content. i want to rename selected files by drawing the area to my liking and keeping the extensions as it is.
is this possible with script? can anyone help me.
-
highend
- Posts: 14942
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: repeating the last action on selected files.
With a script? Sure.
Read all filenames and store them in a variable. Open a window (with input()) and enter the word that should be replaced. Count the characters in the returned string and delete these chars from every filename (with substr()) within a foreach loop.
Read all filenames and store them in a variable. Open a window (with input()) and enter the word that should be replaced. Count the characters in the returned string and delete these chars from every filename (with substr()) within a foreach loop.
One of my scripts helped you out? Please donate via Paypal
-
kotlmg
- Posts: 321
- Joined: 30 Jun 2010 17:14
Re: repeating the last action on selected files.
sir, can you please give the code.
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: repeating the last action on selected files.
Easiest way?kotlmg wrote:Let us say i have one text file by name
"introduction to railway signalling and telecommunications.txt"
now using F2, i will delete " telecommunications", and the file will become
"introduction to railway signalling and.txt"
i want to apply the same previous action of deleting those many characters in all selected files retaining their extensions.
or
like in msword, we can vertically highlight text by pressing alt and drawing the area to select the content.
I want to rename selected files by drawing the area to my liking and keeping the extensions as it is.
Is this possible with script? Can anyone help me please.
* select files
* File / Rename Special / Edit Item Names... #147
* copy to W0rd or Notepad2 or such editor
* modify and copy back
* OKing "Edit Item Names..", you will even get an preview.
-
Marco
- Posts: 2354
- Joined: 27 Jun 2011 15:20
Re: repeating the last action on selected files.
1. Select
2. Right click | Rename special | Search and Replace...
3. Type telecommunications/ (beware of trailing spaces)
2. Right click | Rename special | Search and Replace...
3. Type telecommunications/ (beware of trailing spaces)
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]
Don sees all [cit. from viewtopic.php?p=124094#p124094]
-
highend
- Posts: 14942
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: repeating the last action on selected files.
@Stefan & Marco:
Both solutions wouldn't work.
The length of his file names will differ and are (most probably) not right aligned if copied to a text editor so an alt + cursor to mark a block will fail if he wants to delete chars from the end of the line.
@Marco:
He said "those many characters" so it seems not all files in the selection contain the same word.
Both solutions wouldn't work.
The length of his file names will differ and are (most probably) not right aligned if copied to a text editor so an alt + cursor to mark a block will fail if he wants to delete chars from the end of the line.
@Marco:
He said "those many characters" so it seems not all files in the selection contain the same word.
One of my scripts helped you out? Please donate via Paypal
-
Marco
- Posts: 2354
- Joined: 27 Jun 2011 15:20
Re: repeating the last action on selected files.
With my method every "telecommunications" occurrence is removed, regardless of its position in the filename.highend wrote:@Stefan & Marco:
Both solutions wouldn't work.
The length of his file names will differ and are (most probably) not right aligned if copied to a text editor so an alt + cursor to mark a block will fail if he wants to delete chars from the end of the line.
@Marco:
He said "those many characters" so it seems not all files in the selection contain the same word.
And the title suggest he wants to apply one action (removing the word "telecommunications") from several files.
My method makes sense to me and would work (tested).
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]
Don sees all [cit. from viewtopic.php?p=124094#p124094]
-
kotlmg
- Posts: 321
- Joined: 30 Jun 2010 17:14
Re: repeating the last action on selected files.
Marco, all the files will not have telecommunications word. i want to delete 17 characters (telecommunications) in all the files from the areal selection i made.
-
kotlmg
- Posts: 321
- Joined: 30 Jun 2010 17:14
Re: repeating the last action on selected files.
stefan sir,Easiest way?
* select files
* File / Rename Special / Edit Item Names... #147
* copy to W0rd or Notepad2 or such editor
* modify and copy back
* OKing "Edit Item Names..", you will even get an preview.
your suggestion has worked for me. using msword i could select text in a block and delete them. i have copied back the same to edit item names window and it is perfectly working.
in the script i have written
#147;
Last edited by kotlmg on 28 Nov 2011 17:25, edited 1 time in total.
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: repeating the last action on selected files.
Sure it would work for what is requested:highend wrote:@Stefan & Marco:
Both solutions wouldn't work.
I am not assuming what he might want to do, only what he wrote he want to.kotlmg wrote: or
like in msword, we can vertically highlight text by pressing alt and drawing the area to select the content.
i want to rename selected files by drawing the area to my liking and keeping the extensions as it is.
is this possible with script? can anyone help me.
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: repeating the last action on selected files.
Pretty fine. Thanks for the feedback. You are now allowed to drop the "sir" and just call me Stefankotlmg wrote: stefan sir,
your suggestion has worked for me.
EDIT:
no => now
EDIT:
Code: Select all
//// Select a few files and execute this script:
////Copy the names of the selected files to the clipboard:
#102; ////File / To Clipboard / Item Name(s)
//// Run MS Word or an text editor:
run winword;
////Edit in Word, copy to the clipboard, switch back to XYplorer where "Edit Item Names..." waits for you
////Open an dialog to edit all selected files in one dialog:
#147; ////File / Rename Special / Edit Item Names...
////Past in your modified lines. OK the "Edit Item Names..." dialog, Click OK and watch the preview. Press "Rename Now". Done.
-
kotlmg
- Posts: 321
- Joined: 30 Jun 2010 17:14
Re: repeating the last action on selected files.
stefan, i tried the above code. selected files before executing the above code are not getting copied to clipboard. i have to again manually select and copy the files in edit window. i want only the base names to be displayed in the edit window and after renaming they should retain the original extensions. can you close the winword once rename is done? can you add copy and paste icons to the edit window?
tried the following modified code
but it is not working. files are not getting copied to clipboard.
tried the following modified code
Code: Select all
//// Select a few files and execute this script:
////Copy the names of the selected files to the clipboard:
#113; ////copy selected files base name
//// Run MS Word or an text editor:
run winword;
////Edit in Word, copy to the clipboard, switch back to XYplorer
where "Edit Item Names..." waits for you
////Open an dialog to edit all selected files in one dialog:
#147; ////File / Rename Special / Edit Item Names...
////Past in your modified lines. OK the "Edit Item Names..." dialog,
Click OK and watch the preview. Press "Rename Now". Done.
-
Marco
- Posts: 2354
- Joined: 27 Jun 2011 15:20
Re: repeating the last action on selected files.
Maybe I'm a bit stupid, but still can't get want the OP wants to achieve. Maybe the deletion of a fixed amount of characters from the right of a file base name, applied to a selection of files?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]
Don sees all [cit. from viewtopic.php?p=124094#p124094]
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: repeating the last action on selected files.
Both works for me, clipboard is filled with names:kotlmg wrote:stefan, i tried the above code.
Selected files before executing the above code are not getting copied to clipboard.
I have to again manually select and copy the files in edit window.
Tried the following modified code
but it is not working. Files are not getting copied to clipboard.
#102; ////File / To Clipboard / Item Name(s)
#113; ////copy selected files base name
Not easy to make the error handling, and you would loose the preview dialog before renaming.I want only the base names to be displayed in the edit window
and after renaming they should retain the original extensions.
If #147; (Edit Item Names...) would got an "[] Exclude extensions" check box
then XYplorer had to store the extensions for each file in an array by index
and then add the extension to the modified names in the same order again.
No.Can you close the winword once rename is done?
No. Ask Don.Can you add copy and paste icons to the edit window?
I don't need that buttons but I would second the request to have an [Edit]-button
and an "default" editor app set in settings and used for all such buttons in XYplorer.
Settings
Default Text Editor: [<xypath>\folder\edit.exe]
XYplorer itself would store the name list into an temporary file, and call that temp file with the set default editor,
then XY could detect if you had saved that file in that editor and could automatically refresh the "Edit Item Names..." dialog.
- - -
All i know is he wants to do is using an app to "pressing alt and drawing the area to select the content."Marco wrote:Maybe I'm a bit stupid, but still can't get want the OP wants to achieve. Maybe the deletion of a fixed amount of characters from the right of a file base name, applied to a selection of files?
.
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Advanced file renaming with preview
I did some test an came up with an solution for youStefan wrote:Not easy to make the error handling, and you would loose the preview dialog before renaming.kotlmg wrote:I want only the base names to be displayed in the edit window
and after renaming they should retain the original extensions.
Use Siren renamer with XYplorer file manager
http://scarabee-software.net/forum/viewtopic.php?id=228
Siren renamer has no scripting support build-in but you can export and import from/to text editor
http://scarabee-software.net/forum/view ... d=756#p756
Advantage of using Siren over XY:
you can chose to modify the file name itself or the base name only, and you get an preview even for base name editing before the actual renaming.
To see the attached files, you need to log into the forum.
XYplorer Beta Club