Proposal for a robust and simple Windows version

Started by obetz, May 16, 2019, 07:23:36 AM

Previous topic - Next topic

obetz

Quote from: mpegleg on June 20, 2019, 05:36:47 AM
Is this what would get installed with Phil's regular exiftool(-k).exe file anyway after it was run the first time, but together with a helpful installer to help the n00bies get the first-time install done correctly?

Or, is this the full ExifTool Perl package, for those users who already have Perl installed on their Windows pc. I don't have Perl, nor can I program it.

Neither of them. It is Perl (portable) bundled with ExifTool (source distribution).

The main difference between the Windows Executable you get from https://exiftool.org/ and my package is that I don't use the PAR pp packer, therefore avoid Potential PAR pp problems already mentioned.

The exe generated by PAR/pp is a self-extracting archive, unpacking ExifTool + Perl (hundreds of files) silently to %temp% during the first call.

In contrast, my package allows the user to unpack all files to a directory of his choice (before the first run, of course).

Anther difference is the way Perl is called:

pp has a two-stage calling process, this means exiftool(...).exe spawns a second process (exe in temp dir). For this spawn, it needs to mangle the command line arguments, set environment variables, execute a 20kb perl one-liner (too complicated for me to understand completely) etc.

In contrast, my Perl launcher (52 kb small ExifTool.exe in the archive) uses exactly the same code as the original Perl.exe from the Perl distribution. I just set the DLL search path and insert exiftool.pl as first argument. Only a few dozen lines of C code including error checking.

I think that's the simplest and cleanest way possible to run ExifTool in a windows environment.

Oliver

mpegleg

#16
O.k. You kind of lost me after the first PAR/pp bit. But that's cool. I don't think I'm your intended target for this discussion anyway, so I'll melt away into the background and lurk as I do, and watch the discussion unfold with all you very clever people.

But do let me know when you have it all working, and I'll give it a rip.  :)
OS: Windows 11 Pro

obetz

the only challenge is to extract the zip archive to a place of your choice

obetz

Now I tried Inno Setup. Didn't help much against false positives, but the installer is interesting since it allows to chose "install for me" or "install for all" (requesting administrative rights) out of the box.

My demo automatically sets a suitable directory (program files for "all" and localappdata for "me") then.

In addition, the user can select whether to add ExifTool to the path and whether to have an uninstaller and an entry in the add/remove panel.

Anybody willing to try it?

https://oliverbetz.de/exiftool_install_11.52_Inno.exe the new Inno Setup based installer
https://oliverbetz.de/exiftool_install_11.52_NSIS.exe the NSIS based installer with less options

The installer sources are attached to this posting.

I tested them thoroughly, but since they modify the registry (add/remove path and uninstaller), use at your own risk.

About false positives: This is a well known problem for both Inno Setup and NSIS, caused by crappy antivirus products and malware being packed with NSIS or Inno. The not so experienced user might be scared if he uses virustotal and gets false positives from dumb scanners.

Windows SmartScreen might be another annoyance. Signing with a free certificate (e.g. https://www.globalsign.com/en/ssl/ssl-open-source/ ) could help. But a good reputation can also be gained by a large number of downlads as exiftool.exe demonstrates.

Oliver

Phil Harvey

Very nice!  I ran both installers and uninstallers.  They worked very well, but I liked the Inno interface better.

The Inno install put ExifTool in \Users\MyName\AppData\Local\Programs, while the NSIS install put it one level up (in Local).  Any reason for this difference?

I ran some basic tests, but it is not possible for me to test for compatibility with all of the many ways that people are using ExifTool out there, so introducing this type of installer means that I would have to prepare two Windows versions for each release, at least for a while, so people can fall back to the old version if this doesn't work for them.

How difficult is it to prepare the install package?  Currently I have the whole release process scripted to make it very easy for me, and in Windows I just type two commands, hit the return key and click the mouse about 3 times and that's it.

- 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 ($).

Hayo Baan

From experience with NSIS, the installer creation is fully automatic. Heck, you can even create a Windows installer under Linux (iirc including Mac). Very handy.
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

Also, I would have to figure out how to change the install to allow the drag-and-drop features of exiftool(-k).exe, since many people use ExifTool without the command line.

- 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: Phil Harvey on June 21, 2019, 09:30:28 AM
Very nice!  I ran both installers and uninstallers.  They worked very well, but I liked the Inno interface better.
Yes, also my opinion.

NSIS has also a modern layout but I was too lazy to investigate it.

Quote from: Phil Harvey on June 21, 2019, 09:30:28 AM
The Inno install put ExifTool in \Users\MyName\AppData\Local\Programs, while the NSIS install put it one level up (in Local).  Any reason for this difference?
When I made the NSIS script, I wasn't aware of the Programs directory. I just knew that Google Chrome installed to %localappdata%\Google\Chrome\Application\ so I did the same.

Inno Setup has an automatic constant/variable pointing to %localappdata%\Programs for non-admin installs, and the docs state that this is the way to go.

Quote from: Phil Harvey on June 21, 2019, 09:30:28 AM
How difficult is it to prepare the install package?  Currently I have the whole release process scripted to make it very easy for me, and in Windows I just type two commands, hit the return key and click the mouse about 3 times and that's it.

There are 2..3 steps depending on your expectations:

0. Make a exiftool.exe launcher with version information. This is only needed if you want exiftool.exe to reflect the version. Update the resource file and run the compiler / make.

BTW: It's pretty easy to incorporate an icon in the exiftool.exe. May I use your favicon for my demonstration?

1. Prepare the files to be packed. You can use pp and unpack it with the cmd file I provided, but I preferred to copy the unmangled files from Strawberry Perl and Exiftool.

The Perl part is rather static (unless you need new modules), so it needs to prepared very seldom.

The ExifTool files are simple merged / copied to the Perl files.

I will open a new thread about the Windows specific version.

2. Run Inno Setup or NSIS. I didn't yet look at the mechanism to get the version information fed to the installer. It might be possible to use command line arguments, else a config file has to be created and included be the installer script.

Quote from: Phil Harvey on June 21, 2019, 10:23:08 AM
Also, I would have to figure out how to change the install to allow the drag-and-drop features of exiftool(-k).exe, since many people use ExifTool without the command line.

This is still working with my package. Just rename the exe as ever and the parameters should be used. The quick hack I made ($^X instead of $0) can be made cleaner.

Since the exe is so small, making copies with different parameters is cheaper than ever.

But Inno Setup allows even more sophisticated things. I didn't check this in detail, but as far as I see, you can create Windows links wherever you want.

For example, it should be possible to but a link to ExifTool in the Sendto directory, adding some parameters (-k).

I consider links the better way to pass parameters to ExifTool. If people have a working example to be modified, they should understand the method.

Oliver

allsan8

I tried the Inno install.  Straightforward.  No surprises.

First test:

Windows 7 (64-bit), only one account on this computer, an Admin account:  Installed for only the user into a folder I created in my Portables folder structure, installed everything, took all the defaults.  I noted the path was entered under User variables for ....

I opened a command prompt in a folder on another drive and entered exiftool -all= *.jpg.  Didn't work.  I thought it should, but I might be assuming things.

Uninstall.

Second test:

Windows 7 (64-bit), only one account on this computer, an Admin account:  Installed for all users, installed into "C:\Program Files (x86)", installed everything, took all the defaults.

I opened a command prompt in a folder on another drive and entered exiftool -all= *.jpg.  Worked.

ExifToolGUI works.

Next tests will be on a Windows 10 computer with Admin and Restricted accounts.

obetz

thanks for the report!

Quote from: allsan8 on June 22, 2019, 01:43:21 PM
Installed for only the user [...]  I noted the path was entered under User variables for ....

do you consider this unexpected behavior?

IMO "only for me" should write exactly my environment.

Installing "for all" writes the path to HKLM (requires admin privileges).

Of course you can select "for all" and change the installation directory to whatever you consider well suited. The predefined path is just an educated guess what people might want (if they care at all)

I consider improving the texts describing both options.

Quote from: allsan8 on June 22, 2019, 01:43:21 PM
I opened a command prompt in a folder on another drive and entered exiftool -all= *.jpg.  Didn't work.  I thought it should, but I might be assuming things.

Can you elaborate "Didn't work"?

Didn't you get any message?

exiftool -all= *.jpg is somewhat hefty, what's the intention?

allsan8

Quotedo you consider this unexpected behavior?

No.  Just reporting it was there.  Thus, I figured I could perform a command prompt from any folder and it would work and it did not.  I apologize I didn't copy the message when it didn't work, but I am almost sure it is the message I have seen when I haven't had ExifTool in the folder.

QuoteOf course you can select "for all" and change the installation directory to whatever you consider well suited.

Yes.  Saw that, but I took the default, because I thought yeah that is a good place.

Quoteexiftool -all= *.jpg is somewhat hefty, what's the intention?

Strip the metadata.  I use it all the time.


obetz

Quote from: allsan8 on June 22, 2019, 02:53:38 PM
I apologize I didn't copy the message when it didn't work, but I am almost sure it is the message I have seen when I haven't had ExifTool in the folder.

Could it be that you had the command prompt open before the ExifTool was finished and closed?

Win7 doesn't propagate environment changes to running command windows.

Type "set" or "path" in the command window to check whether the path variable is updated.

allsan8

Windows 7 ... I uninstalled the all users install.  Installed this user only.  Installed everything.  Installed in a folder in my portable folder.  Took defaults.

Under Environmental Variables, the location of ExifTool (Value) is included as Path (Variable) in the User variables for "user account" section.  The location of ExifTool (Value) is not included as Path (Variable) in the System variables section.

When I run from a command prompt this is what I get:

'exiftool' is not recognized as an internal or external command,
operable program or batch file.


ExifToolGUI does not work.

obetz

Again:

1. After running the installer, you need to open a new command window. Already running command windows are not updated!

2. Type "path" in the command window and check whether the exiftool path is listed correctly.

If the exiftool path is not propagated to the new command window (strange), you could try to log off and on the user. You don't need to reboot, just log off and on.

But on my W7 systems, it is sufficient to open a new command window.

obetz

just confirmed on "yet another W7" system:

1. Open a command window #1
2. Install ExifTool
3. Command window #1 doesn't have the path added
4. Open a new command window #2. It has the new path

That's what I tried to express two postings earlier, forgive me if I was not clear in my wording.