Adobe Extension manager script

Bendelaat
New Contributor II

Hi Guys,

I'm trying to make a script to install/ update a Photoshop CC extension trough the appropriate command line tool.
i made an if statement to test if it is installed but somehow it doesn't work.

Who can give me a pointer, i'm going crazy here.

if [ "./ExManCmd --list 'Photoshop CC' | grep PNGExpress | awk '{print $2}'" == "PNGExpress" ]; then
2 REPLIES 2

mm2270
Legendary Contributor III

Three things.

First, though I don't know exactly where the command or binary lives that you're trying to use, it looks like your script is assuming its in the working directory from where the script is running, which is unlikely to be the case. You're probably going to need to put the full path to it in there.

Second, you need to enclose the command in either back ticks or use the $(…) method. The way it is now you're telling the script that the whole thing is a string and not a command to run, which will fail.

Third, you need to use double brackets for something like this since you're asking it to run a command within the test.

So, again, not 100% sure where that ExManCmd tool lives since I don't use Adobe CC, but a quick Google search pointed me to possible the location of "/Applications/Adobe Extension Manager CC.app/Contents/MacOS/ExManCmd" Assuming for a moment that's the one, you would need to do something like this:

if [[ $(/Applications/Adobe Extension Manager CC.app/Contents/MacOS/ExManCmd --list 'Photoshop CC' | grep PNGExpress | awk '{print $2}') == "PNGExpress" ]]; then

You can try that. Adjust that if I got the path wrong.

Bendelaat
New Contributor II

@mm2270][/url][/url, Mike thanks for the feedback, i eventually struggled my way trough. for good measures i'll add the completed script here, hopefully it is of use to people looking to install, upgrade Adobe Extensions.

#!/bin/bash

## Set Variables
## global
Packagedir=/usr/local
Package=PNG Express.zxp
PackageName=PNGExpress

## CS6
WORKDIRCS6="/Applications/Adobe Extension Manager CS6/Adobe Extension Manager CS6.app/Contents/MacOS"
EXTMANCS6=Adobe Extension Manager CS6

## CC
WORKDIRCC="/Applications/Adobe Extension Manager CC/Adobe Extension Manager CC.app/Contents/MacOS"
EXTMANCC=ExManCmd
## 


## Check Adobe Suite Version
############################

    ## if version is CC
    ###################
if [ -d "$WORKDIRCC" ]; then
    APPLICATION="Photoshop CC"
    echo "Application version = $APPLICATION"
    echo ""
    cd "$WORKDIRCC"
    #echo "Working directory = $WORKDIRCC"
    echo ""

        ## Check if an older version is installed and update if need be
        ###############################################################
    printf "Checking if an older PNGExpress Package is installed
"
    ex=$(./ExManCmd --list "Photoshop CC" | grep PNGExpress | awk '{print $2}')
     if [ $ex == "PNGExpress" ]; then
        echo "$ex is installed, upgrading existing extension"
        ./"$EXTMANCC" --update $PackageName
        echo "Extension upgraded"

    else
        ## Install new version
        ######################
    printf "Installing PNGExpress for the first time
"
    ./"$EXTMANCC" --install "$Packagedir"'/'"$Package"
    fi

    ## if version is CS6
    ####################
 elif [ -d "$WORKDIRCS6" ]; then
    APPLICATION="Photoshop CS6"
    echo "Application version = $APPLICATION"
    echo ""
    cd "$WORKDIRCS6"
    echo "Working directory = $WORKDIRCS6"
    echo ""

        ## No update function in CS6 binary, thus always removing and reinstalling

        ## Remove PNGexpress
        ####################
    printf "Removing old PNGExpress Package if it exists
"
    ./Adobe Extension Manager CS6 -suppress -remove product="$APPLICATION" extension="$PackageName" 

        ## Install new version
        ######################
    printf "Installing PNGExpress
"
    ./Adobe Extension Manager CS6 -suppress -install zxp="$Packagedir"'/'"$Package"


    ## If no version is detected
 else 
    echo "Photoshop Not installed, Noting to do"
fi



## remove the file from /usr/local/ to keep it clean
####################################################

cd "$Packagedir"
rm "$Package"
exit 0

feel free to give additional pointers that improve the script/ my scripting skills ;)