Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Open a folder on the desktop?

10 views
Skip to first unread message

jerry...@gmail.com

unread,
Jan 6, 2006, 6:11:39 PM1/6/06
to
Hi,

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

pal...@yahoo.com

unread,
Jan 7, 2006, 10:05:15 AM1/7/06
to
On XP,

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

Cameron Laird

unread,
Jan 8, 2006, 11:08:02 AM1/8/06
to
In article <1136646315.2...@f14g2000cwb.googlegroups.com>,

<pal...@yahoo.com> wrote:
>On XP,
>
>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, I think it's easier than that:

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.

jerry...@gmail.com

unread,
Jan 13, 2006, 2:01:24 PM1/13/06
to
Ok, here is my status on this problem... I basically want
to be able to open a specific "folder" on the users desktop.
The following seems to work, were relevant.
#################################
proc OpenScriptsFolder {} {
global macosx
global windows
global hasgnome

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

Bryan Oakley

unread,
Jan 13, 2006, 2:17:23 PM1/13/06
to
jerry...@gmail.com wrote:
> Ok, here is my status on this problem... I basically want
> to be able to open a specific "folder" on the users desktop.
> The following seems to work, were relevant.
> #################################
> proc OpenScriptsFolder {} {
> global macosx
> global windows
> global hasgnome
>
> 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]
> {\\} ]}

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)

Paul Obermeier

unread,
Jan 13, 2006, 2:52:24 PM1/13/06
to
Hi,

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...

Steve Landers

unread,
Jan 13, 2006, 7:05:28 PM1/13/06
to
Paul Obermeier wrote:
> Hi,
>
> 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]] &
> }
> }
>

and on OSX it's

set browserProg open

Steve

jerry...@gmail.com

unread,
Jan 13, 2006, 8:34:24 PM1/13/06
to
Actually I did not even think to look if the translation was available.

Thanks for the heads up :)

Jerry

jerry...@gmail.com

unread,
Jan 13, 2006, 9:01:01 PM1/13/06
to
Wow,

"open" is *much* faster than my calls to osascript for MacOS X

Thanks,

Jerry

jerry...@gmail.com

unread,
Jan 13, 2006, 10:53:44 PM1/13/06
to
Rats,

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

jerry...@gmail.com

unread,
Jan 18, 2006, 12:28:41 PM1/18/06
to
Well,

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

0 new messages