Commands on Buttons %currentfolder%

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Skettalee
Posts: 136
Joined: 06 May 2019 20:27

Commands on Buttons %currentfolder%

Post by Skettalee »

Hello, i wrote a batch file to rename all the files in a folder to my specifications that I have built using Advanced Renamer and I have been trying to find a way to turn that .bat file into just a button on the toolbar I can press and it executes either the batch file saved to a certain location or better off just a way to run cmd commands on a selected folder. For doing git pull on alot of folders I use for ai as well as for the renaming process which is :

Code: Select all

@echo off
setlocal

:: Set the method file path
set "method_file=D:\BK-UPz\AdvRenamer BathMethods\correctnames.aren"

:: Check if the method file exists
if not exist "%method_file%" (
    echo Method file not found: %method_file%
    pause
    endlocal
    exit /b 1
)

:: Set the current directory
set "current_dir=%cd%"

:: Check if arenc.exe exists
set "arenc_path=C:\Program Files\Advanced Renamer\arenc.exe"
if not exist "%arenc_path%" (
    echo ARen executable not found: %arenc_path%
    pause
    endlocal
    exit /b 1
)

:: Run Advanced Renamer using arenc.exe
"%arenc_path%" -e "%method_file%" -p "%current_dir%"

endlocal
I have been having to keep that batch file in multiple locations on my machine so I can execute that action on all files in a folder but would really like to not have to tot that bath file everywhere as well as having to first CNTRL+ALt+O or P to have it open a prompt on selected folder and then type git pull and sometimes its for like 17+ folders at a time. Appreciate any help someone can give to reach this goal thanks!

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Commands on Buttons %currentfolder%

Post by jupe »

Well whether you choose to run the batch file or directly script it to run the renamer, the command you need is hidden in the help file under the devious name of runand the variable for current folder is hidden under the Variables section in the help file and called <curpath>

Skettalee
Posts: 136
Joined: 06 May 2019 20:27

Re: Commands on Buttons %currentfolder%

Post by Skettalee »

Maybe im doing something wrong as I still am not seeing the Run command anywhere in the help file. Ill just describe my steps to searching.
I make sure Xyplorer is in focus and press F1, the help file comes up and i type in the search box things like "run command", "scripting", "script" and "commands" and i select it if the word appears and I press F3 to bring out the search dialog to search for things like "run", "run command", "commands" or "open program" and with Run, there are 100's of Instances of the word run and I have gone through as much as i can not seeing anything that says anything about running a command and this is all after I read from you that i can use run command. I knew about the variables already though i did forget what the actual code was for the current path and after you mentioned variables I went to the help file and finally found the variables. I copied all the variables text into a text file that I will store in a folder along with alot of other references to things I need to remember about xyplorer which is easiest for me to remember and recall again later. Im sure that somewhere my ADHD issues make it very difficult for me to read through and remember what i read not to mention the stuff that i have read, tried & learned how to do that I forget alot. I have memory issues, reading and comprehension from a lifetime of ADHD not to mention having had brain surgery already in my mid 30's and now im learning a drug im taking through the VA "hydroxyzine" is known to cause all of what i just mentioned as well even though they say in elderly I still am trying to get my mental health doctors to take me off of it. I know this is alot to be explaining I just hate these issues and have been trying get around them the past few years and I dont want people to think I am just not reading or not following along with things as im sure ive asked questions on here numerous times and probably even the same questions too many times and just wanted to try to explain that issue that ive been having. Sorry
Screenshot 2024-06-11 122949.png
Screenshot 2024-06-11 122949.png (104.16 KiB) Viewed 678 times

klownboy
Posts: 4397
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: Commands on Buttons %currentfolder%

Post by klownboy »

Hey Skettalee, look at the main menu item, Help > Help on Scripting Commands. There you will see all the scripting commands available in XYplorer. Look for "run" in the listing, click on it and from there check out the "run" syntax and examples.

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Commands on Buttons %currentfolder%

Post by jupe »

2024-06-12_035826.png
2024-06-12_035826.png (12.6 KiB) Viewed 671 times

Post Reply