Home All Groups Group Topic Archive Search About

Executing Adobe script listener code in VB6

Author
7 Jul 2009 6:16 AM
Johan_Stäck
Adobe Photoshop has a tool called "script listener".
When active, this tool will produce VBA code reflecting your actions in
Photoshop.

The idea is then that you can automate tasks by executing the generated
code.

I do this myself quite successfully, but I have one rather irritating
problem.

In my project I have a VB6 program that orchestrates various actions,
including running Photoshop.

Basically, what I do is that I record some (fairly lengthy) actions in
Photoshop. The VBA code is then pasted into VB6 Subs and executed.

However, the VBA code will not compile as-is.
The VBA code typically looks like this:

DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
....
....

In order to get the code to compile and run,  I will typically need to
comment out 53 (or whatever) (all but the first) instances of "DIM
objApp" , "DIM dialogMode" etc.

I wouldn't mind doing this *once* but in reality it is a very repetitive
process.

Is there a way around this problem?
Can I somehow execute the VBA code natively under control of my VB6 program?

Or, can I somehow tell VB6 to live with these errors?

Or, perhaps there is another option that I did not think about?


Tia,

Johan Stäck
Stockholm
Sweden

Author
7 Jul 2009 11:42 AM
jaf
Find & replace.
Find DIM objApp replace with nothing.

John


Show quoteHide quote
"Johan Stäck" <jo***@stack.se> wrote in message news:7bg7hvF22t09vU1@mid.individual.net...
> Adobe Photoshop has a tool called "script listener".
> When active, this tool will produce VBA code reflecting your actions in Photoshop.
>
> The idea is then that you can automate tasks by executing the generated code.
>
> I do this myself quite successfully, but I have one rather irritating problem.
>
> In my project I have a VB6 program that orchestrates various actions, including running Photoshop.
>
> Basically, what I do is that I record some (fairly lengthy) actions in Photoshop. The VBA code is then pasted into VB6 Subs and
> executed.
>
> However, the VBA code will not compile as-is.
> The VBA code typically looks like this:
>
> DIM objApp
> SET objApp = CreateObject("Photoshop.Application")
> REM Use dialog mode 3 for show no dialogs
> DIM dialogMode
> dialogMode = 3
> ...
> ...
>
> In order to get the code to compile and run,  I will typically need to comment out 53 (or whatever) (all but the first) instances
> of "DIM objApp" , "DIM dialogMode" etc.
>
> I wouldn't mind doing this *once* but in reality it is a very repetitive process.
>
> Is there a way around this problem?
> Can I somehow execute the VBA code natively under control of my VB6 program?
>
> Or, can I somehow tell VB6 to live with these errors?
>
> Or, perhaps there is another option that I did not think about?
>
>
> Tia,
>
> Johan Stäck
> Stockholm
> Sweden
Are all your drivers up to date? click for free checkup

Author
7 Jul 2009 12:42 PM
Johan_Stäck
jaf wrote:
>
> Find & replace.
> Find DIM objApp replace with nothing.
>
> John
>
>
>
Well that is what I am doing now.
However, there a number of similar lines that have to be commented out,
(+ some other fixes)
and it makes testing new VBA scripts very time-consuming.

I was hoping that someway I could execute the VBA scripts without
modification.

/Johan

Bookmark and Share