Re: Standard file open/app launch commands for Mac, Win, and X11
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Standard file open/app launch commands for Mac, Win, and X11

From: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
Date: Sat Apr 29 2006 - 18:39:04 CEST

Hi Kevin,

Kevin Walzer writes:
> Windows: eval exec [auto_execok start] myphoto.jpg; [...]

That should be

  eval exec [auto_execok start] [list "" "my photo.jpg"]

a) You need a "" for the "title" argument to START (check out
START/?). Otherwise, when the first argument is quoted, START will
treat that as a title. And the filename will be quoted when it
contains spaces. This is on NT/W2K, I don't know about W9x/Me.

b) You need [list] to offset the [eval] when your you do a) and/or
when your filename contains spaces.

> eval exec [auto_execok start] http://wiki.tcl.tk

See also <http://wiki.tcl.tk/557>.

The easiest on Windows is probably to write or re-use a binary
extension that wraps the ShellExecute API, like the one on
e.g. <http://wiki.tcl.tk/13925>.

> Linux/Unix (Gnome): exec gnome-open myphoto.jpg; exec gnome-open
> http://wiki.tcl.tk
>
> Linux/Unix (KDE): exec "kfmclient exec myphoto.jpg"; exec "kfmclient
> exec http://wiki.tcl.tk"
>
> Linux/Unix (other): tk_getOpenFile ("Please choose the program to open
> this file":)

You might want to look at what the Portland project plans with their
"xdg-utils" <http://portland.freedesktop.org>. They cover the same
ground here.

benny
Received on Sun Apr 30 03:31:43 2006