Is the following possible?

I have a 3rd party template that comes with a product, call it XYZ.
As usual, the code appears to be sloppily written and causes the document to
be unnecessarily dirtied.

The project is protected.
Usually, using the usual techniques, I can peek at the code and determine
whether I can get around this by patching my Auto macros.

In this case, there appears to be NO code in the protected template, so I
guess there's a hook to code in an add-in for each control on the menu. and
corresponding toolbar.

I was thinking of the following general fix.

Say, a control has an OnAction that uses "TheirMacro".
I was thinking of adding my own TheirMacro, which would:

1. First, save the dirty status of the document.
2. Invoke XYZ's TheirMacro.
3. Reset the dirty status of the document, if needed.

Alas, it appears that when the OnAction is a hook, I cannot seem to find out
how to do this.
Is it possible?

RE: Hooking controls by zkid

zkid
Mon Oct 02 20:21:01 CDT 2006

A couple of things:

First, if a project is protected from viewing, no one can see the code
without the password. So, the projects that you were able to see were only
passworded for changes and not for viewing (there are two levels to
protecting a project). Regardless, the following should work whether or not
the XYZ macro is accessing another add-in:

Create a macro, not an OnAction, that does what you described (i.e., the
following):

1. Saves the document's "dirty" settings.
2. Calls the XYZ macro.
3. Once XYZ macro is complete, re-sets the document's "dirty" settings.

Provided the XYZ macro does not have an "End" code in it that cancels all
further processing, this should work.

So, depending on how the users are accessing the XYZ macro, you will need to
replace that access with your macro. So, if it is a toolbar entry, you will
need to replace the entry so it accesses your macro instead.

Regarding "dirty" settings, since you can't see the code, you might need to
test the XYZ macros out on different set-ups to determine the issue(s).
Depending on what you mean by "dirty" (user's settings such as show/hide,
screen view, etc.)? A good place to start is with normal view and turn off
show/hide (unless, of course, that's how XYZ leaves the screen).


"Howard Kaikow" wrote:

> Is the following possible?
>
> I have a 3rd party template that comes with a product, call it XYZ.
> As usual, the code appears to be sloppily written and causes the document to
> be unnecessarily dirtied.
>
> The project is protected.
> Usually, using the usual techniques, I can peek at the code and determine
> whether I can get around this by patching my Auto macros.
>
> In this case, there appears to be NO code in the protected template, so I
> guess there's a hook to code in an add-in for each control on the menu. and
> corresponding toolbar.
>
> I was thinking of the following general fix.
>
> Say, a control has an OnAction that uses "TheirMacro".
> I was thinking of adding my own TheirMacro, which would:
>
> 1. First, save the dirty status of the document.
> 2. Invoke XYZ's TheirMacro.
> 3. Reset the dirty status of the document, if needed.
>
> Alas, it appears that when the OnAction is a hook, I cannot seem to find out
> how to do this.
> Is it possible?
>
>
>

Re: Hooking controls by Howard

Howard
Tue Oct 03 01:29:08 CDT 2006

"zkid" <zkid@discussions.microsoft.com> wrote in message
news:AAF61162-8888-4E0F-8B31-C7A25BB38ACB@microsoft.com...
> First, if a project is protected from viewing, no one can see the code
> without the password. So, the projects that you were able to see were
only
> passworded for changes and not for viewing (there are two levels to
> protecting a project).
There are ways to bypass the password.

I'm convinced that they are using event hooks in an add-in, and there's no
way to fight that.
The template in question is ScansoftPDF.dot thaty ships with th erecently
released Scansoft PDF Converter Pro 4.0.

I had a similar problem a few years ago, with Scansoft's OmniPage Office 14,
but was able to change my Auto macros to ignore the issue. As I recall, they
were needlessly modifying the Normal template in their AutoClose.

I suspect that are doing something just as silly in the newer product.


>Regardless, the following should work whether or not
> the XYZ macro is accessing another add-in:
>
> Create a macro, not an OnAction, that does what you described (i.e., the
> following):
>
> 1. Saves the document's "dirty" settings.
> 2. Calls the XYZ macro.
> 3. Once XYZ macro is complete, re-sets the document's "dirty" settings.
>
> Provided the XYZ macro does not have an "End" code in it that cancels all
> further processing, this should work.

The problem is that I do not believe they are using macros, rather they
likely have hooks to the commandbar.
So I am unable to replace anything.

> Regarding "dirty" settings, since you can't see the code, you might need
to
> test the XYZ macros out on different set-ups to determine the issue(s).
> Depending on what you mean by "dirty" (user's settings such as show/hide,
> screen view, etc.)? A good place to start is with normal view and turn
off
> show/hide (unless, of course, that's how XYZ leaves the screen).

It's dirtying the ActiveDocument, which is not being changed by me.

I rewrote ALL my global macros a few years ago, and placed the code in DLLs.

With OmniPage Pro Office, their template was dirtying the Normal template.
Since I always have the Normal template read-pnly, I just have my Autoclose,
etc. ignore changes to the Normal template.

Th newer scansoft template is affecting the Active document, so there is no
way to automatically avoid the issue.




Re: Hooking controls by zkid

zkid
Tue Oct 03 13:44:01 CDT 2006

Hi Howard,

I understand the event hook situation. I have a lot of experience with
document management programs hooking save and save as. I suggest you contact
XYZ. Usually, macro vendors will have a list of macros that you can call
from your own code to work around the hooks. In addition, these types of
vendors also create hooks that prevent you from using auto macros at all;
thus, the need to create a whole new macro to run some code and then access
their macros.

However, you mentioned an additional template by ScanSoft. I'm confused
which one of these programs is giving you trouble.

"Howard Kaikow" wrote:

> "zkid" <zkid@discussions.microsoft.com> wrote in message
> news:AAF61162-8888-4E0F-8B31-C7A25BB38ACB@microsoft.com...
> > First, if a project is protected from viewing, no one can see the code
> > without the password. So, the projects that you were able to see were
> only
> > passworded for changes and not for viewing (there are two levels to
> > protecting a project).
> There are ways to bypass the password.
>
> I'm convinced that they are using event hooks in an add-in, and there's no
> way to fight that.
> The template in question is ScansoftPDF.dot thaty ships with th erecently
> released Scansoft PDF Converter Pro 4.0.
>
> I had a similar problem a few years ago, with Scansoft's OmniPage Office 14,
> but was able to change my Auto macros to ignore the issue. As I recall, they
> were needlessly modifying the Normal template in their AutoClose.
>
> I suspect that are doing something just as silly in the newer product.
>
>
> >Regardless, the following should work whether or not
> > the XYZ macro is accessing another add-in:
> >
> > Create a macro, not an OnAction, that does what you described (i.e., the
> > following):
> >
> > 1. Saves the document's "dirty" settings.
> > 2. Calls the XYZ macro.
> > 3. Once XYZ macro is complete, re-sets the document's "dirty" settings.
> >
> > Provided the XYZ macro does not have an "End" code in it that cancels all
> > further processing, this should work.
>
> The problem is that I do not believe they are using macros, rather they
> likely have hooks to the commandbar.
> So I am unable to replace anything.
>
> > Regarding "dirty" settings, since you can't see the code, you might need
> to
> > test the XYZ macros out on different set-ups to determine the issue(s).
> > Depending on what you mean by "dirty" (user's settings such as show/hide,
> > screen view, etc.)? A good place to start is with normal view and turn
> off
> > show/hide (unless, of course, that's how XYZ leaves the screen).
>
> It's dirtying the ActiveDocument, which is not being changed by me.
>
> I rewrote ALL my global macros a few years ago, and placed the code in DLLs.
>
> With OmniPage Pro Office, their template was dirtying the Normal template.
> Since I always have the Normal template read-pnly, I just have my Autoclose,
> etc. ignore changes to the Normal template.
>
> Th newer scansoft template is affecting the Active document, so there is no
> way to automatically avoid the issue.
>
>
>
>

Re: Hooking controls by Howard

Howard
Tue Oct 03 16:02:44 CDT 2006

"zkid" <zkid@discussions.microsoft.com> wrote in message
news:A21CD45D-69AB-4748-B506-786000EC9E2C@microsoft.com...
> Hi Howard,
>
> I understand the event hook situation. I have a lot of experience with
> document management programs hooking save and save as. I suggest you
contact
> XYZ. Usually, macro vendors will have a list of macros that you can call
> from your own code to work around the hooks.
AFAIK, there is no code in the template, so there are no macros to call.

> In addition, these types of
> vendors also create hooks that prevent you from using auto macros at all;
> thus, the need to create a whole new macro to run some code and then
access
> their macros.

No macros to access,

> However, you mentioned an additional template by ScanSoft. I'm confused
> which one of these programs is giving you trouble.

Both.

But I was able to work arond the one wiht OmniPage Office Pro 14 as it was
modifying Normal template in its AutoClose and I just ignore changes to the
Normal template, which is read-only.

The problem with Scansoft PDF Converter Pro 4 is that it is modifying the
document.
The only workaround I can think of is to write a macro that saves the dirty
status onf the document, runs the Control for the PDF converter that uses
the contrtols id, then restores the document's dirty status.

Actually, I think I have code that does this for another case, I'll have to
dig it out.
>
> "Howard Kaikow" wrote:
>
> > "zkid" <zkid@discussions.microsoft.com> wrote in message
> > news:AAF61162-8888-4E0F-8B31-C7A25BB38ACB@microsoft.com...
> > > First, if a project is protected from viewing, no one can see the code
> > > without the password. So, the projects that you were able to see were
> > only
> > > passworded for changes and not for viewing (there are two levels to
> > > protecting a project).
> > There are ways to bypass the password.
> >
> > I'm convinced that they are using event hooks in an add-in, and there's
no
> > way to fight that.
> > The template in question is ScansoftPDF.dot thaty ships with th
erecently
> > released Scansoft PDF Converter Pro 4.0.
> >
> > I had a similar problem a few years ago, with Scansoft's OmniPage Office
14,
> > but was able to change my Auto macros to ignore the issue. As I recall,
they
> > were needlessly modifying the Normal template in their AutoClose.
> >
> > I suspect that are doing something just as silly in the newer product.
> >
> >
> > >Regardless, the following should work whether or not
> > > the XYZ macro is accessing another add-in:
> > >
> > > Create a macro, not an OnAction, that does what you described (i.e.,
the
> > > following):
> > >
> > > 1. Saves the document's "dirty" settings.
> > > 2. Calls the XYZ macro.
> > > 3. Once XYZ macro is complete, re-sets the document's "dirty"
settings.
> > >
> > > Provided the XYZ macro does not have an "End" code in it that cancels
all
> > > further processing, this should work.
> >
> > The problem is that I do not believe they are using macros, rather they
> > likely have hooks to the commandbar.
> > So I am unable to replace anything.
> >
> > > Regarding "dirty" settings, since you can't see the code, you might
need
> > to
> > > test the XYZ macros out on different set-ups to determine the
issue(s).
> > > Depending on what you mean by "dirty" (user's settings such as
show/hide,
> > > screen view, etc.)? A good place to start is with normal view and
turn
> > off
> > > show/hide (unless, of course, that's how XYZ leaves the screen).
> >
> > It's dirtying the ActiveDocument, which is not being changed by me.
> >
> > I rewrote ALL my global macros a few years ago, and placed the code in
DLLs.
> >
> > With OmniPage Pro Office, their template was dirtying the Normal
template.
> > Since I always have the Normal template read-pnly, I just have my
Autoclose,
> > etc. ignore changes to the Normal template.
> >
> > Th newer scansoft template is affecting the Active document, so there
is no
> > way to automatically avoid the issue.
> >
> >
> >
> >



Re: Hooking controls by Howard

Howard
Tue Oct 03 16:26:35 CDT 2006

Silly me!

Obviously, the easiest way to do this is to write a macro that saves the
dirty status, and another macro to restore the dirty status.
Hard part is remembering to run one before, and the other after, the
scansoft stuff.

P.S. I just noticed that the Scansoft toolbar buttons are no longer working
within Word. and the mebu is missing.



Re: Hooking controls by Howard

Howard
Tue Oct 03 16:56:31 CDT 2006

Well, this is interesting!

When I first installed the Scansoft product a 207KB template was created.
Today, I noticed that th etemplate had grown to 336KB, the scansoft menu was
missing, and the scansoft toolbar butons were no-ops.

So, using Add/Remove programs, I did a Repair.
This resulted in a 21KB scansoft template, and the re-appearance of the
scansoft menu and workable toolbar buttons.



Re: Hooking controls by Howard

Howard
Tue Oct 03 17:15:03 CDT 2006

The following is the relevant menu and toolbar. No value is returned for
OnAction.

PDF &Create! 4
Caption: &Create PDF OnAction: Tag:
MenuZnConvertToPDF Index: 1 Parent: Custom Popup 105941856
Id: 1 FaceId: 0
Caption: Create PDF and &E-mail OnAction: Tag:
MenuZnConvertToPDFAndEmail Index: 2 Parent: Custom Popup
105941856 Id: 1 FaceId: 0
Caption: PDF Link&s OnAction: Tag: MenuPreferences
Index: 3 Parent: Custom Popup 105941856 Id: 1
FaceId: 0
Caption: &Help OnAction: Tag: MenuZnHelp
Index: 4 Parent: Custom Popup 105941856 Id: 1
FaceId: 1


ScanSoft PDF
Caption: OnAction: Tag: BtnZnConvertToPDF Index:
1 Parent: ScanSoft PDF Id: 1 FaceId: 0
Caption: OnAction: Tag: BtnZnConvertToPDFAndEmail
Index: 2 Parent: ScanSoft PDF Id: 1 FaceId: 0
Caption: OnAction: Tag: BtnZnPreference Index:
3 Parent: ScanSoft PDF Id: 1 FaceId: 0
Hodgepodge
Caption: Hodgepodge OnAction: Tag: Index:
1 Parent: Hodgepodge Id: 1