Skip navigation
Currently Being Moderated

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

Dec 10, 2010 10:13 PM

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.

  • JJMack
    5,995 posts
    Jan 9, 2006
    Currently Being Moderated
    Dec 11, 2010 5:01 AM   in reply to yogiyang007

    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.

    Mark as:
  • Currently Being Moderated
    Dec 13, 2010 9:57 AM   in reply to yogiyang007

    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
    H:\Program Files (x86)\Adobe\Adobe Photoshop CS4\

    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
    H:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\


    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)

    Mark as:
  • Currently Being Moderated
    Dec 14, 2010 9:50 AM   in reply to yogiyang007

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

    Dim wsh

    Dim pathToExe

    Set wsh = CreateObject( "WScript.Shell" )



    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"


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

    end if


    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points