From: lora on
hello,
is there any trick to programatically get the default editor that is
setup on a particular PC and launch it via TCL and then load a file?

let me know,. Thanks
From: Torsten on
See http://wiki.tcl.tk/557 on how to open a URL in a browser. The approach works with any file type.
In brief it's to use the "start" command under Windows and the "open" command under Unix and Mac OS.
From: Keith on
On Fri, 26 Feb 2010 09:57:49 -0800 (PST), lora <anjela_pat(a)yahoo.com>
wrote:

> hello,
> is there any trick to programatically get the default editor that is
> setup on a particular PC and launch it via TCL and then load a file?
>
> let me know,. Thanks

Lets say you are running XP, Vista or 7
using the start command from exec should start the default program for
files that end with .txt

cmd.exe /c start test.txt

You have to navigate to or provide the full path with forward slashes.

exec cmd.exe /c start "d:/Windowssoftware/test.txt" &

if you use a variable use the eval command

eval exec cmd.exe /c start $var &

in windows use cmd.exe /? from a Start > Run...for all the gory details

you can also bring up web pages using

exec cmd.exe /c start http://www.test.com/ &

In Mac OS X you use the
open
command.
--
Best Regards, Keith
http://home.comcast.net/~kilowattradio/
Tired of Google Groups?
http://home.comcast.net/~kilowattradio/usenet.html
From: keithv on
On Feb 26, 12:57 pm, lora <anjela_...(a)yahoo.com> wrote:
> hello,
> is there any trick to programatically get the default editor that is
> setup on a particular PC and launch it via TCL and then load a file?

The easiest way is to use the command "exec cmd.exe /c yourFile".

For finer control you need to dig into the registry to do the
first get the file type association for a given extension then
to get the application to use for that file type.

For the gory details, check out http://wiki.tcl.tk/9846 (Printing
Text Files under Windows).

Keith

From: Glenn Jackman on
At 2010-02-26 12:57PM, "lora" wrote:
> hello,
> is there any trick to programatically get the default editor that is
> setup on a particular PC and launch it via TCL and then load a file?
>
> let me know,. Thanks

Really to reply to the "keith"s

For Windows particularly:

eval exec [auto_execok start] "" [list $url_or_file &]

The empty string is to set the cmd window title for the start command.
If the url or filename contains a space, Windows will helpfully use the
first space-delimited component as the cmd window title instead of
actually passing the whole thing to 'start'.

--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous