From: AndreasK on 24 Jun 2010 14:12 We (ActiveState) are using # Perform basic url quoting and escape &'s in url ... set url [string map {{ } %20 & ^&} $url] set failed [catch { exec >NUL: <NUL: $::env(COMSPEC) /c start $url & } emsg] to open urls on Windows in general, and have no problem using that from regular or wrapped code.
From: Jeff Hobbs on 24 Jun 2010 17:47 On Jun 24, 11:12 am, AndreasK <andreas.kupr...(a)gmail.com> wrote: > We (ActiveState) are using > > # Perform basic url quoting and escape &'s in url ... > set url [string map {{ } %20 & ^&} $url] > > set failed [catch { > exec >NUL: <NUL: $::env(COMSPEC) /c start $url & > } emsg] > > to open urls on Windows in general, and have no problem using that > from regular or wrapped code. I believe the redirection part is important, as one of the core differences between basekits (at the Tcl core technology layer) is standard channels. By forcing the redirect to/from NUL, you avoid issues with commands that expect std channel tied I/O. Jeff
From: JHJL on 25 Jun 2010 03:33 On Jun 24, 10:47 pm, Jeff Hobbs <jeff.ho...(a)gmail.com> wrote: > On Jun 24, 11:12 am, AndreasK <andreas.kupr...(a)gmail.com> wrote: > > > We (ActiveState) are using > > > # Perform basic url quoting and escape &'s in url ... > > set url [string map {{ } %20 & ^&} $url] > > > set failed [catch { > > exec >NUL: <NUL: $::env(COMSPEC) /c start $url & > > } emsg] > > > to open urls on Windows in general, and have no problem using that > > from regular or wrapped code. > > I believe the redirection part is important, as one of the core > differences between basekits (at the Tcl core technology layer) is > standard channels. By forcing the redirect to/from NUL, you avoid > issues with commands that expect std channel tied I/O. > > Jeff Very many thanks guys for your help. I had forgotten the basic rule of debugging "check the bit *you* wrote" By liberally sprinkling my code with puts I determined that 1) A different url was being used when running the .kit and .exe due to the wrong package being included. This resulted in the file path containing spaces which I hadn't guarded against. D'Oh 2) I had used file://c:... instead of file:///c:... So my final code based on the above is: set url [string map {{ } %20 & ^&} $fname] set failed [catch { exec >NUL: <NUL: [auto_execok start] file:///$url & } err] where fname is the full path to the file to be displayed kind regards Julian H J Loaring
First
|
Prev
|
Pages: 1 2 Prev: array names fails to find the pattern if the key contains [] Next: activeTcl help |