I want files ending in .fw.png
to open in Adobe Fireworks but I want regular .png
files to open in my standard image viewer program.
Is this possible?
I want files ending in .fw.png
to open in Adobe Fireworks but I want regular .png
files to open in my standard image viewer program.
Is this possible?
Using an AutoIt script, the following should perform what you want:
$FIREWORKS = "C:/Program Files/Fireworks.exe"
$NORMALVWR = "C:/WindowsPictureViewer.exe"
If $CmdLine[0] > 0 Then
$toRun = ""
$fExt = StringRight($CmdLine[1], 7)
; First, we set $toRun as the proper target program to run.
If StringLen($CmdLine[1]) >= 7 And _
StringRight($fExt, 4) = ".png" And _
StringLeft(StringRight($fExt, 7), 3) = ".fw" Then
$toRun = $FIREWORKS
Else
$toRun = $NORMALVWR
EndIf
; Next, we append all command line arguments (with a space before each one).
For $i = 1 To $CmdLine[0]
$toRun &= ' "' & $CmdLine[$i] & '"' ; We surround each with quotation marks.
Next
; Finally, run the command in the current working directory.
Run($toRun, @WorkingDir)
; Since the Run() function is asynchronous, this program should close right after.
EndIf
To make this work for your case, you'll need to change those constants up at the top to the proper executables you want to launch. Then, install AutoIt, and compile the script to a .EXE file. Place it in a convent location, and set Windows to open .PNG files with this executable.
I haven't tested this code yet, but it looks like it should work fine. Just for your reference, the compiled program will do the following:
Check if the first argument (if it exists) ends in .fw.png (it is assumed you only run the executable with a .PNG to begin with). If so, the Fireworks executable is launched, otherwise, the normal viewer is launched.
All of the command line arguments are then added again as arguments to the respective application.
The application is called via the AutoIt Run()
function, in the current working directory.
If enough people are interested, I can create a full program to do this for any arbitrary set of (nested) file extensions.