Docutil question.

kwoodard
Valued Contributor

I have been using docutil for many years at this point (along with BuildADock). It works great. I am building a new lab and it's a weird setup. Not every computer will have the same versions of software installed (mainly Adobe) for some stupid licensing issues. I'm wondering if there is a way to use wildcards in the docutil script? For example, I have three sets of computers that have either Adobe CC 2023, 2024, or 2025. The software installs are the same, but the version year is different. Rather than make different docks for all the variations in the lab, is there a way to use a wildcard so it puts whichever version of Photoshop onto the dock that is installed onto the computer?

4 REPLIES 4

sdagley
Esteemed Contributor II

@kwoodard Do all of the different years of the Adobe apps have the same bundle ID? (I don't have any Adobe installs handy to check) If so you could use mdfind to find what app is installed by its bundle ID and then feed that to dockutil to create a Dock entry for it. Here's an example that looks for Chrome in the /Applications folder:

#!/bin/zsh

# Utility - List all Google Chrome apps in /Applications
#

AppBundleID="com.google.Chrome"
SearchLocation="/Applications"

# Find all copies of Chrome in the /Applications folder
OIFS=$IFS
IFS=$'\n'
files=($(mdfind -onlyin "$SearchLocation" "kMDItemCFBundleIdentifier == $AppBundleID"))
IFS=$OIFS

# Loop through all found copies
for AppPath in "${files[@]}"
do
	if [[ -e "$AppPath/Contents/Info.plist" ]]; then
  		echo $AppPath
	fi
done

kwoodard
Valued Contributor

My scripting is still pretty terrible...how would I pass the output to docutil? I assume some sort of variable.

sdagley
Esteemed Contributor II

@kwoodard Think of it as an opportunity to improve :-) 

The basic dockutil command to add an item to the Dock is "dockutil --add <path to item>" so if you just wanted to add all items that were found by mdfind in my example above to the Dock you'd replace the 

 

echo $AppPath

 

with

dockutil --add "$AppPath"

 

kwoodard
Valued Contributor

OK, that is kind of what I was thinking of trying later today. Thank you! I will report back if this works.