Using applescript from Tcl/Tk it is easy to open a folder on the
desktop.
Is the same possible from win xp?
What about linux/gnome or linux/kde?
Thanks
Jerry
package require twapi; # See twapi.sf.net
set common [twapi::get_shell_folder csidl_common_desktopdirectory] ;
get common desktop
set user [twapi::get_shell_folder csidl_desktopdirectory] ; get this
user desktop
I thought this would be available as a environ variable but I don't see
it on my system.
/Ashok
eval exec [auto_execok start] [list $dir]
I think different flavors of Windows handle rooted and unrooted
folder names differently (in associating them with Windows
Explorer, that is). I leave those details for another time.
if {$macosx} {
exec /usr/bin/osascript -e "tell app \"Finder\" to activate"
exec /usr/bin/osascript -e "tell app \"Finder\" to open posix file
\"[glob "~/SQLScripts"]\" "
}
if {$windows} {
catch { eval exec explorer [regsub -all {/} [glob ~/SQLScripts]
{\\} ]}
}
if { $hasgnome } {
exec /usr/bin/gnome-open [glob ~/SQLScripts]
}
}
###############################
Beware a couple of line wrappings above!
I don't know what to do in a pure Kde environment or
other common desktop managers.
Jerry
Couldn't that just be 'exec explorer [file nativename ~/SQLScripts]'?
Or is there some reason that won't work?
(I don't have a windows box handy to test on at the moment)
I can offer this from my private tcllib:
proc StartFileBrowser { dir } {
if { $::tcl_platform(platform) == "windows" } {
set browserProg "explorer"
} elseif { $::tcl_platform(os) == "Linux" } {
set browserProg "konqueror"
} elseif { $::tcl_platform(os) == "SunOS" } {
set browserProg "filemgr -d"
} elseif { $::tcl_platform(os) == "IRIX64" } {
set browserProg "fm"
} else {
set browserProg "xterm -e ls"
}
if { [file isdirectory $dir] } {
eval exec $browserProg [list [file nativename $dir]] &
}
}
Paul
<jerry...@gmail.com> schrieb im Newsbeitrag
news:1137178884.0...@z14g2000cwz.googlegroups.com...
and on OSX it's
set browserProg open
Steve
Thanks for the heads up :)
Jerry
"open" is *much* faster than my calls to osascript for MacOS X
Thanks,
Jerry
I just noticed that if I run gnome-open in the KDE environment that the
gnome-open process does not terminate cleanly ie becomes a zombie and
the application that "exec'ed" gnome-open hangs. It seems to work fine
in
the Gnome environment.
Any suggestions?
Jerry
I got rid of the hang by appending an ampersand to the command :)
However a zombie
hangs around until the application exits.
Multiple invocations do not create more zombies so one hanger on is
more or less
acceptable.
Jerry