rename using a text editor

Discuss and share scripts and script files...
highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: rename using a text editor

Post by highend »

If full paths in the file to be edited isn't what you "need" then forget about all your "wishes"
in viewtopic.php?p=157934#p157934
because it can't be done without full paths...
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: rename using a text editor

Post by highend »

Here with a small tool that does the indenting (72k files in ~500ms instead of 36k files in ~300s)...

This is the necessary script:

Code: Select all

    $spacePerLevel = 4;

    // ========================================================================
    // == DO NOT CHANGE ANYTHING BELOW IF YOU DO NOT KNOW WHAT YOU ARE DOING ==
    // ========================================================================

    if !(get("CountSelected")) { status "No item(s) selected, aborted!", "8B4513", "stop"; end true; }
    $file = "%TEMP%\~ColumnEdit.txt";
    writefile($file, <get SelectedItemsPathNames <crlf>>, , "utf8bom");
    $rootIndent = gettoken(<curpath>, "count", "\");
    if !(regexmatches($spacePerLevel, "^\d+$")) { $spacePerLevel = 4; }
    if !(runret("""<full path to Indenter.exe>"" ""$file"" $rootIndent $spacePerLevel", "%TEMP%", , 2)) {
      run "<full path to ColumnEdit.exe>", "%TEMP%";
      sendkeys "^a^v";
      #147;
    }
Only change:
- <full path to Indenter.exe>
- <full path to ColumnEdit.exe>

in this script!

Nothing has changed, you CANNOT rename a folder together with a containing file at the same time!

The indenter.exe file:
Indenter_v2018.04.10.zip
(11.22 KiB) Downloaded 111 times
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: rename using a text editor

Post by suslo »

Indenter.exe and ColumnEdit.exe do not appear in processes
'edit item names' window and ColumnEdit.txt do not appear too
a 'No item(s) selected, aborted' warning is also absent (in case no items are selected)

nothing happens except this line appears in status bar:
-> UDC: Run Script | my-caption-of-scipt

yusef88
Posts: 1126
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: rename using a text editor

Post by yusef88 »

viewtopic.php?f=5&t=16657#p144321
isn't this relevant to your wish?

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: rename using a text editor

Post by suslo »

yusef88, see the 2nd post of this thread

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: rename using a text editor

Post by highend »

Tried this with v14.10 now...

Code: Select all

    $spacePerLevel = 4;

    // ========================================================================
    // == DO NOT CHANGE ANYTHING BELOW IF YOU DO NOT KNOW WHAT YOU ARE DOING ==
    // ========================================================================
    if !(get("CountSelected")) { status "No item(s) selected, aborted!", "8B4513", "stop"; end true; }
    $file = "%TEMP%\~ColumnEdit.txt";
    writefile($file, <get SelectedItemsPathNames <crlf>>, , "tu");
    $rootIndent = gettoken(<curpath>, "count", "\");
    if !(regexmatches($spacePerLevel, "^\d+$")) { $spacePerLevel = 4; }
    run """<full path to Indenter.exe>"" ""$file"" $rootIndent $spacePerLevel", "%TEMP%", 2, 0;
    run "<full path to ColumnEdit.exe>", "%TEMP%";
    #147;
It does NOT try to copy the indented stuff into the edit item names... window, it will only show
the non indented selected items without paths when it opens. Once the text editor saves the
file to edit, the indented stuff is shown in the edit item names window. If you want to change
that behavior, hack the ColumnEdit (ahk) code yourself...

The necessary Indenter.exe (switches from UTF-8 BOM to UTF-16 LE BOM because your old XY doesn't
know about the utf8bom switch for writefile):
Indenter_v2018.04.11.zip
(10.6 KiB) Downloaded 108 times
That's my last attempt, from now on you're on your own
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: rename using a text editor

Post by suslo »

highend, i have not read your last post yet. i will do it soon
here's what i wrote during the recent hour:

test of the script in xy-18.00 showed that:
1. script partially works
2. Indenter.exe does not appear in processes in any way (not even during half a second)
3. after load of the script: 'edit item names' window only displays the text which is in the clipboard at that moment

4. 14800 items: ColumnEdit.txt appears after 1 second
after it was edited and saved, 'edit item names' window immediately changes that clipboard text to 14800 edited lines
so with this (or smaller) quantity of items everything is normal (except strange but bearable nuance with a clipboard text)

5. 16800 items: ColumnEdit.txt appears after 1 second
after it was edited and saved, nothing changes in the 'edit item names' window
so the script doesn't work with this (or greater) quantity of items

6. 35900 items: ColumnEdit.txt appears after 2 seconds
after it was edited and saved, nothing changes in the 'edit item names' window

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: rename using a text editor

Post by suslo »

concerning the Indenter_v2018.04.11 in xy-14:

14100 (or smaller) items: everything is normal
16800 (or greater): script doesn't work (the 'edit item names' window doesn't update its content according to changes that were made in ColumnEdit.txt)

ColumnEdit.txt appears after just 2 seconds even with 35900 items

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: rename using a text editor

Post by highend »

Can't reproduce that behavior with v14.10 on my system (Windows Server 2012 R2 U3 x64)

When I use a branch view with 72.730 items, use the script and then edit a line in the text
editor and save it again, the full 72.730 indented items are placed in XYplorer's edit item names
window...
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: rename using a text editor

Post by suslo »

xy-14, Indenter_v2018.04.11:

16407: everything is normal
16408: script doesn't work
there should be some explanation to this behaviour

i begin to suspect that xyplorer's version is not the reason because there is more or less same problem in xy-18.00

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: rename using a text editor

Post by highend »

It's probably not the number of lines, otherwise I couldn't use 72.730
but maybe the amount of characters that ControlSetText sends to the edit item names - Edit1 control
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: rename using a text editor

Post by highend »

Try using this version, I've upped the normal 64MB variable limit to 512MB
ColumnEdit_v1.1.zip
(398.5 KiB) Downloaded 107 times
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: rename using a text editor

Post by suslo »

16407: 585 713 symbols (571 kb)
16408: 585 771 symbols (572 kb)

1. i'm confused a little. if i stay on xy-14 then what is the best version of the script? use of the indenter2018-04-10(11?) is obligatory, right?
2. if i decide to switch to xy-18 then what is the best version of the script? use of the indenter2018-04-10 is obligatory, right?

3. can we know what is the exact limitation concerning the amount of characters?
4. is it a good idea if script displayed a warning in case the selected items contain more characters than the script is able to work with?

5. ColumnEdit_v1.1 showed no difference at all (in xy-14 and in xy-18)

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: rename using a text editor

Post by highend »

My testfile contains over 3.2 million characters so it's not a constraint of XY or ColumnEdit.exe...

1. Which script, XY wise? Use this: viewtopic.php?p=157952#p157952
indenter2018-04-11 is necessary (because the xy script writes UTF-16 LE BOM here)

2. viewtopic.php?p=157946#p157946
indenter2018-04-10 is necessary (because the xy script writes UTF-8 BOM here)

3. I'm not aware of any technical limitation. So you need to find out the exact limit on your system.
You can find out the string length of the (converted!) file with something like

Code: Select all

$someVar = strlen(readfile($file));
Compare it to the limit on your system and spit out a warning via the script commands
end, text or status...

4. Ok, than it's probably not a problem of ColumnEdit.exe on your system but maybe an OS limit (caused by whatever)...

My internal version (for XY v18.x only) is by the way able to do the indenting in 1/5 - 1/6 the time of the last indenter.exe,
e.g. 72k files in 75ms...
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: rename using a text editor

Post by suslo »

i'm trying the script in xy-18.90.01 now (ColumnEdit_v1.1) (Indenter-2018-04-10):

16815 items
(previously: 16407 of these 16815 were normally processed by ColumnEdit.exe)
(previously: 16408 of these 16815 were not normally processed by ColumnEdit.exe)

the result is:
- 1 046 758 symbols (0,99 mb): works

other folder 1:
- 1 185 759 symbols (1,12 mb): works
- 1 185 811 symbols (1,13 mb): doesn't work

other folder 2:
- 1 185 729 symbols (1,12 mb): works
- 1 185 827 symbols (1,13 mb): doesn't work

while in xy-14 (ColumnEdit_v1.1) (Indenter-2018-04-11) the result is:
- 1 185 759 symbols (1,12 mb): works
- 1 185 811 symbols (1,13 mb): doesn't work

i don't understand the following:
yesterday's result in xy-14 was: 16408 (script doesn't work)
this is those 16408 which are working now (as part of 16815) (it is the same folder, without modications since yesterday)

results from 'sublime text 3160':
- 1 168 112 symbols (? mb): works
- 1 168 163 symbols (? mb): doesn't work

1. what could be the reason for the limit on my system? (win server 2003 r2 sp2 32bit) (8 gb ram)
in case the system is to blame

2. according to my text editor (notepad2): the approximate limit is seemingly around 1 185 800 symbols (1,13 mb)
but sublime text showed that this quantity of symbols cannot be considered as almost exact limit

Post Reply