Page 2 of 2

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 15 Feb 2024 01:38
by highend
Maybe start by reading the help file?

<get SelectedItemsPathNames>
What does that return?
All items separated by <crlf>!
Does the current foreach loop over <crlf>-separated files? Nope^^

$name = gettoken($file, -1, "\\");
Since when is "\\" a valid separator in Windows paths?
Apart from that, getting $name and $ext can be simplified by using getpathcomponent() / alias: gpc()

renameitem($file, $newName, "c");
Wrong order of arguments & what the heck should the "c" stand for?

Use step; / unstep; to check if things really do what they should...

and again: Scripting doesn't work if you don't consult the help file^^

Code: Select all

load "C:\\Users\\damie\\AppData\\Roaming\\XYplorer\\Scripts\\Replace dot with space.xys";
Again, "\\" is not a valid path separator^^
Regarding that path, quoted from the help file:
If the given filename does not contain an extension, XY will automatically add .XYS as its extension ("XYplorer Scriptfile"). So, to load the file MyScript.xys located in the application data folder, all you need to specify as parameter is MyScript: load "MyScript"
So a simple (if the script content were correct) load "Replace dot with space"; would have worked...

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 15 Feb 2024 02:24
by Skettalee
Im sorry i know you might find it hard to believe but I have read the help file and i frequent the message board often and do think im reading everything I just have an issue retaining information. I have both had a brain surgery in my life for a subdural haematoma and also have severe ADHD and those are the only things I can think would be my issues with reading and my problems with getting things done that I read. Im sorry i dont seem to retain much in but I am trying i swear. And as to my script being completely wrong Its because I tried to get Chat GPT to help me with scripting and I see that Chat GPT is no help. I couldn't figure it out myself by reading through the message board and other pages about scripting that yall may have. Is there a single document or webpage that lists all the commands in scripting, what it does, and how to use them that I can supply to chatgpt so it can better help me with this? Again I am sorry to cause any trouble with any of y'all.

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 15 Feb 2024 10:49
by highend
The help file has a scripting section. With all the rules, commands, functions and belonging examples

If that helps an AI to spit out valid code? I don't see a lot of I in AI...

Proper code for the task at hand would have looked like this:

Code: Select all

    foreach($file, <get SelectedItemsPathNames>, <crlf>, "e") {
        $base    = gpc($file, "base");
        $ext     = gpc($file, "ext");
        $newBase = replace($base, ".", " ");
        if ($base == $newBase) { continue; }
        if ($ext) { $newName = $newBase . "." . $ext; }
        else      { $newName = $newBase; }
        renameitem($newName, $file);
    }

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 17 Feb 2024 02:03
by Skettalee
Thank you so much, that actually worked right away. Yeah I know I thought I included the help file i found for xyplorer
is the XYplorer.chm the actual file? I know I usually just press F1 from inside xyplorer but I noticed that if i try to run that file from explorer then it opens what looks like the help file window but with no contents in it. that file is only 1.25 mb's maybe making me think that it doesn't actually have all the stuff the help file has in it. Thank you so much for the script though!

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 17 Feb 2024 04:19
by phred
The latest help pdf can always be found here
All 867 pages of it.

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 17 Feb 2024 10:31
by highend
the help file window but with no contents in it
You need to unblock the .chm (google is your friend)

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 18 Feb 2024 03:24
by Skettalee
I have looked on google for unblock chm, and it just gave me what i already know about files being blocked if you download them off the net, maybe I am going in the wrong direction though? I have already checked if that file is being blocked by anything as well as giving my user name full permissions to use the file, it still shows nothing in it.
I noticed the previous message about the PDF version of the help file and have downloaded that so thank you!

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 18 Feb 2024 05:59
by RalphM

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 18 Feb 2024 07:52
by Skettalee
Yes i am well aware of that blocked feature but I have checked my xyplorer folder, the CFM file and all other files there, none of them are set as blocked so they dont have any block setting in the properties, I have even went further using Winareo Tweaker to make sure that it wasn't being blocked by anything

Re: Using "search & replace" for cleaning multiple spaces?

Posted: 18 Feb 2024 08:42
by Skettalee
I will add that I have downloaded the xyplorer portable version from some site and extracted and found the same help file but that one I was able to see the contents of. I tried copying that file to the program files x86 directory xyplorer but when executed there it went back to being black, I even set full control for my user name in that one and the appdata xyplorer folders to see if it was a permission issue but it never was able to run from inside its original directory.