[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Launch application with region as a parameter
From: |
twiki |
Subject: |
Re: Launch application with region as a parameter |
Date: |
Tue, 7 Oct 2014 09:54:56 -0700 (PDT) |
User-agent: |
G2/1.0 |
Ok... sorry for my terrible english :-(
I mean the following thing... my text-file is..
...
bla bla bla bla
bla bla bla bla
c:\dira\subdir a\document1.pdf (*)
bla bla bla bla
c:\dirb\subdir b\image.jpg (**)
bla bla bla
...
If i've the cursor on (*)... i want open Adobe Reader
on "c:\dira\subdir a\document1.pdf" and if i've the cursor on (**)...
i want open my Image Viewer on "c:\dirb\subdir b\image.jpg"
Thanks to the suggestions I had found the solution following:
(defun quote-string-for-shell ( string )
"quote-string-for-shell STRING
quote the string with \" for the shell. "
(concat "\"" string "\""))
(defun launch-command-at-point()
"Launch associate application for current thing-at-point string"
(interactive)
(w32-shell-execute "open" "explorer" (quote-string-for-shell (thing-at-point
'line))))
(global-set-key (kbd "<f11>") 'launch-command-at-point)
ThanX!