Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scripting problem - Frame anchoring with flow to new page

1 view
Skip to first unread message

Stuart Friedberg

unread,
Oct 24, 2004, 7:55:03 AM10/24/04
to corel.graphic_apps.ventura8

I'd appreciate any advice on this scripting problem. Ventura 8.559.

I have a directory full of TIFF files. For each file, I want to
create an in-line anchored frame containing a caption and a smaller
(internally) anchored frame to hold the image. Thumbblock and
Thumbnail are the frame tags for the outer and inner frames.
Thumbnail is the paragraph tag for the outer frame's contents.

The attached script _almost_ works. The problem arises when the
outer frames flow onto a second (and subsequent) page. The outer
frames are properly anchored and flow into their proper positions
on each page. However, the inner frames don't get anchored (at
all). I end up with stacks of inner frames in the top left corner
of the 2nd, 3rd, ... Nth pages.

I suppose I am not reselecting the outer frames properly, and that
that has something to do with the "active" page changing. But I
could use a little help figuring out _how_ to do this properly.
If I'm using the wrong technique entirely, I'd like to know that,
too.

Also, is there a Ventura equivalent of Draw "Optimize" that will
suppress all the visual flashing and dancing until the script is
done making and reflowing all these frames?

Stu Friedberg

Thumbnails.csc

Werner Perplies

unread,
Oct 24, 2004, 11:25:04 AM10/24/04
to corel.graphic_apps.ventura8

Mike,

Am Sun, 24 Oct 2004 04:55:03 -0700 schrieb Stuart Friedberg:

> I'd appreciate any advice on this scripting problem. Ventura 8.559.
>
> I have a directory full of TIFF files. For each file, I want to
> create an in-line anchored frame containing a caption and a smaller
> (internally) anchored frame to hold the image. Thumbblock and
> Thumbnail are the frame tags for the outer and inner frames.
> Thumbnail is the paragraph tag for the outer frame's contents.
>
> The attached script _almost_ works. The problem arises when the
> outer frames flow onto a second (and subsequent) page. The outer
> frames are properly anchored and flow into their proper positions
> on each page. However, the inner frames don't get anchored (at
> all). I end up with stacks of inner frames in the top left corner
> of the 2nd, 3rd, ... Nth pages.

I tried it, and it seemed to work, as you want. There must be another
condition.

Why don't anchor the outer frame and group the outer frame with th inner
frame. This should be work too.


>
> I suppose I am not reselecting the outer frames properly, and that
> that has something to do with the "active" page changing. But I
> could use a little help figuring out _how_ to do this properly.
> If I'm using the wrong technique entirely, I'd like to know that,
> too.
>
> Also, is there a Ventura equivalent of Draw "Optimize" that will
> suppress all the visual flashing and dancing until the script is
> done making and reflowing all these frames?

I've the same situation with my CreateAndAnchorFrames. The command
..ViewFreezesScreen should be do this job. But screen freezes only a bit.
After some operations you will have a lot of garbage on the screen which
would be cleared with .ViewUnFreezeScreen and .ViewRedraw.

>
> Stu Friedberg


have a good day
Werner
--
Werner Perplies
www.weepee.biz/en/scripts.html (Last updated: July 13, 2004)
New Ventura Script: CreateAndAnchorFrames just updated with automatic setup

Abe Hendin

unread,
Oct 24, 2004, 8:12:54 PM10/24/04
to corel.graphic_apps.ventura8

Stuart Friedberg wrote:
> I suppose I am not reselecting the outer frames properly, and that
> that has something to do with the "active" page changing. But I
> could use a little help figuring out _how_ to do this properly.

Precisely my guess, Stu, having looked over your ThumbnailBlock SUB.
Remember that the frame index restarts on each page. Use
CurrentPageNumber(,2) before you insert the frame anchor for each
Thumbblock (outer) frame, then again after you insert the anchor, and
compare the two. If the anchor has jumped to a new page, use
FrameCount() again to get its frame's new index. Should do the trick.

Check also that you can in fact use InsertAnchorBegin reliably to select
a frame for anchoring when the cursor is planted *in* the frame; the CS
help text on the command says the frame should be selected first (it's
easily reselected, of course, and that's show I've always done it).

As for the screen redrawing issue... in addition to trying
ViewFreezeScreen as Werner suggests, try the SetVisible command to hide
Ventura during processing, but don't forget to unhide it when done. If I
recall correctly, frame anchoring works fine, and faster, when Ventura
is hidden, but do test carefully: some script functions, e.g.
TextLineInfoGet, fail when Ventura is hidden.

BTW, I wrote a simple script just to make Ventura visible again in case
I forget to disable that command while testing, and something goes
awry... a word to the wise.

--
Abe Hendin
AtYourSpeed Consulting
http://yourspeed.com
Ventura scripts: http://yourspeed.com/vscripts.html
Ventura automation help: http://yourspeed.com/vscripthelp.html

Stuart Friedberg

unread,
Oct 24, 2004, 9:56:17 PM10/24/04
to corel.graphic_apps.ventura8

On Sun, 24 Oct 2004 17:25:04 +0200, Werner Perplies
<werner....@weepee.de> wrote:
> I tried it, and it seemed to work, as you want. There must be another
> condition.

Werner, there does, indeed, seem to be "another condition". I've spelled
out the details in my reply to Abe Hendin, but the short version is that
Ventura has a bug where text reflow upon insertion of an inline anchor can
leave both the current page number and the frame count screwed up.

Thanks for the speedy reply!
Stu Friedberg

Werner Perplies

unread,
Oct 24, 2004, 10:15:23 PM10/24/04
to corel.graphic_apps.ventura8

Stu,

I see no reply to abe.

What's with the group solution?

>
> Thanks for the speedy reply!
> Stu Friedberg

Stuart Friedberg

unread,
Oct 24, 2004, 10:33:13 PM10/24/04
to corel.graphic_apps.ventura8

> I see no reply to abe.

Yes, it seems like the news server has decided to "moderate" that one.
I actually sent it before I send the reply to your message. Who knows
when it will appear? I will resend now, probably resulting in two copies
tomorrow...

> What's with the group solution?

Well, it turned out to be unnecessary. The nesting inline anchoring
works as intended.

Stu Friedberg

Abe Hendin

unread,
Oct 24, 2004, 11:08:31 PM10/24/04
to corel.graphic_apps.ventura8

Stuart Friedberg wrote:
> Well, it turned out to be unnecessary. The nesting inline anchoring
> works as intended.

So it's working? Great. I won't tackle the screwed up page/frame count
problem, then. There are usually ways around that, too, as I assume
you've discovered. Will look forward to your reply whenever the
moderators decide to let it through.

Stuart Friedberg

unread,
Oct 24, 2004, 11:18:58 PM10/24/04
to corel.graphic_apps.ventura8

On Sun, 24 Oct 2004 23:08:31 -0400, Abe Hendin <ne...@yourremspeed.com>
wrote:

> So it's working? Great. I won't tackle the screwed up page/frame count
> problem, then. There are usually ways around that, too, as I assume
> you've discovered.

InsertParagraph forced the reflowed text back to where it belonged and
cleaned up the page number and frame count.

> Will look forward to your reply whenever the moderators decide to let
> it through.

I have no clue why it (and the resend!) have been quarantined. No bad
language, no excessive message size... Seems pretty arbitrary and silly..

Stu F.

Abe Hendin

unread,
Oct 24, 2004, 11:18:48 PM10/24/04
to corel.graphic_apps.ventura8

Stuart Friedberg wrote:
> InsertParagraph forced the reflowed text back to where it belonged and
> cleaned up the page number and frame count.

Good thinking.

> I have no clue why it (and the resend!) have been quarantined. No bad
> language, no excessive message size... Seems pretty arbitrary and silly..

Yup. It impedes progress, for sure. CTECHs, can you put in a word for
improvement of the moderation, here? Perhaps a whitelist of those of us
who are regulars and really don't post offensive material?

Stuart Friedberg

unread,
Oct 24, 2004, 9:54:14 PM10/24/04
to corel.graphic_apps.ventura8
On Sun, 24 Oct 2004 20:12:54 -0400, Abe Hendin <ne...@yourremspeed.com>
wrote:

> Precisely my guess, Stu, having looked over your ThumbnailBlock SUB.
> Remember that the frame index restarts on each page. Use
> CurrentPageNumber(,2) before you insert the frame anchor for each
> Thumbblock (outer) frame, then again after you insert the anchor, and
> compare the two. If the anchor has jumped to a new page, use
> FrameCount() again to get its frame's new index. Should do the trick.

I added
.ViewGotoPage .GoWhere=1, .ChapterOrFile=.CurrentTextFile()
Outer = .FrameCount()
unconditionally today after anchoring the outer frame.
Unfortunately, there is another snag, which is probably Werner's
"other condition".

Ventura seems to be getting confused about what frames flow over
to the new page. There should be none. But for certain settings
of the Thumbblock frame tag, Ventura reflows the last line of
blocks to the new page and places the new block on the second
line of the new page. At this moment, the frame index and
current page number are screwed up.

Immediately after the anchor is inserted, the old and new page
and frame numbers look like this:
Old page: 1, old frame: 61
New page: -1, new frame: 61
or sometimes
New page: -1, new frame: 60
At this point, Ventura is displaying the second page, and has
reflowed several frames from the first page onto it. Page -1
surely smells like a bug to me. And since the frame has been
anchored and there are now 11 frames on the 2nd page, frame
index 61 (or 60) also smells like a bug.

If I immediately InsertParagraph, then I get
Old page: 1, old frame: 61
New page: 2, new frame: 1
and the "reflowed" outer frames move back to page 1. I actually
expected to need .TextCharLeft, .InsertParagraph, but apparently
anchoring a frame doesn't change the insertion point (at least
in this buggy context).

So, a slight hack to your suggestion solved my problem:
Page = .CurrentPageNumber(,2)
.InsertFrameAnchorBegin
.PageFirstLine
.TextEndOfArticle
.InsertFrameAnchor 1

IF Page <> .CurrentPageNumber(,2) THEN
.InsertParagraph ' HACK
Outer = .FrameCount()
ENDIF
Since I can strip out the paragraph breaks after running the
script, this leaves things as desired.

Summary: there seems to be a bug where text reflow on inserting an
inline frame anchor (unwanted reflow, at that) can confuse
Ventura about the page number and frame index for the newly
anchored frame.

> Check also that you can in fact use InsertAnchorBegin reliably to select
> a frame for anchoring when the cursor is planted *in* the frame;

This seems to be working OK. I'm not having any trouble anchoring
the outer frames, and the cursor shouldn't ever be planted in the
inner frames.

Just to be sure, I added a .FrameFirst .FrameIndex=appropriate
immediately before the .InsertAnchorBegin's and nothing changed.

Stu F.

Abe Hendin

unread,
Oct 25, 2004, 10:11:20 AM10/25/04
to corel.graphic_apps.ventura8

Stuart Friedberg wrote:
> Ventura seems to be getting confused about what frames flow over
> to the new page. There should be none.

Right. That's a known problem here, unsurprising in light of the general
issues with the formatter (e.g. footnote placement, para placement with
multi-column text, widow/orphan settings, and VJ. Ventura has trouble
sorting out all the complexity, and the selection goes into limbo (i.e.,
no effective/useable selection from a script's standpoint).

> New page: -1

FYI, this result is a guaranteed way to learn whether the selection is
in limbo in Ventura. I test for it all the time. Usually using
ViewGotoPage to jump between two pages clears it up. You may be able to
dispense with InsertParagraph (why they didn't call it InsertPara to be
consistent with the other commands/functions that use "Para" is anyone's
guess; maybe old code?).

>> Check also that you can in fact use InsertAnchorBegin reliably to
>> select a frame for anchoring when the cursor is planted *in* the frame;
>
>
> This seems to be working OK. I'm not having any trouble anchoring
> the outer frames,

Good to know; thanks.

Stuart Friedberg

unread,
Oct 24, 2004, 10:35:21 PM10/24/04
to corel.graphic_apps.ventura8
Resend, as it appears the news server decided to "moderate" the
original response.

On Sun, 24 Oct 2004 20:12:54 -0400, Abe Hendin <ne...@yourremspeed.com>
wrote:

> Precisely my guess, Stu, having looked over your ThumbnailBlock SUB.
> Remember that the frame index restarts on each page. Use
> CurrentPageNumber(,2) before you insert the frame anchor for each
> Thumbblock (outer) frame, then again after you insert the anchor,and
> compare the two. If the anchor has jumped to a new page, use
> FrameCount() again to get its frame's new index. Should do thetrick.

I added


.ViewGotoPage .GoWhere=1, .ChapterOrFile=.CurrentTextFile()
Outer = .FrameCount()
unconditionally today after anchoring the outer frame.
Unfortunately, there is another snag, which is probably Werner's
"other condition".

Ventura seems to be getting confused about what frames flow over

> Check also that you can in fact use InsertAnchorBegin reliably


> to select a frame for anchoring when the cursor is planted *in* theframe;

This seems to be working OK. I'm not having any trouble anchoring


the outer frames, and the cursor shouldn't ever be planted in the
inner frames.

Just to be sure, I added a .FrameFirst .FrameIndex=appropriate
immediately before the .InsertAnchorBegin's and nothing changed.

Stu Friedberg

Werner Perplies

unread,
Oct 25, 2004, 9:04:30 AM10/25/04
to corel.graphic_apps.ventura8
Stuart,

Am Sun, 24 Oct 2004 18:54:14 -0700 schrieb Stuart Friedberg:

> On Sun, 24 Oct 2004 20:12:54 -0400, Abe Hendin <ne...@yourremspeed.com>
> wrote:
>> Precisely my guess, Stu, having looked over your ThumbnailBlock SUB.
>> Remember that the frame index restarts on each page. Use
>> CurrentPageNumber(,2) before you insert the frame anchor for each
>> Thumbblock (outer) frame, then again after you insert the anchor, and
>> compare the two. If the anchor has jumped to a new page, use
>> FrameCount() again to get its frame's new index. Should do the trick.
>
> I added
> .ViewGotoPage .GoWhere=1, .ChapterOrFile=.CurrentTextFile()
> Outer = .FrameCount()
> unconditionally today after anchoring the outer frame.
> Unfortunately, there is another snag, which is probably Werner's
> "other condition".
>
> Ventura seems to be getting confused about what frames flow over
> to the new page. There should be none. But for certain settings
> of the Thumbblock frame tag, Ventura reflows the last line of
> blocks to the new page and places the new block on the second
> line of the new page. At this moment, the frame index and
> current page number are screwed up.

Yes, there are some such conditions, where the normal logic failed and
every time a frame move to a new page you've to recalculated the frame
order. This is e.g. every time so, if insert a bigger frame between other
frames with text flow around.

It was a hard piece of work to make CreateAndAnchorFrames at that point
bugfree.

0 new messages