problem with References

K

Keith Tromer

Hi,

I have a COM add-in that uses (and sets references) to other libraries. The
one causing me issues is Photoshop scripting. I can set references just
fine. My problem is I am trying to make the addin work for both versions 7
and 8 (CS) of Photoshop. The scripting pluging for Photoshop is an .8LI
file (photoshop plugin) that lives under the Program Files\Adobe\Photoshop
[ver]. The plugin gets properly registered and is available in the
references list as Adobe Photoshop [ver] Object Library. But they both use
the generic name 'Photoshop.Application.' The libraries are similar enough
that I can program for either library. I would think that I can compile
with either version and if a user has the other version, it would find it,
because it has the same name (I cannot set a reference to both -- same
name). But it can't find it for some reason... These are the options I
think I have right now, but I get stuck in each instance:

OPTION 1
don't set reference and use CreateObject instead. I guess this would enable
having one compiled app work for both PS versions BUT...
1. I dim other object for example psDoc as Photoshop.document, I (think) I
can dim these as variants, right?
2. This is the one I can't get around, I use the enum in my programming,
i.e.:
Dim extType As Photoshop.PsExtensionType
extType = psUppercase
I would have to go through and recreate all the global enums (correct
term?) manually -- OR -- is there some kind of DEFINES file I can include?

OPTION 2
Set reference to 7.0 Object Library -- Compile -- then change reference to
8.0 Object library -- compile another version and selectively install the
correct version.

My problem here is this... I have 7.0 and CS installed on the programming
machine. (I installed 7.0 AFTER CS - don't know if that's the problem). I go
to references and unCheck 8.0, click OK, go Back to references and Check 7.0
Object library and click OK. If I know go back to the references dialog, it
seems to have automatically changed the reference back to 8.0... Why is
that? This is now STOPPING me from compiling a version for 7.0?

Can anyone shed some light for me here? Or recommend another forum to ask?

Thanks,

Keith
 
E

Eusch

I had the same kind of problem once with automating Outlook. On my machine I used Outlook from office 2002 and my customer had outlook shipped with office 97. The key to your solution is late binding. This implies one of the solutions you decribed earlier: dim application as object set object = createobject(). There is however the drawback of using constants. You'll need to define them yourself because you have got to get rid of any reference to the type libraries in order to work with both versions.

Hope this helps.

Keith Tromer said:
Hi,

I have a COM add-in that uses (and sets references) to other libraries. The
one causing me issues is Photoshop scripting. I can set references just
fine. My problem is I am trying to make the addin work for both versions 7
and 8 (CS) of Photoshop. The scripting pluging for Photoshop is an .8LI
file (photoshop plugin) that lives under the Program Files\Adobe\Photoshop
[ver]. The plugin gets properly registered and is available in the
references list as Adobe Photoshop [ver] Object Library. But they both use
the generic name 'Photoshop.Application.' The libraries are similar enough
that I can program for either library. I would think that I can compile
with either version and if a user has the other version, it would find it,
because it has the same name (I cannot set a reference to both -- same
name). But it can't find it for some reason... These are the options I
think I have right now, but I get stuck in each instance:

OPTION 1
don't set reference and use CreateObject instead. I guess this would enable
having one compiled app work for both PS versions BUT...
1. I dim other object for example psDoc as Photoshop.document, I (think) I
can dim these as variants, right?
2. This is the one I can't get around, I use the enum in my programming,
i.e.:
Dim extType As Photoshop.PsExtensionType
extType = psUppercase
I would have to go through and recreate all the global enums (correct
term?) manually -- OR -- is there some kind of DEFINES file I can include?

OPTION 2
Set reference to 7.0 Object Library -- Compile -- then change reference to
8.0 Object library -- compile another version and selectively install the
correct version.

My problem here is this... I have 7.0 and CS installed on the programming
machine. (I installed 7.0 AFTER CS - don't know if that's the problem). I go
to references and unCheck 8.0, click OK, go Back to references and Check 7.0
Object library and click OK. If I know go back to the references dialog, it
seems to have automatically changed the reference back to 8.0... Why is
that? This is now STOPPING me from compiling a version for 7.0?

Can anyone shed some light for me here? Or recommend another forum to ask?

Thanks,

Keith
 
K

Keith Tromer

Eusch,

Yeah... That's what I'm trying to avoid. All the code is written using the
type libraries. And the code will work with either version. Manually
setting all thouse constants is really not an option. Would be easier to
just compile separate versions. (as I'm doing now). What I don't understand
is why when I set a reference to version 7 library, it automatically changes
it to version 8. This make me HAVE to compile the older version on another
computer :-(

Any ideas for that?

Keith


Eusch said:
I had the same kind of problem once with automating Outlook. On my machine
I used Outlook from office 2002 and my customer had outlook shipped with
office 97. The key to your solution is late binding. This implies one of the
solutions you decribed earlier: dim application as object set object =
createobject(). There is however the drawback of using constants. You'll
need to define them yourself because you have got to get rid of any
reference to the type libraries in order to work with both versions.
Hope this helps.

Keith Tromer said:
Hi,

I have a COM add-in that uses (and sets references) to other libraries. The
one causing me issues is Photoshop scripting. I can set references just
fine. My problem is I am trying to make the addin work for both versions 7
and 8 (CS) of Photoshop. The scripting pluging for Photoshop is an .8LI
file (photoshop plugin) that lives under the Program Files\Adobe\Photoshop
[ver]. The plugin gets properly registered and is available in the
references list as Adobe Photoshop [ver] Object Library. But they both use
the generic name 'Photoshop.Application.' The libraries are similar enough
that I can program for either library. I would think that I can compile
with either version and if a user has the other version, it would find it,
because it has the same name (I cannot set a reference to both -- same
name). But it can't find it for some reason... These are the options I
think I have right now, but I get stuck in each instance:

OPTION 1
don't set reference and use CreateObject instead. I guess this would enable
having one compiled app work for both PS versions BUT...
1. I dim other object for example psDoc as Photoshop.document, I (think) I
can dim these as variants, right?
2. This is the one I can't get around, I use the enum in my programming,
i.e.:
Dim extType As Photoshop.PsExtensionType
extType = psUppercase
I would have to go through and recreate all the global enums (correct
term?) manually -- OR -- is there some kind of DEFINES file I can include?

OPTION 2
Set reference to 7.0 Object Library -- Compile -- then change reference to
8.0 Object library -- compile another version and selectively install the
correct version.

My problem here is this... I have 7.0 and CS installed on the programming
machine. (I installed 7.0 AFTER CS - don't know if that's the problem). I go
to references and unCheck 8.0, click OK, go Back to references and Check 7.0
Object library and click OK. If I know go back to the references dialog, it
seems to have automatically changed the reference back to 8.0... Why is
that? This is now STOPPING me from compiling a version for 7.0?

Can anyone shed some light for me here? Or recommend another forum to ask?

Thanks,

Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top