Page 1 of 1

How to prevent "External Editor" from launching a new editor

PostPosted: Tue Sep 14, 2010 2:44 pm
by kleist
Hello all FastPictureViewer users,

I've recently found this highly useful and extremely well crafted tool. However, I found it somewhat limiting that the "External Editor" function always opens a new instance of my preferred photo editor "COREL Photo-Paint X4" (which seemingly can't be configured to prevent multiple instances). After much experimentation I've finally found a solution, which I'd like to share.

The solution consists of three parts:

1. A registry modification which adds an "Edit" action to the context menu for .jpg files in Windows Explorer. This action opens the image in Photo-Paint, after starting it if necessary.

2. An old style batch file, called by FPV.

3. A Windows PowerShell script, called by the batch file, which uses DDE to open the image in Photo-Paint.

The reason for the intermediate batch file is, that by default a PowerShell opens with Notepad (which is a good thing, from a security perspective). The batch file is executed, however, which is what we want.

The following code works on my Windows 7 computer for .jpg files and Photo-Paint, but should also work on your computer for other file types and editors after some fiddling.

1. Create three new Registry keys:
Code: Select all
    "D:\local\Corel\CorelDRAW-Graphics-Suite-X4\Programs\CorelPP.exe" -DDE

2. The batch file "pp.bat", which is launched from FastPictureViewer by pressing ctrl+F1:
Code: Select all
ECHO Opening image in COREL Photo-Paint...
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe E:\etc\powershell-home\scripts\pp.ps1 %1

3. The PowerShell script:
Code: Select all
# this uses DDE, so if Photo-Paint is already running the image will be opened there
start-process -verb edit $args[0]

I'm looking forward to being able to buy a full license, and the codec pack!

Re: How to prevent "External Editor" from launching a new ed

PostPosted: Tue Sep 14, 2010 8:18 pm
by Axel
Good tip!

Indeed the program launcher does a simple job of starting the designated program with the selected file as argument.

Old (and very old) applications used to use the DDE protocol to talk to running instances and DDE verbs used to be implemented to open a new document in an already running instance of a program.

Using an intermediate script to launch and open the document for editing in a running PhotoPaint is a neat idea 8-)

Re: How to prevent "External Editor" from launching a new ed

PostPosted: Thu Sep 30, 2010 8:40 pm
by kleist
An enhancement of "pp.bat", the "-file" option makes PowerShell handling also filenames containing spaces:
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -file E:\etc\powershell-home\scripts\pp.ps1 %1