Page 1 of 1
How to use a button to "Edit with" to edit a file
Posted: 13 Jun 2013 19:07
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.
Re: How to use a button to "Edit with" to edit a file
Posted: 13 Jun 2013 19:49
by admin
Simply put the path to the EXE into the Name field, that's it.
Re: How to use a button to "Edit with" to edit a file
Posted: 13 Jun 2013 22:04
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.
Re: How to use a button to "Edit with" to edit a file
Posted: 13 Jun 2013 22:41
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
.
Re: How to use a button to "Edit with" to edit a file
Posted: 13 Jun 2013 23:32
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:
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.
Re: How to use a button to "Edit with" to edit a file
Posted: 14 Jun 2013 08:08
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.
.
Re: How to use a button to "Edit with" to edit a file
Posted: 14 Jun 2013 08:11
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: