Need help in setting F4 to open selected files w/ diff apps

When I have selected any image or a psd files and press F4, I want the selected files to be opened with Photoshop

where as if the selected files happens to be of any other type, then they all should be opened with EditPlus.

Please tell me this can be done.

I meant to write: Please tell me how this can be done.

bump

It's possible there is some more simple way that I don't know about, but I imagine you will have to create a script or batch file which tests file type (extension) and invokes the wanted program based on that test. Then assign F4 to the script or batch file.

Right.. I would appreciate if anyone can provide this script code.

I just threw this batch file together in a hurry but it seems to do what you want. You will need to change the path to where the Photoshop is in your computer, and also set the full path to EditPlus (I used the standard Windows Notepad to test).

[code]@echo off
:: Enter image file extensions separated by a space
:: Note the file extensions ARE case sensitive!
set IMGS=.psd .PSD .jpg .JPG .gif .GIF .png .PNG .bmp .BMP .tif .TIF

:: Full path to Photoshop
set P=C:\Program Files\Adobe\Adobe Photoshop CS3\Photoshop.exe

:: Full path to EditPlus
set E=C:\WINDOWS\system32\notepad.exe

for %%A in (%IMGS%) do (
if "%~x1" == "%%A" (
"%P%" "%~1"
set T=on
exit
)
)

if not defined T "%E%" "%~1"[/code]

You can add or delete image types as desired, but note the file extension types are case sensitive because I'm using the FOR iterator command in the script. To use this script save it with a name you like (in my test, I called it test.cmd) and call it with an Opus button command something like this:

"D:\Mine\cmd\Test.cmd" {f}

Thanks JohnZeman. It works.

A command prompt window quickly appears and disappears when the above is run.

So I modified it like so to suppress the prompt:

"C:\Program Files\FindAndRunRobot\AliasGroups\Installed\nircmd\nircmd.exe" execmd C:\sridhar\OpenWith.cmd {f}

You can add a line with @runmode hide to the top of the Opus button to suppress the command prompt.

(Might have to set the button's function type to MS-DOS as well; not sure off the top of my head.)