How to use a button to "Edit with" to edit a file

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
JimXYUser
Posts: 23
Joined: 23 Nov 2012 00:26

How to use a button to "Edit with" to edit a file

Post by JimXYUser »

Hi,

I know that i can use Droppable User Buttons (DUB) to drop a file to the button n Edit it. But can i just Click on the button and Notepad will Edit it (without drag & drop), a click is more easy then Drag & Drop.

E.g.
I select a file and click on a button to edit it in, say Notepad. (Using DUB will require D&D action).

Btw how to assign a shortcut key to custom create button.

Thanks.

admin
Site Admin
Posts: 66366
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: How to use a button to "Edit with" to edit a file

Post by admin »

Simply put the path to the EXE into the Name field, that's it.

JimXYUser
Posts: 23
Joined: 23 Nov 2012 00:26

Re: How to use a button to "Edit with" to edit a file

Post by JimXYUser »

that's not what i wanted, by putting the exe path into the name field, I need to Drag & Drop (to button) to Edit the file But I wanted just Click to Edit (not Drag & Drop to Edit).

thanks.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: How to use a button to "Edit with" to edit a file

Post by Stefan »

One way would be utilizing script command openwith

"Opens the currently selected List item(s) with the specified application."
openwith application, [mode (s|m)], [itemlist];


openwith notepad;


More in the help under "Scripting Commands Reference" > openwith



>>Btw how to assign a shortcut key to custom create button.
I think you can't. You can put a script at 'User-Defined Commands' and assign shortcuts there.
I though we could just utilize "button "#1";" to execute 'Custom Toolbar Buttons' #1 instead
of having the script at two places (UDC+CTB), but it seams that 'button' doesn't work with CTB? Only with internal XY buttons?
EDIT: Sorry, I didn't remember correctly. If we use "button ctb1" instead it works. See below.


For a how to execute a script, add user buttons and assign shortcuts see e.g.:
http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=6560

.
Last edited by Stefan on 14 Jun 2013 08:10, edited 1 time in total.

JimXYUser
Posts: 23
Joined: 23 Nov 2012 00:26

Re: How to use a button to "Edit with" to edit a file

Post by JimXYUser »

Thanks Stefan for the instruction. I manage to get Notepad to open a (or some) document(s) in edit.

Here is the code:

Code: Select all

openwith Notepad, (m);
You are right, I can't find anyway to attach a shortcut key to custom button. Maybe it would be nice to add this feature in future version.

thank again.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: How to use a button to "Edit with" to edit a file

Post by Stefan »

Ohhh, silly me.

The "name" of the 'Custom Toolbar Button' (CTB) is "ctb23" (if you use button number 23)
You can tell this from command: "::text toolbar();" which shows the current Toolbar Butons.


So "button ctb23;" works indeed if we use the right name "ctb23" (or what ever number your CTB has).


That way you are able to create a 'User-Defined Command' (UDC)
with "button ctb23;" as 'Script' and assign a shortcut to that UDC.
3.) Use User-Defined Commands (UDC) for an one-liner script

UDC are user defined menu commands, you may also assign keyboard shortcuts to them.

How-to:
XYplorer menu "User > Manage Commands..."
"Run Script" section
New... > Add New Command
Caption: [ just an short description]
Script: [       button ctb23;]

Note that that script is saved from XYplorer internally for later reuse.

Tip: click the [Assign Keyboard Shortcut] button and choose a Keyboard Shortcut to your new UDC.

Now you only have to modify the script in the CTB and leave the UDC as it is.


.

admin
Site Admin
Posts: 66366
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: How to use a button to "Edit with" to edit a file

Post by admin »

JimXYUser wrote:that's not what i wanted, by putting the exe path into the name field, I need to Drag & Drop (to button) to Edit the file But I wanted just Click to Edit (not Drag & Drop to Edit).

thanks.
Oops.

BTW, in your working example, the parentheses are not necessary:

Code: Select all

openwith Notepad, m;

Post Reply