Need Windows $PATH to call from Adobe Bridge

Started by Lumigraphics, February 28, 2023, 11:31:40 AM

Previous topic - Next topic

Lumigraphics

Hi, I'm a working pro photographer and semi-amateur developer. I've been delving into exiftool to solve some issues with Bridge's (in)ability to properly edit XMP data.

I'm calling exiftool with the Bridge app.system() command, which will run command line apps. I've got it working pretty well so far but have one problem on Windows, making sure that exiftool is in the Windows $PATH. On the Mac I can just use the standard installer and location.

Users may not be admins and may not be willing or able to move exiftool.exe into the C:\Windows directory or add a $PATH variable on their machine.

My question is how to work around this problem? Should I have the user locate exiftool.exe on first run? Something else?

If anyone wants to see what I'm working on, I publish the Utility Script Pack for Bridge and some other Bridge/Photoshop utility scripts. Look for "EXIFInfo.jsx" and "Strip EXIF.jsx" on Dropbox:

https://www.dropbox.com/sh/mg817g9a9ymbasi/AADTmXUVxmFfM58bcyYE7yiwa?dl=0

Phil Harvey

One alternative is to package ExifTool with your software and install it in your preferred location when the user installs your software.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

obetz

Quote from: Lumigraphics on February 28, 2023, 11:31:40 AMUsers may not be admins and may not be willing or able to move exiftool.exe into the C:\Windows directory

they shouldn't! %Systemroot% (c:\Windows) is not intended to hold user programs.

Quote from: Lumigraphics on February 28, 2023, 11:31:40 AMadd a $PATH variable on their machine.

My installer can add exiftool to the path. It's mentioned on exiftool.org as "alternate ExifTool Windows installer" -> https://oliverbetz.de/pages/Artikel/ExifTool-for-Windows

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Lumigraphics

Thank you for the quick replies!

I'm just distributing small cross-platform javascripts in plain text format, that are installed manually. So there is no installer on my end.

An alternative installer might work ok, but I can't get into supporting exiftool beyond pointing people here and saying "go install it."

I'd love to see a feature where exiftool would offer to add its folder on first run to the Windows $PATH.
setx PATH "%PATH%;<path to enclosing folder>" appears to be the supported way to do this.

StarGeek

I was looking into how to set add to a PATH from a batch file a while back and there's a big problem trying to use setx in this way.  If the path contains any environment variables, such as %PROGRAMFILES% or %APPDATA%, then those are expanded to the actual directory names and the ENV variable is lost.

Trying to find some of the details I was originally looking at, I also came across a post that said using setx will truncate the path to 1,024 characters.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

obetz

Quote from: Lumigraphics on February 28, 2023, 02:20:04 PMAn alternative installer might work ok, but I can't get into supporting exiftool beyond pointing people here and saying "go install it."

That's what my installer does: Unless the user changes the defaults, it will add ExifTool to the path and create an uninstaller.

It's based on Inno Setup and also removes the path entry on uninstall.

Just tell the user to use the defaults of the installer.

Lumigraphics

If I know exactly where the exe file is located, PATH isn't really needed because I can hardcode the location or just cd to that directory before calling it.
I think I'll recommend the alternate installer and leave it to the user to get it straightened out.