In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces:
exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] &
This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail.
Any Tcl-meisters want to take a stab? Matju?
.hc
________________________________________________________________________ ____
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
yuck, URIs don't have spaces, you put one in a web-page you its replaced with %20 in the URI.. I guess you could have to replace spaces with %20 and see if that works.
Try just opening the file in a browser and note the URL it uses to open it.
I assume this happens on win32, but its been too long for me to know...
.b.
Hans-Christoph Steiner wrote:
In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces:
exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] &
This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail.
Any Tcl-meisters want to take a stab? Matju?
.hc
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
hi,
just a guess: maybe encapsulate it with " for example, this doesnt work: cd Program Files but this does: cd "program files"
so, if you need to prepare a string to pass, you may add " at the start and end to encapsulate it...
but again, its just a guess ...
greets,
chris
Am Dienstag 17 Januar 2006 19:26 schrieb B. Bogart:
yuck, URIs don't have spaces, you put one in a web-page you its replaced with %20 in the URI.. I guess you could have to replace spaces with %20 and see if that works.
Try just opening the file in a browser and note the URL it uses to open it.
I assume this happens on win32, but its been too long for me to know...
.b.
Hans-Christoph Steiner wrote:
In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces:
exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] &
This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail.
Any Tcl-meisters want to take a stab? Matju?
.hc
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
This is win32. rundll32 url.dll,FileProtocolHandler doesn't like "file:C:/Program%20Files" from my tests. This is Microsoft we are talking about, they do things their own way, standards be damned.
.hc
On Jan 17, 2006, at 1:26 PM, B. Bogart wrote:
yuck, URIs don't have spaces, you put one in a web-page you its replaced with %20 in the URI.. I guess you could have to replace spaces with %20 and see if that works.
Try just opening the file in a browser and note the URL it uses to open it.
I assume this happens on win32, but its been too long for me to know...
.b.
Hans-Christoph Steiner wrote:
In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces:
exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] &
This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail.
Any Tcl-meisters want to take a stab? Matju?
.hc
__ ____
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
________________________________________________________________________ ____
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
Too add quotes to your command try this:
format ""file:%s"" $file
the string contained in "" contains the excapted quotes "
I hope that does it.
.b.
Hans-Christoph Steiner wrote:
This is win32. rundll32 url.dll,FileProtocolHandler doesn't like "file:C:/Program%20Files" from my tests. This is Microsoft we are talking about, they do things their own way, standards be damned.
.hc
On Jan 17, 2006, at 1:26 PM, B. Bogart wrote:
yuck, URIs don't have spaces, you put one in a web-page you its replaced with %20 in the URI.. I guess you could have to replace spaces with %20 and see if that works.
Try just opening the file in a browser and note the URL it uses to open it.
I assume this happens on win32, but its been too long for me to know...
.b.
Hans-Christoph Steiner wrote:
In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces:
exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] &
This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail.
Any Tcl-meisters want to take a stab? Matju?
.hc
__ ____
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
Tried that, no luck. rundll32 url.dll,FileProtocolHandler interprets the " as a character and gets confused because it doesn't know how to handle "file: URI types.
Yes, its that bad. FYI: you can test this stuff from the cmd.exe shell, and take Tcl and Pd out of the equation.
.hc
On Jan 17, 2006, at 2:10 PM, B. Bogart wrote:
Too add quotes to your command try this:
format ""file:%s"" $file
the string contained in "" contains the excapted quotes "
I hope that does it.
.b.
Hans-Christoph Steiner wrote:
This is win32. rundll32 url.dll,FileProtocolHandler doesn't like "file:C:/Program%20Files" from my tests. This is Microsoft we are talking about, they do things their own way, standards be damned.
.hc
On Jan 17, 2006, at 1:26 PM, B. Bogart wrote:
yuck, URIs don't have spaces, you put one in a web-page you its replaced with %20 in the URI.. I guess you could have to replace spaces with %20 and see if that works.
Try just opening the file in a browser and note the URL it uses to open it.
I assume this happens on win32, but its been too long for me to know...
.b.
Hans-Christoph Steiner wrote:
In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces:
exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] &
This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail.
Any Tcl-meisters want to take a stab? Matju?
.hc
__ __ ____
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
__ ____
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
________________________________________________________________________ ____
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
Hans-Christoph Steiner wrote:
Tried that, no luck. rundll32 url.dll,FileProtocolHandler interprets the " as a character and gets confused because it doesn't know how to handle "file: URI types.
Of course, that's why you should try format <"file:"%s"" $file> instead of <format ""file:%s"" $file> the quoted string is just <%s>, the path.
Martin
On Jan 17, 2006, at 3:07 PM, Martin Peach wrote:
Hans-Christoph Steiner wrote:
Tried that, no luck. rundll32 url.dll,FileProtocolHandler interprets the " as a character and gets confused because it doesn't know how to handle "file: URI types.
Of course, that's why you should try format <"file:"%s"" $file> instead of <format ""file:%s"" $file> the quoted string is just <%s>, the path.
Tried both of those, no luck. Sometimes, I get an error, other times it silently fails. I haven't tried the -shortnames option, that might work. But I won't have access to a Windows PC again until Friday night.
If any of you uses Windows, you can easily edit the file yourself to try out these ideas. The file is pd/bin/pd.tk. Search for rundll32, that's the line in question.
.hc ________________________________________________________________________ ____
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
Hans-Christoph Steiner wrote:
This is win32. rundll32 url.dll,FileProtocolHandler doesn't like "file:C:/Program%20Files" from my tests. This is Microsoft we are talking about, they do things their own way, standards be damned.
I can't find any real docs on url.dll but it seems like FileProtocolHandler expects a file path. Did you try: exec rundll32 url.dll,FileProtocolHandler \ [format "file:"%s"" $filename] & yet?
Another solution is to use short names: (e.g., using ``applba~1.def'' instead of ``applbakery.default''), which can be obtained with the *file attributes $fileName -shortname* command. (from http://www.tcl.tk/man/tcl8.4/TclCmd/exec.htm) Martin
.hc
On Jan 17, 2006, at 1:26 PM, B. Bogart wrote:
yuck, URIs don't have spaces, you put one in a web-page you its replaced with %20 in the URI.. I guess you could have to replace spaces with %20 and see if that works.
Try just opening the file in a browser and note the URL it uses to open it.
I assume this happens on win32, but its been too long for me to know...
.b.
Hans-Christoph Steiner wrote:
In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces:
exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] &
This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail.
Any Tcl-meisters want to take a stab? Matju?
.hc
__ ____
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
On Jan 17, 2006, at 2:12 PM, Martin Peach wrote:
Hans-Christoph Steiner wrote:
This is win32. rundll32 url.dll,FileProtocolHandler doesn't like "file:C:/Program%20Files" from my tests. This is Microsoft we are talking about, they do things their own way, standards be damned.
I can't find any real docs on url.dll but it seems like FileProtocolHandler expects a file path. Did you try: exec rundll32 url.dll,FileProtocolHandler \ [format "file:"%s"" $filename] & yet?
Another solution is to use short names: (e.g., using ``applba~1.def'' instead of ``applbakery.default''), which can be obtained with the *file attributes $fileName -shortname* command. (from http://www.tcl.tk/man/tcl8.4/TclCmd/exec.htm) Martin
We have a winner! This worked for me:
exec rundll32 url.dll.FileProtocolHandler \ [format "file:%s" [file attributes $filename -shortname]] &
.hc
.hc
On Jan 17, 2006, at 1:26 PM, B. Bogart wrote:
yuck, URIs don't have spaces, you put one in a web-page you its replaced with %20 in the URI.. I guess you could have to replace spaces with %20 and see if that works.
Try just opening the file in a browser and note the URL it uses to open it.
I assume this happens on win32, but its been too long for me to know...
.b.
Hans-Christoph Steiner wrote:
In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces:
exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] &
This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail.
Any Tcl-meisters want to take a stab? Matju?
.hc
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
________________________________________________________________________ ____
On Tue, 17 Jan 2006, Hans-Christoph Steiner wrote:
In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces: exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] & This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail. Any Tcl-meisters want to take a stab? Matju?
Me?
I uninstalled Windows in 1994 or so. It never ran so well on my DRDOS/DESQview anyway.
I never used Microsoft's Mosaic fork either.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
On Jan 18, 2006, at 12:12 AM, Mathieu Bouchard wrote:
On Tue, 17 Jan 2006, Hans-Christoph Steiner wrote:
In u_main.tk, in the procedure menu_openhtml, this little snippet of code does not work when there is a space in the file name (i.e. C:/Program Files/pd/doc), but works fine when there are no spaces: exec rundll32 url.dll,FileProtocolHandler \ [format "file:%s" $filename] & This opens HTML, etc from the menu/help browser, so it would be most helpful to have it working. I have tried a number of things to no avail. Any Tcl-meisters want to take a stab? Matju?
Me?
I uninstalled Windows in 1994 or so. It never ran so well on my DRDOS/DESQview anyway.
I never used Microsoft's Mosaic fork either.
I think its more of a Tcl question. The problem is that if I run this from the command line, it works fine:
rundll32 url.dll,FileProtocolHandler file:C:/Program Files/pd/doc/manuals/Gem/cMatrix.html
But if I do this in Tcl, it does not:
set filename "C:/Program Files/pd/doc/manuals/Gem/cMatrix.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] &
Quotes don't seem to make it work either.
.hc ________________________________________________________________________ ____
Using ReBirth is like trying to play an 808 with a long stick. -David Zicarelli
On Wed, 18 Jan 2006, Hans-Christoph Steiner wrote:
I think its more of a Tcl question. The problem is that if I run this from the command line, it works fine: rundll32 url.dll,FileProtocolHandler file:C:/Program Files/pd/doc/manuals/Gem/cMatrix.html But if I do this in Tcl, it does not: set filename "C:/Program Files/pd/doc/manuals/Gem/cMatrix.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] & Quotes don't seem to make it work either.
I don't know the intricacies of the Windows version of Tcl's exec.
Is it possible that %20 gets munged because the shell thinks it's supposed to be an argument expansion? I recall that in COMMAND.COM %20 meant like what $20 means in /bin/sh... Does the % sign have to be doubled in order to make it a literal percentsign for COMMAND.COM ?
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
On Jan 18, 2006, at 1:20 AM, Mathieu Bouchard wrote:
On Wed, 18 Jan 2006, Hans-Christoph Steiner wrote:
I think its more of a Tcl question. The problem is that if I run this from the command line, it works fine: rundll32 url.dll,FileProtocolHandler file:C:/Program Files/pd/doc/manuals/Gem/cMatrix.html But if I do this in Tcl, it does not: set filename "C:/Program Files/pd/doc/manuals/Gem/cMatrix.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] & Quotes don't seem to make it work either.
I don't know the intricacies of the Windows version of Tcl's exec.
Is it possible that %20 gets munged because the shell thinks it's supposed to be an argument expansion? I recall that in COMMAND.COM %20 meant like what $20 means in /bin/sh... Does the % sign have to be doubled in order to make it a literal percentsign for COMMAND.COM ?
Its not an URI, its a Microsoft format, so %20 doesn't work. It needs to be a space, so its a question of how to make Tcl handle the space properly. I think this would be a case for Tcl 8.5's {expand}. How is it done in 8.4?
.hc
________________________________________________________________________ ____
"The arc of history bends towards justice." - Dr. Martin Luther King, Jr.
On Wed, 18 Jan 2006, Hans-Christoph Steiner wrote:
Its not an URI, its a Microsoft format, so %20 doesn't work. It needs to be a space, so its a question of how to make Tcl handle the space properly. I think this would be a case for Tcl 8.5's {expand}. How is it done in 8.4?
I never used {expand}. I'm not into Tcl 8.5 yet. I find the {expand} syntax to be really weird compared to anything in Tcl prior to 8.5... I do the equivalent this way:
set [concat [list foo bar] $args]
which is the equivalent of [list prepend foo bar] in Pd 0.39.
but i warn you, if you really need that for building what amounts to one argument in the shell, it means that shell commands on Tcl/Win32 are really fucked up. One argument should stay one argument.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
Hans-Christoph Steiner wrote:
I think its more of a Tcl question. The problem is that if I run this from the command line, it works fine:
rundll32 url.dll,FileProtocolHandler file:C:/Program Files/pd/doc/manuals/Gem/cMatrix.html
But if I do this in Tcl, it does not:
set filename "C:/Program Files/pd/doc/manuals/Gem/cMatrix.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] &
Quotes don't seem to make it work either.
I tried the following simple script on WinXP and it works fine here (Tcl for Windows Tcl 8.4.11, Tk 8.4.11) using File->Source... from the Console that shows up when you type "wish" on a command line:
#!/usr/bin/wish
puts "Hello" set filename "C:/Program Files/pd/doc/gem/manual/index.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] &
... then my browser opens the URL "file:///C:/Program%20Files/pd/doc/gem/manual/index.html". It also works if I just enter the name of the script in a command prompt window. Perhaps the version of tcl is important?
Martin
On Jan 19, 2006, at 1:29 PM, Martin Peach wrote:
Hans-Christoph Steiner wrote:
I think its more of a Tcl question. The problem is that if I run this from the command line, it works fine:
rundll32 url.dll,FileProtocolHandler file:C:/Program Files/pd/doc/manuals/Gem/cMatrix.html
But if I do this in Tcl, it does not:
set filename "C:/Program Files/pd/doc/manuals/Gem/cMatrix.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] &
Quotes don't seem to make it work either.
I tried the following simple script on WinXP and it works fine here (Tcl for Windows Tcl 8.4.11, Tk 8.4.11) using File->Source... from the Console that shows up when you type "wish" on a command line:
#!/usr/bin/wish
puts "Hello" set filename "C:/Program Files/pd/doc/gem/manual/index.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] &
... then my browser opens the URL "file:///C:/Program%20Files/pd/doc/gem/manual/index.html". It also works if I just enter the name of the script in a command prompt window. Perhaps the version of tcl is important?
Pd-extended on Win32 uses Tcl/Tk 8.4.11 too.
Perhaps you could try editing c:\Program Files\pd\bin\pd.tk and see if you can get it working?
.hc
________________________________________________________________________ ____
"Terrorism is not an enemy. It cannot be defeated. It's a tactic. It's about as sensible to say we declare war on night attacks and expect we're going to win that war. We're not going to win the war on terrorism." - retired U.S. Army general, William Odom
Martin Peach wrote:
Hans-Christoph Steiner wrote:
I think its more of a Tcl question. The problem is that if I run this from the command line, it works fine:
rundll32 url.dll,FileProtocolHandler file:C:/Program Files/pd/doc/manuals/Gem/cMatrix.html
But if I do this in Tcl, it does not:
set filename "C:/Program Files/pd/doc/manuals/Gem/cMatrix.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] &
Quotes don't seem to make it work either.
I tried the following simple script on WinXP and it works fine here (Tcl for Windows Tcl 8.4.11, Tk 8.4.11) using File->Source... from the Console that shows up when you type "wish" on a command line:
#!/usr/bin/wish
puts "Hello" set filename "C:/Program Files/pd/doc/gem/manual/index.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] &
... then my browser opens the URL "file:///C:/Program%20Files/pd/doc/gem/manual/index.html". It also works if I just enter the name of the script in a command prompt window.
Further testing shows that while a path like "C:/Program Files/pd/doc/gem/manual/index.html" is processed correctly, in pd.tk the actual path is something like "C:/Program Files/pd/bin/../doc/gem/manual/index.html" and this kind of path doesn't work if there are spaces. I would think this is a bug in tcl/tk and not pd, but it might be more elegant to make the help pathnames by stripping the "bin" from pd_guidir instead of appending "..".
Martin
On Jan 23, 2006, at 4:36 PM, Martin Peach wrote:
Martin Peach wrote:
Hans-Christoph Steiner wrote:
I think its more of a Tcl question. The problem is that if I run this from the command line, it works fine:
rundll32 url.dll,FileProtocolHandler file:C:/Program Files/pd/doc/manuals/Gem/cMatrix.html
But if I do this in Tcl, it does not:
set filename "C:/Program Files/pd/doc/manuals/Gem/cMatrix.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] &
Quotes don't seem to make it work either.
I tried the following simple script on WinXP and it works fine here (Tcl for Windows Tcl 8.4.11, Tk 8.4.11) using File->Source... from the Console that shows up when you type "wish" on a command line:
#!/usr/bin/wish
puts "Hello" set filename "C:/Program Files/pd/doc/gem/manual/index.html" exec rundll32 url.dll,FileProtocolHandler [format "file:%s" $filename] &
... then my browser opens the URL "file:///C:/Program%20Files/pd/doc/gem/manual/index.html". It also works if I just enter the name of the script in a command prompt window.
Further testing shows that while a path like "C:/Program Files/pd/doc/gem/manual/index.html" is processed correctly, in pd.tk the actual path is something like "C:/Program Files/pd/bin/../doc/gem/manual/index.html" and this kind of path doesn't work if there are spaces. I would think this is a bug in tcl/tk and not pd, but it might be more elegant to make the help pathnames by stripping the "bin" from pd_guidir instead of appending "..".
I am not sure that the Pd.app path ends in "bin", it might end in "MacOS". the [file attributes $filename -shortname] hack works fine, for now at least. Feel free to submit a cleaner version.
.hc
________________________________________________________________________ ____