• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to start a particular version of Photoshop when multiple versions are installed

New Here ,
Dec 10, 2010 Dec 10, 2010

Copy link to clipboard

Copied

I have written a small software that automates a few functions in PS CS2.

Till now it was working just fine with PS CS2. Now due to some unknow reasons the client has installed CS 4 and CS 5.

Now my clinet want that the software should be able to detect all installed version of PS and allow him as user to choose as to with which version of PS my software should automate.

Is this possible?

If yes and how to achieve it?

Oh! I have also abserved an unusual behaviour. I don't know whether it is because of my software or because of PS.

By default when my software executs this automation script (generated using Script listner)

Rem =======================================================
  Dim objApp
  Set objApp = CreateObject("Photoshop.Application")
  Rem Use dialog mode 3 for show no dialogs
  Dim dialogMode
  dialogMode = 3
  Dim id11
  id11 = objApp.CharIDToTypeID("setd")
      Dim desc3
      Set desc3 = CreateObject("Photoshop.ActionDescriptor")
      Dim id12
      id12 = objApp.CharIDToTypeID("null")
          Dim ref2
          Set ref2 = CreateObject("Photoshop.ActionReference")
          Dim id13
          id13 = objApp.CharIDToTypeID("Prpr")
          Dim id14
          id14 = objApp.CharIDToTypeID("GnrP")
          Call ref2.PutProperty(id13, id14)
          Dim id15
          id15 = objApp.CharIDToTypeID("capp")
          Dim id16
          id16 = objApp.CharIDToTypeID("Ordn")
          Dim id17
          id17 = objApp.CharIDToTypeID("Trgt")
          Call ref2.PutEnumerated(id15, id16, id17)
      Call desc3.PutReference(id12, ref2)
      Dim id18
      id18 = objApp.CharIDToTypeID("T   ")
          Dim desc4
          Set desc4 = CreateObject("Photoshop.ActionDescriptor")
          Dim id19
          id19 = objApp.CharIDToTypeID("HsSt")
          Call desc4.PutInteger(id19, 1)
      Dim id20
      id20 = objApp.CharIDToTypeID("GnrP")
      Call desc3.PutObject(id18, id20, desc4)
  Call objApp.ExecuteAction(id11, desc3, dialogMode)
  Call SetUndoTo1CS3

It will automatically start that version of PS which was last running before the system was shut down.

Let me try an explain this in a different way:

To get my software to talk to a particular version of PS I have to perform the following steps:

  • Start that version of PS in I am interested
  • Open a file and save is under a different name
  • Close PS
  • Restart my PC

After performing all these steps when my software automates PS that version of PS will start which was last run.

Any idea as to what is going on?

Please help me solve this problem.

TOPICS
Actions and scripting

Views

3.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Dec 14, 2010 Dec 14, 2010

Ok, this editor is really lame. Hopefully this turns out when I press save!

Dim wsh

Dim pathToExe

Set wsh = CreateObject( "WScript.Shell" )

pat

hToExe = wsh.RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Photoshop\12.0\ApplicationPath\" )

if Len(pathToExe) = 0 then

WScript.Echo "You don't appear to have CS5 installed"

else

WScript.Echo "default app is here: " & pathToExe

end if

Votes

Translate

Translate
Adobe
Community Expert ,
Dec 11, 2010 Dec 11, 2010

Copy link to clipboard

Copied

How I address this problem is to install my photoshop scripts in a folder outside of photoshop install tree.  Scripts can be run from any place. To have Photoshop list my script in menu File>Scripts>Names I place a shortcut/link to my script tree into  all Adobe Photoshop install trees Version\Presets\Scripts.  I ran into an additional problem when I install a new machine which runs Windows 7 Professional 64 bit.  Adobe installs two versions of CS5 a 64bit version and a 32bit version one get installed into "Program Files\Adobe\version"  and the other installs into "Progam Files (x86)\Adobe\version"  The problem I ran into was the place I had always installed my scripts was "C:\Program Files\Adobe\Adobe Photoshop Scripts"  This is not a folder created by Adobe it one I have created.  When I put the Shortcut/Link yo it into the 32bit version of CS5 somehow the like resolves to "C:\Program Files (x86)\Adobe\Adobe Photoshop Scripts" for this new system I moved my script to "C:\Program Files (32)\Adobe\Adobe Photoshop Scripts" for the 64bit version of Photoshop has no problem when the shortcut/link I place into it is "C:\Program Files (x86)\Adobe\Adobe Photoshop Scripts'' it does not add or drop the (x86)"  That required the actions run my script have the script steps rerecorded. 

The net result is I have one version of my scripts a single script file per script and all installed versions of Phrotoshop use the same files.

Photoshop versions are started from the versions shortcit fro the start menu. Only one version of Photoshop can be running at an single time.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 13, 2010 Dec 13, 2010

Copy link to clipboard

Copied

It seem either you have mis understood what I want or I am not able to explain my problem properly. .

Let me try and explaing again briefly.

I have developed a software in VB6. This is a compiled executable program. It is not in JSX or VBS (text) format. My client want me to add facility to detect all installed version of PS and then allow a user to select a particular version. Once a user selectes a version That version of PS should automatically get started and all the scripts that are compiled in my program should then run against that PS instance.

Thank you,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 13, 2010 Dec 13, 2010

Copy link to clipboard

Copied

The answer is somewhat easy until you start talking about launching 32 or 64! When you call CreateObject you specify which version you want. Most of the time you want the current version so you say "Photoshop.Application". But you can say "Photoshop.Application.11" for CS4 or .12 for CS5. You could look in the registry to see which keys are present and pose a question to your user.

--------------- 32 and 64 bit fun ---------------------

If you are on a 64 bit OS you have two versions of Photoshop installed beginning with CS4. If your application is a 64 bit application and you are the correct user you can see into both the 64 bit registry and the 32 bit registry. If you are a 32 bit application you only see the 32 bit side of the registry.

What I do is run my VBScripts via the cscript application and I launch cscript in either 32 or 64 bit mode.

Here is my test:

Launch 32 bit version of photoshop via cscript in 32 bit mode and specify the version:

E:\h:\windows\SysWOW64\cscript \files\VBScripts\TestLaunch10.vbs 11
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Trying to launch Photoshop.Application.11
DOM library
11.0.2
H:\Program Files (x86)\Adobe\Adobe Photoshop CS4\
Done

Launch 64 bit version:

E:\cscript \files\VBScripts\TestLaunch10.vbs 11
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Trying to launch Photoshop.Application.11
DOM library
11.0.2
H:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\
Done

You can see from the path that the correct version is launched.

Here is a snippet of the code...

appName = "Photoshop.Application." & vString

Set app = CreateObject(appName)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 13, 2010 Dec 13, 2010

Copy link to clipboard

Copied

Thanks for hint. You solved part of my problem.

I did not know that we can specify version number at end while creating object.

Now how can I retrive list of all those versions of PS installed on PC? I mean which Reg keys do I have to check and will I be able to do this from a User account which is having limited rights?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 14, 2010 Dec 14, 2010

Copy link to clipboard

Copied

Ok, this editor is really lame. Hopefully this turns out when I press save!

Dim wsh

Dim pathToExe

Set wsh = CreateObject( "WScript.Shell" )

pat

hToExe = wsh.RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Photoshop\12.0\ApplicationPath\" )

if Len(pathToExe) = 0 then

WScript.Echo "You don't appear to have CS5 installed"

else

WScript.Echo "default app is here: " & pathToExe

end if

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 15, 2010 Dec 15, 2010

Copy link to clipboard

Copied

LATEST

Tom,

Thanks for your help.

Your suggested solution works like a charm with a few modifications. I will still test in different user accounts and see how it works.

But there is a fix here again.

If I use your solution I have to make provisions for all versions of PS that are released till date, in my code. This means that if your company will  release a new version of PS (in near future) I will have to again modify my code and send  update to my customer. Instead of doing this can we make the whole  thing time proof!

By time proof I mean can we code in such as way that we can  automatically detect and handle all future versions of PS as and when  released in future? Just my thoughts on this.


Regards,

Yogi Yang

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines