Re: Image viewing - a different approach
- From: Glenn Jackman <glennj@xxxxxx>
- Date: 22 Jan 2008 18:47:53 GMT
At 2008-01-22 12:49PM, "ZB" wrote:
And I'm looking for more general, and - at the same time - "automatic"
solution. If one could make such "shortcut", one can then rely just on the
OS's default file associations. Wouldn't it be smarter? And you don't care,
what kind of file it is: whether it is JPG-image, or PDF-doc, or just plain
TXT-file - all the needed viewers are launched by OS, where some
associations (hopefully) have been made already.
Here's one approach (untested):
namespace eval launch {
switch -glob -- $::tcl_platform(os) {
Darwin { set start_cmd open }
"Windows *" { set start_cmd start }
default {
# need more expertise here...
error "don't know how to launch a file on os $::tcl_platform(os)"
}
}
variable launch_cmd [auto_exe*** $start_cmd]
}
proc launch::file {filename} {
variable launch_cmd
eval exec [list $launch_cmd $filename &]
}
launch::file myimg.jpg
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
.
- Follow-Ups:
- Re: Image viewing - a different approach
- From: Andreas Wilm
- Re: Image viewing - a different approach
- From: ZB
- Re: Image viewing - a different approach
- References:
- Image viewing - a different approach
- From: ZB
- Re: Image viewing - a different approach
- From: Larry W. Virden
- Re: Image viewing - a different approach
- From: ZB
- Image viewing - a different approach
- Prev by Date: Re: Portbale package for reading / displaying JPEG images
- Next by Date: Re: Image viewing - a different approach
- Previous by thread: Re: Image viewing - a different approach
- Next by thread: Re: Image viewing - a different approach
- Index(es):