Assigning external programs to the Keyboard Funtion Keys
-
click-click
- Posts: 6
- Joined: 04 Feb 2017 15:45
Assigning external programs to the Keyboard Funtion Keys
Is it possible to assign a program exe to a function key so that it will be executed on
the currently selected file in a directory listing?
For example, If I want to browse or edit a file, I simply would use F2 or F4 against the file
to either edit or browse that file. My current file manger allows me to do this which is very
convenient and quick. I can also open a cmd line to execute an item with additional parms.
I.e. the command line would look like this: / 12345 The slash refers to the current item in
the dir listing and the rest would be parameters.
I just came across XYPlorer and see that it has a lot of bells and whistles and was wondering
if what I want to do is also possible.
the currently selected file in a directory listing?
For example, If I want to browse or edit a file, I simply would use F2 or F4 against the file
to either edit or browse that file. My current file manger allows me to do this which is very
convenient and quick. I can also open a cmd line to execute an item with additional parms.
I.e. the command line would look like this: / 12345 The slash refers to the current item in
the dir listing and the rest would be parameters.
I just came across XYPlorer and see that it has a lot of bells and whistles and was wondering
if what I want to do is also possible.
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Assigning external programs to the Keyboard Funtion Keys
Welcome to the forum
Sure that's possible...
An example: This one opens a command prompt (without exiting it when the program has finished) and calls
the current selected file with the param: --version.
So if I'd use it on git.exe it would display the output of git.exe --version afterwards
You can assign keyboard shortcuts to such a user-defined command
The help file - Advanced Topics - User-Defined Commands should tell you the necessary details...
Sure that's possible...
An example: This one opens a command prompt (without exiting it when the program has finished) and calls
the current selected file with the param: --version.
So if I'd use it on git.exe it would display the output of git.exe --version afterwards
You can assign keyboard shortcuts to such a user-defined command
The help file - Advanced Topics - User-Defined Commands should tell you the necessary details...
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal
-
click-click
- Posts: 6
- Joined: 04 Feb 2017 15:45
Re: Assigning external programs to the Keyboard Funtion Keys
Sounds good, I will do some testing. I did notice that you cannot reassign the Enter key. I normally use that
for browsing files. Is there a specific reason why the Enter key cannot be reassigned to run an external program?
for browsing files. Is there a specific reason why the Enter key cannot be reassigned to run an external program?
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Assigning external programs to the Keyboard Funtion Keys
Probably hardcoded to all the functions it already has (executing files/opening non-executables, folders...)
One of my scripts helped you out? Please donate via Paypal
-
click-click
- Posts: 6
- Joined: 04 Feb 2017 15:45
Re: Assigning external programs to the Keyboard Funtion Keys
I just tried this as a quick test when running from XYPlorer, but the window closes and I don't see any output.
run 'cmd /k fv.exe <curitem>' ;
If I run the same command from the Windows Run box, I see the output in the console window and it
doesn't close. cmd /k fv.exe c:\_AppTweak.log
Is my syntax wrong?
run 'cmd /k fv.exe <curitem>' ;
If I run the same command from the Windows Run box, I see the output in the console window and it
doesn't close. cmd /k fv.exe c:\_AppTweak.log
Is my syntax wrong?
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Assigning external programs to the Keyboard Funtion Keys
Single quotes -> No variable resolving -> <curitem> = literal "<curitem>"
One of my scripts helped you out? Please donate via Paypal
-
click-click
- Posts: 6
- Joined: 04 Feb 2017 15:45
Re: Assigning external programs to the Keyboard Funtion Keys
Thanks, I got that working now. There's a lot to read and learn. One thing I haven't found yet is how to run <curitem> where I can still edit the parameters. I don't want to hard-code multiple scripts for each possible parameter. I could use run "<curitem> <clp>"; but I would still like to see the entire cmdline and possibly edit the <clp> part before running it. An editable CmdLine Bar like the Address Bar would be ideal. I don't think Step Mode would help here. Any way to do this?
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Assigning external programs to the Keyboard Funtion Keys
Code: Select all
input()One of my scripts helped you out? Please donate via Paypal
-
admin
- Site Admin
- Posts: 66679
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Assigning external programs to the Keyboard Funtion Keys
Tip: The "Open With" category in User-Defined Commands is meant to do exactly this.
FAQ | XY News RSS | XY X
-
click-click
- Posts: 6
- Joined: 04 Feb 2017 15:45
Re: Assigning external programs to the Keyboard Funtion Keys
Thanks for the tips. I'm a bit overwhelmed at all the possibilities available, and find it difficult to always find
what I'm looking for and implement it. Eventually, I will have less questions.
If you don't mind, I have another question concerning listed items. I have two tabs open and I would like to run
winmergeu.exe -r <cureitem> other_curitem
How can I get other_curitem from the second tab listing?
I don't know how to do this with "open with" or with input().
what I'm looking for and implement it. Eventually, I will have less questions.
If you don't mind, I have another question concerning listed items. I have two tabs open and I would like to run
winmergeu.exe -r <cureitem> other_curitem
How can I get other_curitem from the second tab listing?
I don't know how to do this with "open with" or with input().
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Assigning external programs to the Keyboard Funtion Keys
How can I get other_curitem from the second tab listing?
Code: Select all
$otherPaneItem = get("Item", "i"); One of my scripts helped you out? Please donate via Paypal
-
admin
- Site Admin
- Posts: 66679
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Assigning external programs to the Keyboard Funtion Keys
I use this Portable File Associations to compare files with WinMerge. It compares the file on clipboard with the currently selected file:
If you like it add it here:
Tools | Customize File Associations...
Code: Select all
|"WinMerge (clip / cur)" *;\>"C:\Program Files (x86)\WinMerge\WinMergeU.exe" "<clipboard>" "<curitem>"Tools | Customize File Associations...
FAQ | XY News RSS | XY X
-
click-click
- Posts: 6
- Joined: 04 Feb 2017 15:45
Re: Assigning external programs to the Keyboard Funtion Keys
Code: Select all
|"WinMerge (clip / cur)" *;\>"C:\Program Files (x86)\WinMerge\WinMergeU.exe" "<clipboard>" "<curitem>"Can you explain "WinMerge (clip / cur)" *;\>?
I don't see this syntax described anywhere in the script reference. I thought clip was a Windows command.
-
admin
- Site Admin
- Posts: 66679
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Assigning external programs to the Keyboard Funtion Keys
Yes, it's indeed the same.click-click wrote:Isn't that the same as just running winmergeu.exe "<curitem>" "<clp>"?Code: Select all
|"WinMerge (clip / cur)" *;\>"C:\Program Files (x86)\WinMerge\WinMergeU.exe" "<clipboard>" "<curitem>"
Can you explain "WinMerge (clip / cur)" *;\>?
I don't see this syntax described anywhere in the script reference. I thought clip was a Windows command.
"WinMerge (clip / cur)" is just the caption shown in the Open With menu.
*;\ means match all files and all folders.
FAQ | XY News RSS | XY X
XYplorer Beta Club