Copy link to clipboard
Copied
I know one way to restart Lightroom (with specified catalog), however preferences are not saved:
Win: lightroom.exe -restart {catalog}
Mac: open {catalog}
However sometimes (usually) it would be better if preferences were saved on the way out.
PS - I can exit Lightroom with preferences saved by stuffing the keyboard (Alt/Cmd-FX), but how to get it to startup again (with specified catalog).
Any ideas?
Rob
Thanks John - big time !
I got it working with bat:
taskkill /im lightroom.exe /t
lightroom.exe catalog
Notes:
* /t was necessary
* -restart must be omitted.
Actual text of bat file:
taskkill /im lightroom.exe /t "C:\Program Files\Adobe\Adobe Photoshop Lightroom 5.2\lightroom.exe" %1
A big thanks again to John - you're my hero .
Rob
Copy link to clipboard
Copied
Before invoking those commands to start LR on a catalog, politely terminate the application:
Windows: taskkill /im lightroom.exe
Mac: osascript -e 'tell application "Adobe Photoshop LIghtroom 5" to quit'
These send a "quit" event to the application. A quickie experiment indicates that LR does indeed save its preferences before terminating, but you should definitely test it more thoroughly.
(I knew the Windows solution immediately, but had to Google the Mac one after discovering the Unix "kill pid" isn't trapped by Mac apps.)
If you're invoking these as shell scripts from a plugin, I think you might have to do some more magic to ensure that the shell script doesn't terminate immediately after it kills its parent (the LR process). On Windows, I think (but not positive) the following would work:
start killandrestart.bat
On Unix, I think the magic is:
nohup killandrestart.sh &
but I haven't tried it on Mac OS.
Copy link to clipboard
Copied
John R. Ellis wrote:
Windows: taskkill /im lightroom.exe
I tried this, but then the command to restart seems to fall on deaf ears (issued via plugin, not a .bat file) - it terminates with prefs saved alright, but then doesn't start back up. - hmm...
Copy link to clipboard
Copied
Yeah, I didn't explain my thoughts too clearly. I think you have to write a batch file killandrestart.bat that contains:
taskkill /im lightroom.exe
lightroom.exe -restart catalog
and you may have to run that batch file from the plugin using the command line:
start killandstart.bat
Otherwise, the "taskkill" might kill LR, and thus its child processes, including the CMD.EXE running killandrestart.bat, before the restart of LR is executed.
Copy link to clipboard
Copied
Thanks John - big time !
I got it working with bat:
taskkill /im lightroom.exe /t
lightroom.exe catalog
Notes:
* /t was necessary
* -restart must be omitted.
Actual text of bat file:
taskkill /im lightroom.exe /t "C:\Program Files\Adobe\Adobe Photoshop Lightroom 5.2\lightroom.exe" %1
A big thanks again to John - you're my hero .
Rob
Copy link to clipboard
Copied
Did you send up having to use
start killandstart.bat
or was it sufficient simply to run "killandstart.bat" directly from LR?
Copy link to clipboard
Copied
I didn't need the "start", but I didn't try it with start - that might not be a bad idea - maybe keep the "dos" command window from staying open? I'll try it later and report back..
Copy link to clipboard
Copied
start killandstart.bat
will hopefully work. If it doesn't you might want to try:
start cmd /c killandstart.bat
in case that has better luck.
Matt
Copy link to clipboard
Copied
Thanks Matt,
Worth noting: the bat file (whose contents I posted above) does NOT work to restart with same catalog, only if catalog is different. That's fine for my current purpose, but some tweaking would be needed for restarting with same catalog (maybe put the -restart back in??).
I didn't need the start or start cmd, and now that it's working have gone on to other things - I may revisit in future, if so I'll post more feedback then.
R