Keyboard shortcuts to change text color

Have a problem? A question? This is the place for answers from other Express users.
Nick Sloan
Posts: 17
Joined: 2004-08-01 02:35:18

Keyboard shortcuts to change text color

Post by Nick Sloan »

Can anyone tell me whether there is a way in NWE 1.1.2 [or 2] to link a keyboard shortcut to a specific text color, either with a macro, an applescript or by any other means?

I use color-coded text a lot, and would like changing color to be as quick and simple as changing style. Using the mouse and the colors palette is far too klunky, and character styles (when they arrive) won't do it either, unless they can be set up to contain only one attribute.

Thanks in anticipation.

charles
Posts: 481
Joined: 2002-11-26 11:40:35
Location: San Diego, CA
Contact:

Post by charles »

In 1.1.2 you can assign a keyboard to each language in the Languages preference pane and then turn on "Switch keyboard layouts when language changes." You should always changes languages in Nisus Writer Express, by the way, not just the keyboard. This turns on a lot more features in NWE.

Unfortunately, in 1.1.2 there is no way to map a color to a language. However, in 2.0 you will be able to create a style and you can assign a language and a color to it. This will achieve the effect you are looking for.

-Charles
Charles Jolley
Nisus Software, Inc.

Nick Sloan
Posts: 17
Joined: 2004-08-01 02:35:18

Post by Nick Sloan »

Thank you for the reply. I'm not sure where the idea of linking color with languages came from; I am really only interested in being able to make color changes at whim within any text.

Styles (and associated shortcuts) would only work if I could make a style that would assign a color, but be font-neutral; e.g a style "red", that would color text red, but not change the font. Is this likely to be a possibility in 2?

Or does this further explanation of what I mean suggest any other solutions?

Many thanks.

Nick Sloan
Posts: 17
Joined: 2004-08-01 02:35:18

Post by Nick Sloan »

Sorry, can I narrow the question slightly?

It is easy to write an applescript to set the color for a specific range of characters within a document ("words 1 though 4…" etc.), but is it possible to specify *selected* text within a script?

rmark
Official Nisus Person
Posts: 428
Joined: 2003-02-11 10:49:05
Location: Solana Beach, CA
Contact:

Keyboard shortcuts to change text color

Post by rmark »

Nick,

This is not my area of expertise, but, I've been able to get some more authoritative information:


Using Applescript you can get the selected text, but you can't change it in the document. This script will set the Applescript variable 'aVariable' to whatever text you have selected in document 1. However, you can't change the selected text in Nisus Writer without know it's location in the document. Actually, you can change some of the attributes of the selected text, just not the text itself, it seems. To answer the second part of his first question, that is a limitation in NW Express not in Applescript itself.

tell application "Nisus Writer Express"
set aVariable to selected text of document 1
end tell
Write On!
Mark Hurvitz
Nisus Software Inc.

Nick Sloan
Posts: 17
Joined: 2004-08-01 02:35:18

Post by Nick Sloan »

Thanks Mark.

In case people are puzzled by your phrase "To answer the second part of his first question", this appeared in an email to Nisus, and was: "If there is no class or attribute in the NWE AS library to cover this, is this something that could be incorporated into future versions, or is it a shortcoming in AS?"

Prompting the further question, is the suite of Applescript classes and commands expanded in NWE 2, or is it likely to be in the future?

Since support for AS is such a unique feature of NWE, it would seem a shame not to make it as comprehensive as possible. I could believe that making selection an AS element might not be a simple matter, but it would be hugely useful. What are the odds?

cchapin
Posts: 419
Joined: 2004-02-25 18:28:40
Location: Maryland, USA

Post by cchapin »

Nick Sloan wrote:I could believe that making selection an AS element might not be a simple matter, but it would be hugely useful.
I don't know the difficulty of doing this either, but I would vote for it if it's feasible.

--Craig

marc
Posts: 83
Joined: 2004-07-06 08:45:15
Location: Australia
Contact:

Re: Keyboard shortcuts to change text color

Post by marc »

Nick Sloan wrote:Can anyone tell me whether there is a way in NWE 1.1.2 [or 2] to link a keyboard shortcut to a specific text color, either with a macro, an applescript or by any other means?

I use color-coded text a lot, and would like changing color to be as quick and simple as changing style.
I know this discussion seems to have moved onto scripting, but I just wanted to clarify that I understood correctly;
charles wrote:Unfortunately, in 1.1.2 there is no way to map a color to a language. However, in 2.0 you will be able to create a style and you can assign a language and a color to it. This will achieve the effect you are looking for.
The mention of mapping a language to a style may have made less clear the point that in v2.0 you can use keyboard commands to switch between styles, and that particular styles could change just the colour of the text, and nothing else, thereby achieving what Nick was looking for... right? :)

This, of course, starts to bring up the question of whether there will be character/font and paragraph styles, so that you could have structural (read: paragraph formatting) styles, and font styling styles, like just changing the font colour..?

MacUnix
Posts: 38
Joined: 2003-02-25 03:39:08
Location: The Netherlands
Contact:

Re: Keyboard shortcuts to change text color

Post by MacUnix »

Nick Sloan wrote:This, of course, starts to bring up the question of whether there will be character/font and paragraph styles, so that you could have structural (read: paragraph formatting) styles, and font styling styles, like just changing the font colour..?
If you look at the NWE 2 preview page about the styles you find the following image : http://www.nisus.com/Express/Preview/im ... s_full.jpg

It shows the following buttons : 'All styles' 'Character' 'Paragraph' 'Notes'.
So we can assume that you can do structural style formatting.

Ron

marc
Posts: 83
Joined: 2004-07-06 08:45:15
Location: Australia
Contact:

Re: Keyboard shortcuts to change text color

Post by marc »

MacUnix wrote:
marc wrote:This, of course, starts to bring up the question of whether there will be character/font and paragraph styles, so that you could have structural (read: paragraph formatting) styles, and font styling styles, like just changing the font colour..?
If you look at the NWE 2 preview page about the styles...

It shows the following buttons : 'All styles' 'Character' 'Paragraph' 'Notes'.
So we can assume that you can do structural style formatting.
That's right, I'd forgotten that, thanks for pointing it out.

jhughes
Posts: 1
Joined: 2004-09-11 09:33:37
Location: Culver City, CA 90230
Contact:

Post by jhughes »

I don't think Nick Sloan's question has been answered. His original question was;
"Thank you for the reply. I'm not sure where the idea of linking color with languages came from; I am really only interested in being able to make color changes at whim within any text.

Styles (and associated shortcuts) would only work if I could make a style that would assign a color, but be font-neutral; e.g a style "red", that would color text red, but not change the font. Is this likely to be a possibility in 2? "

I've been trying discover a way to do this in Nisus 2. So far I have determined that you can only change a color when you also change font and style. What if you select a range of text, some in Roman, some italic and some bold and you want to change the color from black to green? Presently when you select a character style which you have created from the color green you also change the font and the style to match the style. Is there a workaround? I hope so!

cchapin
Posts: 419
Joined: 2004-02-25 18:28:40
Location: Maryland, USA

Post by cchapin »

I quickly tried jhughes's idea. In the Style Sheet, I created a style "Redline" and based it on "none." I changed the color to red. A font family name popped up in the specifications, and I deleted it. The only specification in the style was the color. I then created a keyboard shortcut for the style.

When I went back to my document, I applied it to text in the default font, type style and size. It seemed to work fine. When I changed the font family, size and so forth, however, applying the "Redline" character style caused the font family and font size to revert to the document default. Reapplying the other formatting works and does not get rid of the color of the "Redline" style, but this method is a nuisance.

I agree with jhughes that it would be preferable to be able to layer the character style on top of existing formatting. Elsewhere someone (Charles?) explained why applying a paragraph style overrides local character formatting. Might it be possible, when creating a style, to have the option of choosing whether it will override or layer over existing formatting? I'd probably opt for the latter in most cases.

--Craig

P.S. -- Another possible solution for Nick might be to use highlight colors instead of text colors. Those can easily be assigned Menu Keys, though the number of color options is limited.

charles
Posts: 481
Joined: 2002-11-26 11:40:35
Location: San Diego, CA
Contact:

Post by charles »

To apply a color using a keyboard shortcut:

1. In your document, create a new character style. This is easily done by click on the "Plus" button in the Styles palette and choosing Character Style.

This will create the style, switch you to the style sheet view and select the style. A default font is added: Lucida Grande. This is shown below the sample text.

2. The name (Character Style) will be selected. Type the style name you want and press RETURN.

3. Delete the font by clicking on it and pressing the delete key.

4. Add the color by clicking on the color patch in the Character Palette. Then use the color panel to choose your color. Then close the color panel.

5. Click on the box labeled "Shortcut" and press the shortcut key you want assigned. It will show up there. If there are conflicts, you will be warned or a small icon will appear next to the shortcut.

Now, switch back to your Page or Draft view and type. Select some text and using your shortcut you entered to apply the new character style.

If you want these styles to be available in all new documents, simply do the above process on your Nisus New File, accessible in the Advanced pane of the New Document preferences.

---

As for the question about applying formatting: we found that having the style remove all formatting when applied caused less confusion among users because otherwise it was possible to introduce subtle formatting errors into the document that were difficult to diagnose and remove.

We are still refining this feature though because there are obviously other users who prefer this to behave in a different way.

-Charles
Charles Jolley
Nisus Software, Inc.

dennisg
Posts: 73
Joined: 2004-05-16 07:51:28
Location: Seattle, WA

Post by dennisg »

Yes, I'm one of those users who wants the feature to behave in a different way. I'm a writer, and I'm converting about 100,000 words of text to NWE v. 2.0, and applying styles to them. To have to go back through a few hundred pages of documents, just to reapply character formatting because NWE 2 stripped it out is a huge time sink for me. As for the confusion factor, Charles, why would it be less confusing to lose my character formatting when I apply paragraph formatting?
- Dennis

"Is that your little friend in the wood chipper?"

Nick Sloan
Posts: 17
Joined: 2004-08-01 02:35:18

Post by Nick Sloan »

This thread is getting a bit surreal. The original question was quite simple: I was asking for a way to apply color to selected text via the keyboard.

The simplest solution would have been a color submenu in the Format menu but since that didn’t (and doesn’t) exist, the only potential workarounds seemed to be Applescript and styles.

Styles do offer some solution to the problem in Mellel, since different styles can be set up with variations, which can themselves be applied independently, but in Nisus, applying a “font-free” style appears to be the same as applying a default font style -- i.e. if you apply a style “red” in which color is the only character attribute, you do not just leave the font of the selection untouched, but replace it with the default font. This is unhelpful.

Applescript would be perfectly effective if “selection” existed as a class element, but it does not. As rmark writes above: “Using Applescript you can get the selected text, but you can't change it in the document”. Isn’t this a rather obvious omission?

Highlighting, as suggested by cchapin, is a welcome option, but not an adequate solution to the original question.

I didn’t think I was asking that much. Am I the only person who likes to use colour in a document without having to break the flow of writing by resorting to the mouse? The Cocoa Colors palette is a rich mine of possibilities, but a customizable color submenu would be accessible to shortcuts, and surely not difficult to implement. This is a make or break feature for me, a significant weight in the balance between Nisus and Mellel.

Post Reply