Reply to topic  [ 6 posts ] 
Styles in new file created by macro 
Author Message
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
In a macro I am creating a new file using the following code
Code:
Document.newWithText $newDoc

When the macro finishes it gives me an untitled file. The drawer shows a complete set of styles, which are clearly the styles from my "Nisus New File". But when I switch to the style sheet, there are only 3 styles (Header, Footer, Normal); no character styles, no list styles, no note styles. Obviously this is some kind of bug. There are two questions here.
  1. Where do these default styles come from?
  2. Why the mismatch between the drawer and the style sheet?

Philip

_________________
philip


2010-01-26 23:26:16
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
But what is your $newDoc? If any portion of that text object does not have a defined style, what occurs in opening a plain text file or an rtf file without defined styles (e.g. those created by TextEdit) occurs: the text content formatted according to your settings in Preferences - New File - Format, with Normal style imported from your default dot file without being applied.

If the text object has originated from an existing NWP document (and has been treated as attributed text), the defined styles —at least all styles actually used — will be preserved in a new document thus created.

I don’t seem to have the drawer oddity but, concerning something else and at times, I have noticed NWP’s slowness in refreshing information.


2010-01-27 03:13:49
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
phspaelti wrote:
1. Where do these default styles come from?

In the absence of normal/header/footer styles in the provided text, a new document will automatically generate those styles (by copying them from your new file template).

Quote:
Why the mismatch between the drawer and the style sheet?

This would be an updating bug peculiar to the macro command. I'll file it for fixing, thanks.


2010-01-27 13:59:47
Profile WWW
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Kino wrote:
But what is your $newDoc?

Well you can try it like this:
Code:
Document.newWithText “Hello World”

So Nisus will create a new document containing the the text "Hello World". The style sheet for that document (for me) looks like this with the drawer open. As you can see on the left there are 3 styles, and on the right a couple more. The list on the right seems to be the style sheet from my Nisus New File.
Attachment:
Screen_capture_new_doc_style_bug.jpg
Screen_capture_new_doc_style_bug.jpg [ 77.75 KiB | Viewed 3001 times ]

_________________
philip


2010-01-27 23:21:55
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
So that is a “Run Selection as Macro” issue. It does not always work in the same way as a macro run from Macro menu.


2010-01-28 01:05:05
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
I see what you are saying. But it happens in saved macros too, if the text used to create the new document comes from a string as opposed to text. So the following macro shows the problem if even it is saved and run from the menu:
Code:
$doc = Document.active
$sel = $doc.selectedSubstrings
Document.newWithText $sel[0]

_________________
philip


2010-01-28 01:26:12
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software