Using Macros to assign keyboard shortcuts to styles

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.

Using Macros to assign keyboard shortcuts to styles

Postby doc_guy on Fri May 22, 2015 1:30 pm

A while ago a colleague asked me if she could assign a keyboard shortcut to a specific style. Prior to Flare V11, the answer was no. However, with the new macro functionality in Flare V11, the answer is now YES!

Here is what you do:

  1. Open a topic and go to a paragraph (or text item) that doesn't have the style applied yet.
  2. On the Tools ribbon in the Macros section click Record.
  3. Give the macro a meaningful name. For example, I created a macro to apply a note paragraph style, so I called my macro 'ParagraphNoteStyle'. The macro will being recording.
  4. Click in the paragraph that you want to style (or select the word you want to apply a span style to), and use the existing keyboard shortcut CTRL + SHIFT + H to pull up the style picker
  5. Using your KEYBOARD (not your mouse) type in the name of the style you want to apply. In my case, the style is 'p.note', so I typed exactly that (no quote). You see that the correct style is highlighted in the picker. Press Enter on your keyboard.
  6. On the Tools ribbon in the Macros section click Stop.
  7. Click in an unstylized paragraph or select some unstylized text and click the Macro Playback button, then select your new macro. If your style is applied, continue to the next step. If your style is not applied, you did something wrong, go back and fix the macro before continuing.
  8. In the File menu/ribbon, click the Options button (bottom-right corner of the File panel).
  9. Click the Keyboard Shortcuts tab.
  10. On the top of the window, select "XML Editor" from the dropdown list
  11. Click the "Option" table row head to sort by Option, then scroll through the list to find your macro. It will begin with 'Playback" and will be in the format: "Playback:<Your_Macro_Name>". Click the macro name to select it.
  12. Select a Key Assignment from the right column.
  13. Select a Modifier Key Assignment.
  14. Click OK.
  15. To test, go to an unsylized piece of content, and use your keyboard shortcut to apply the style. (If it is a paragraph/block style, then don't select anything. However, if it is a character/span style, then select the text before you use the keyboard shortcut.

This is pretty cool.
User avatar
doc_guy
Propellus Maximus
 
Posts: 1947
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West

Re: Using Macros to assign keyboard shortcuts to styles

Postby Nita Beck on Fri May 22, 2015 2:08 pm

LIKE! :D
Nita
Image
Content Strategist / Information Architect / Flare Consultant: http://beck-communications.com
Manager, Rochester Flare User Group: http://www.facebook.com/RochesterFlareUserGroup
Nita Beck
Senior Propellus Maximus
 
Posts: 3288
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Using Macros to assign keyboard shortcuts to styles

Postby dorcutt on Fri May 22, 2015 3:13 pm

Yes, thanks for sharing Doc Guy! I should have shared my own investigations on this subject.

I didn't know about the keyboard shortcut method. What I did was I used the main Style drop-down menu on the Home tab of the ribbon to choose the style. Using a button in the ribbon is also recorded properly by Flare macros (though some ribbon buttons seem to be deliberately disabled during macro recording). So far, the macro hasn't broken as I've added and removed styles, though your method seems more trustworthy as styles are added and deleted.

Using the ribbon has two other crucial keyboard shortcut applications:

  • You can select the Reset Style Class menu option from the Style menu to bind it to a macro and therefore a keyboard shortcut. Instead of assigning a particular style to something, it removes the style class from both inline and block tags. I use this to revert my various Note styles to regular paragraphs all the time.
  • You can choose the Conditions button from the Home tab to add one or more condition tags to the selection using a macro (and thus a keyboard shortcut) also!

I want to do the following tasks by macro/keyboard shortcut, but I've been stumped so far. Maybe our collective wisdom can prevail.

  • Remove a condition tag. Unfortunately, recording the process of removing a condition tag just adds a new (probably undefined) condition with an empty name (' ') which is decidedly unhelpful.
  • Unbind a tag. The Unbind command supposedly has a built-in shortcut, but it is broken as of Flare 11. I've submitted a bug (99838) to get it fixed. Changing the key binding doesn't solve the issue. I tried to work around this using the macro/keyboard shortcut method, but there is no unbind button in the ribbon that I can find, so I was stymied.
-Dan, Propellerhead-in-training
dorcutt
Sr. Propeller Head
 
Posts: 234
Joined: Thu May 15, 2014 12:16 pm

Re: Using Macros to assign keyboard shortcuts to styles

Postby ChoccieMuffin on Tue May 26, 2015 2:31 am

Thank you, Paul! I have a project coming up that will really benefit from this one.

Another helpful thing if you prefer to use the Styles window is the ability to pin styles so they always appear at the top of the list. I've done this with my commonly used spans and paragraphs so I don't have to scroll down every time I want to apply a span. Halves the number of mouse-clicks so well worth doing. (But it's project-specific rather than Flare-specific so you have to do it on every project.)
Started as a newbie with Flare 6.1, now using Flare 2019r1.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
ChoccieMuffin
Senior Propellus Maximus
 
Posts: 2146
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Using Macros to assign keyboard shortcuts to styles

Postby fvila on Mon Aug 03, 2015 11:22 pm

Really cool, and very useful when you have lots of formatting to do in a page. :)
A pity they didn't put the keyboard shortcuts directly in the macro manager. Adding a simple macro+shortcut looks like a complete visit of the Flare interface...
fvila
Propeller Head
 
Posts: 46
Joined: Fri Feb 27, 2015 3:44 am

Re: Using Macros to assign keyboard shortcuts to styles

Postby Jim on Thu Sep 03, 2015 6:25 pm

I've recorded and saved a macro in Flare 11.1.0. But when I go to the Keyboard Shortcuts tab, the macro doesn't show up anywhere to assign a shortcut. I've verified that the command is set to XML Editor and I'm looking for Playback: <name of macro>. Anyone have any ideas on what's going on?
Jim
Propeller Head
 
Posts: 18
Joined: Thu Jul 19, 2012 2:56 pm

Re: Using Macros to assign keyboard shortcuts to styles

Postby Brigit on Wed Nov 04, 2015 5:21 am

I had exactly the same problem: the Playback command was simply not available. So I contacted Support and was told to try File > Options > Keyboard Shortcuts > Reset to Factory Defaults and see if the command shows up.

Guess what -- this worked.
Brigit
Jr. Propeller Head
 
Posts: 3
Joined: Thu Oct 15, 2015 2:00 am

Re: Using Macros to assign keyboard shortcuts to styles

Postby Jim on Fri Nov 06, 2015 1:25 pm

Well, would you look at that. Thanks Brigit, it worked :)
Jim
Propeller Head
 
Posts: 18
Joined: Thu Jul 19, 2012 2:56 pm

Re: Using Macros to assign keyboard shortcuts to styles

Postby Rona Kwestel on Thu Jun 01, 2017 11:55 am

Thanks, doc_guy. I was searching on how to use keyboard shortcuts for quick find and replace, and somehow came upon this thread. I don't know if things have changed since you posted this, but, at least in Flare 2017r2, I found that you need to select the content first and then start recording the macro; once you start recording, it doesn't allow you to select.

It turns out that for my current task (applying a style to some but not all table cells), using a macro worked reasonably well, but in general, for quick find and replace, I want to be able to press F3 for find next, and then have a keyboard shortcut (say F4, for argument's sake) to replace, allowing me to quickly alternate between finding the next instance of the search string and replacing only the ones I want. It's amazing to me that there doesn't seem to be a way to do this, unless I'm missing the magic secret.
Rona Kwestel
Sr. Propeller Head
 
Posts: 208
Joined: Wed Apr 04, 2007 11:50 am


Return to Tips and Tricks

Who is online

Users browsing this forum: No registered users and 1 guest