Jump to content
Muxe Inc Forums
Sign in to follow this  
seibax

User Menu Variables

Recommended Posts

seibax    0

Hi,

 

is there any option to get only the last part of the directories from the panels??

 

For example:

 

Left Panel I have opened c:\111\222\333\

the bar is on 1.rar

 

and right panel i have opened d:\aaa\bbb\

 

now i want to make a small user menu command to extract

 

rar x c:\111\222\333\1.rar d:\aaa\bbb\333

 

is this possible??

 

thanks in advance,

 

greetz seibax

Share this post


Link to post
Share on other sites
Garl    0

your

>1 rar x !.! to $:$\
rar x !:!\!.! $:$\
[code]

press F2 - (user menu)
then press F1 (help)

select "User_Menu" - press enter 
select "Filename_macros" - press enter 
enjoy help!

Filename macros 
NDN gives you all possibilties to work with files in any way you want. Here's the complete list of macros that are available to access the files in the active and passive current file panel.

NOTE: if one of the 2 panels does not contain valid files no
      string replacement will take place.
!  - Name of file in active file panel
~! - Short name of file in active file panel
$  - Name of file in passive file panel
~$ - Short name of file in passive file panel
.! - Extension of file in active File Panel
.!~- Short extension of file in active File Panel
.$ - Extension of file in passive File Panel
.$~- Short extension of file in passive File Panel
!\ - Directory of file in active File Panel
!~\- Short directory of file in active File Panel
$\ - Directory of file in passive File Panel
$~\- Short directory of file in passive File Panel
!/ - Directory of file in active File Panel (without \)
!~/- Short directory of file in active File Panel (without \)
$/ - Directory of file in passive File Panel (without \)
$~/- Short directory of file in passive File Panel (without \)
!: - Drive of file in active File Panel
$: - Drive of file in passive File Panel

my example:
[code]
>1
>1 t~e~st
   >2 !!.!! = !.!
   Echo -------------
   echo !!.!!
   echo !.!
   >2 $$.$$ = $.$
   Echo -------------
   echo $$.$$
   echo $.$
>2
   >2 SFN ~!!.!!~ = ~!.!~
   Echo -------------
   echo ~!!.!!~
   echo ~!.!~
   >2 SFN ~$$.$$~ = ~$.$~
   Echo -------------
   echo ~$$.$$~
   echo ~$.$~
>2
   >2 !!:!!\!!.!! = !:!\!.!
   Echo -------------
   echo !!:!!\!!.!!
   echo !:!\!.!
   >2 $$:$$\$$.$$ = $:$\$.$
   Echo -------------
   Echo $$:$$\$$.$$
   Echo $:$\$.$
>2
   >2 LFN+SFN_PATH = !:!~\!.!
   Echo -------------
   Echo !!:!!~\!!.!! =
   echo !:!~\!.!
   >2 LFN+SFN_PATH = $:$~\$.$
   Echo -------------
   Echo $$:$$~\$$.$$ =
   echo $:$~\$.$
>2
   >2 SFN+SFN_PATH = !:!~\~!.!~
   Echo -------------
   echo !!:!!~\~!!.!!~
   echo !:!~\~!.!~
   >2 SFN+SFN_PATH = $:$~\~$.$~
   Echo -------------
   echo $$:$$~\~$$.$$~
   echo $:$~\~$.$~
>2
   >2 %1 (list of selected files on active panel)
   Echo -------%1
   Type %1
   >2 %2 (list of selected files on passive panel)
   Echo -------%2
   Type %2

Share this post


Link to post
Share on other sites
seibax    0

hi,

 

at first thank you very much for your reply ! But I ONLY want a PART of the directory, in my case the last part....

 

like i said, left panel i am in c:\111\222\333 and selected 1.rar

 

and in right panel i got d:\aaa\bbb\

 

and now i only need the "333" of the directory of file of the left panel

 

but !\ gives "111\222\333"

 

or do i understand this wrong??

 

greetings,

 

seibax

Edited by seibax

Share this post


Link to post
Share on other sites

hi

 

NDN doesn't provide this possibility

 

i THINK it is too special to be supported,

although i just had the idea of adding support for regular expressions

to parse the current/passive filename in addition to the filename macros

 

still i think this may be a very rare case and not worth the trouble/work

 

there are also many programs that fill the environment from within a batch file

at runtime (user menus and extension files are executed as batch/script files)

so, if a program can split the path it may help you (the 333 would be the filename)

 

Stefan / AH

Share this post


Link to post
Share on other sites
GPFault    0

Hi seibax!

if you are using win2000/XP/2003/... (perhaps this work in NT4 or ME too) try this:

>1 unrar !.!
    for %%i in ("!:!/") do rar x !:!\!.! $:$\%%~nxi\

Share this post


Link to post
Share on other sites
seibax    0

Thank You very much, this solution works great.....

 

could you please explain what this for loop does with those parameters??

or do you have some link about this style of batch coding??

 

thank you,

 

greetz seibax

 

Hi seibax!

if you are using win2000/XP/2003/... (perhaps this work in NT4 or ME too) try this:

>1 unrar !.!
    for %%i in ("!:!/") do rar x !:!\!.! $:$\%%~nxi\

Share this post


Link to post
Share on other sites
GPFault    0

Hi, seibax!

First, this information can be found in Windows itself:

Try enter in cmdline: for /?

(use cmd.exe, not command.com, i think on most OS`s you can just enter it in NDN)

Also it can be found in help from start menu(but it`s hard to find it there, and i can`t reproduce a way to find it there...)

 

i`ll try to give a simple explanation of code above.

1.NDN create batch-file with menu item commands

2.in batch files %% is treated as % because of vars %1, %temp%, etc. so you should use %% in batch with for command

3.i is used as variable in for command.

note: this variable is completely different from vars like %temp%, %1 etc. - it isn`t evaluted by cmd`s parser, but by for internal command

note: in this example for isn`t a loop - we have only one entry in ( )

 

4.i is assigned to name of folder in active panel !:!/

5.~nx modifier extracts only name of folder without path to it.

(i don`t test what happen if folder is root (C:\) - the behaviour may be strange)

seibax, if you want to write very powerful cmdline-like scripts you may try windows port of some unix-like shell

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×