Page 1 of 1

How to set a key to open files with predefined applications?

Posted: 02 Jun 2009 09:16
by srikat
I want to set a hotkey (F4) which when pressed with a file selected should open the selected file with pre-defined applications based on the file extensions.

i.e.,

On press of F4,

*.png to open w/ Photoshop
*.mxml to open w/ EditPlus

The default handlers for these type of files are different from what I want them to open with upon pressing of the hotkey.

Can anyone kindly show me how to do this?

Re: How to set a key to open files with predefined applications?

Posted: 02 Jun 2009 22:08
by Pagat
So you want a png file to be opened with, let's say, Paint if you press "Enter", but with Photoshop if you press "F4"?

Or do you just want to overrule the windows standard handler for png within XY (that's easy with "Portable File Associations").

Re: How to set a key to open files with predefined applications?

Posted: 02 Jun 2009 22:24
by serendipity
srikat wrote:I want to set a hotkey (F4) which when pressed with a file selected should open the selected file with pre-defined applications based on the file extensions.

i.e.,

On press of F4,

*.png to open w/ Photoshop
*.mxml to open w/ EditPlus

The default handlers for these type of files are different from what I want them to open with upon pressing of the hotkey.

Can anyone kindly show me how to do this?
One option would be to goto menu "User | Manage Comands | Run script" and put the below script inside field "Script" and set your F4 to it. And you are good to go.

Code: Select all

//Set the extension of the current item to variable $ext
   $ext = <curext>;
//Match extension with png, if yes open with photoshop, if no go to next
   IF ($ext == png) {
   openwith "c:\Program Files\photoshop\photoshop.exe";
    }
// Match extension with mxml, if yes open with editplus, if not go to next
   ELSEIF ($ext == mxml) {
  openwith "c:\Program Files\editplus\editplus.exe";
   }
//If not png or mxml do nothing and show status message
   ELSE {
   status "Not a .png or .mxml file", , alert;
   }
Note: I am using fictitious paths above, so change them.