Author Topic: Favorite Macros  (Read 5678 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Favorite Macros
« on: November 29, 2016, 09:02:03 PM »
When I record a macro I can name it and assign a key.


Assigning a key is *hard* - finding a key sequence that isn't already used, making such a tough decision.


Better: Have a "Favorite Macros" toolbar.
When you record a macro add the option to drop it on the favorites toolbar.


This is like the Bookmarks bar in a browser.

Graeme

  • Senior Community Member
  • Posts: 2816
  • Hero Points: 347
Re: Favorite Macros
« Reply #1 on: November 30, 2016, 10:10:47 AM »
Did you know you can create your own toolbar?  View menu -> toolbars -> customize.  Select the Toolbars tab, click the "new" button on the right, enter a name e.g. TB1 and click OK.  Your toolbar should appear in the list of toolbars - select it and make sure  the "visible" and "allow docking" checkboxes are ticked.  You should see a new blank toolbar at the top of the editor window.  Select the "categories" tab and "user definable tools" and drag some buttons onto your toolbar.  Right click one of the buttons on the toolbar and select "properties" to assign a command to the button.

It's also easy to create a popup menu.  See this code for that
https://community.slickedit.com/index.php/topic,11186.msg47177.html#msg47177

I think I already told you about this macro for showing key bindings in groups.
https://community.slickedit.com/index.php?topic=5461.0


jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: Favorite Macros
« Reply #2 on: November 30, 2016, 09:46:37 PM »
Yeah -  I guess I've seen these from you before, but I forgot :-)
I know about creating a toolbar, but I want it to be *easy*.

I've always avoided using toolbars - too hard to figure out what all the dumb little icons mean in most apps - better to learn the keyboard shortcuts or the menus.
Also,most apps make it really hard to save/restore any toolbar customizations you make, so its hardly worth the trouble.

In slick though, I have a few custom macros which I've assigned keys too, but this is too much trouble for a short-term macro - so it seems that a toolbar would work, if only it was easier.
Setting up a toolbar with say 10 buttons, each with a custom user macro is quite a lot of clicking about.

The behavior of editing toolbars is really weird - dragging to remove a button only works when Tools->Options is open, but there is no visual cue for this.


Maybe a toolbar that auto-populates with the same list from Macros->ListMacros? (VSARG2_MACRO?)



Graeme

  • Senior Community Member
  • Posts: 2816
  • Hero Points: 347
Re: Favorite Macros
« Reply #3 on: December 01, 2016, 10:56:46 AM »
Slick export/ import lets you save your own toolbars and menu customizations etc.
Attached is a toolbar with 5 buttons.

Code: [Select]
_command void mac1() name_info(',')
{
   _message_box("mac1");
}

_command void mac2() name_info(',')
{
   _message_box("mac2");
}

_command void mac3() name_info(',')
{
   _message_box("mac3");
}

_command void mac4() name_info(',')
{
   _message_box("mac4");
}

_command void mac5() name_info(',')
{
   _message_box("mac5");
}

Dennis

  • Senior Community Member
  • Posts: 3993
  • Hero Points: 520
Re: Favorite Macros
« Reply #4 on: December 01, 2016, 04:55:46 PM »
Another related feature to remember is that (in most emulations), Alt+F[n] are bound to record-macro-end-execute-key, so you can create an array of user-defined macros.  Jot down what they do on a sticky note, and now you have your favorite macros a key-touch away.

To use it, just start recording a macro, then when you are done, hit Alt+F[n], and the macro is recorded and assigned to Alt+F[n], until you record another macro over it.

If you have already recorded and named a bunch of macros, that you want to assign to Alt+F[n], just do the same thing, start macro recording, then go to Macro > List Macros..., select the macro you want to run, execute it, and then hit Alt+F[n] to record a macro that calls your macro.

If Atl+F[n] isn't in in our emulation, you can use Help > Where is command... to find what keys it is bound to in your emulation.
« Last Edit: December 01, 2016, 04:59:32 PM by Dennis »

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: Favorite Macros
« Reply #5 on: December 06, 2016, 01:26:49 AM »
Hmm, seems that conflicts with Alt+F4.
I can't even view or change what Alt+F4 is in KeyBindings, as pressing Alt+F4 closes the keybindings dialog.
I don't have record-macro-end-execute-key bound to a key.

I typically use the VC6 emulation.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6966
  • Hero Points: 531
Re: Favorite Macros
« Reply #6 on: December 06, 2016, 03:22:58 PM »
Processing Alt+F4 as a normal key is very difficult. On Windows, it may be possible (Qt makes this very hard to do). On Unix (like Linux), it's not possible. Don't know if it's possible to work around this on Mac. Prior to Qt, SlickEdit did support Alt+F4 as a normal key on Windows.

Dennis

  • Senior Community Member
  • Posts: 3993
  • Hero Points: 520
Re: Favorite Macros
« Reply #7 on: December 06, 2016, 04:46:20 PM »
Sorry, I was mistaken, the macro I referred to is not bound by default in any emulations.  I guess I thought it was because I always have it bound to Alt+F1-F12 with no issues with Alt+F4 on macOS.

However, all emulations support "execute-last-macro-key"  It is a two-key sequence, first Ctrl+Shift+F12, then a second key (F1-F12, 0-9, or a-z).

In Visual C++ emulation, the keys Ctrl+Alt+F1-F12 are available if you want to bind "record-macro-end-execute-key"

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6966
  • Hero Points: 531
Re: Favorite Macros
« Reply #8 on: December 09, 2016, 01:00:11 PM »
Processing Alt+F4 as a normal key is very difficult. On Windows, it may be possible (Qt makes this very hard to do). On Unix (like Linux), it's not possible. Don't know if it's possible to work around this on Mac. Prior to Qt, SlickEdit did support Alt+F4 as a normal key on Windows.

For 21.0.2 (next update, no date set yet), Alt+F4 will work like a normal key on windows so it can be rebound with the GUI to something else. Like Dennis said, this already works for Mac.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: Favorite Macros
« Reply #9 on: December 09, 2016, 07:22:58 PM »
Cool.

WRT "Sample Button": The default left-click action should be properties - making it easier to setup new buttons the first time.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: Favorite Macros
« Reply #10 on: December 15, 2016, 09:33:22 PM »
WRT Alt+F4:


Is it possible to distinguish between the arrows and the number pad keys when num-lock is not on?

Currently, Slick reports PadN for these keys when Numlock is on, but when numlock is off the numpad number keys are indistinguishable from others (arrows, pageup/down, home/end.

Other numpad keys are not affected by numlock at all.


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6966
  • Hero Points: 531
Re: Favorite Macros
« Reply #11 on: December 16, 2016, 02:45:18 AM »
There isn't a good way to do this right now.

We may make these keypad keys separately configurable in the future.