Page 1 of 1

Commands on Buttons %currentfolder%

Posted: 11 Jun 2024 12:15
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!

Re: Commands on Buttons %currentfolder%

Posted: 11 Jun 2024 18:51
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>

Re: Commands on Buttons %currentfolder%

Posted: 11 Jun 2024 19:42
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

Re: Commands on Buttons %currentfolder%

Posted: 11 Jun 2024 19:56
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.

Re: Commands on Buttons %currentfolder%

Posted: 11 Jun 2024 20:04
by jupe
2024-06-12_035826.png