Re:
- To: mathgroup at smc.vnet.net
- Subject: [mg61143] Re:
- From: Omega Consulting <info at omegaconsultinggroup.com>
- Date: Tue, 11 Oct 2005 03:21:28 -0400 (EDT)
- References: <200510030806.EAA00277@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I don't remember if anyone answered this. The reason is that buttons evaluate in the frontend, by default, not the kernel. Only frontend operations are allowed. To use the kernel, you set the ButtonEvaluator. Cell[TextData[ButtonBox[webmath", ButtonData:>{ URL[ StringJoin["file:///", "E:/Documents/", "WebMath.htm"]], None}, ButtonStyle->"Hyperlink", ButtonEvaluator->Automatic]], "Text"] ---------------------------------------------- Omega Consulting The final answer to your Mathematica needs. http://omegaconsultinggroup.com On Oct 3, 2005, at 3:06 AM, Murray Eisenberg wrote: > I'm trying to build up a local file URL to be the value of ButtonData > for a ButtonBox. (The file is in a subdirectory of the current > notebook's directory, and I want to be able to refer to the target > file > no matter where I move the entire directory.) > > If I use an actual string as the argument in ButtonData:>{URL[...], > None}, as in the following expression of that cell, it works just > fine: > > Cell[TextData[ButtonBox["webmath", > ButtonData:>{ > URL[ "file:///E:/Documents/WebMath.htm""], None}, > ButtonStyle->"Hyperlink"]], "Text"] > > However, if I try to build up the argument to URL in any way, even > as in > the following version where I simply join strings, then Mathematica > reports a MathLink error occurred while receiving BoxData" after I > convertthe expression to an actual input cell and click the hyperlink: > > Cell[TextData[ButtonBox[webmath", > ButtonData:>{ > URL[ > StringJoin["file:///", "E:/Documents/", "WebMath.htm"]], None}, > ButtonStyle->"Hyperlink"]], "Text"] > > What's wrong and how can it be fixed? > > Version: 5.2 for Microsoft Windows (June 20, 2005) > > (I actually want to do something more sophisticated, namely instead of > "E:/Documents/", use the value of a function ThisNBPath I've defined > that will return the path to the directory of the evaluation > notebook.) > > -- > Murray Eisenberg murray at math.umass.edu > Mathematics & Statistics Dept. > Lederle Graduate Research Tower phone 413 549-1020 (H) > University of Massachusetts 413 545-2859 (W) > 710 North Pleasant Street fax 413 545-1801 > Amherst, MA 01003-9305 >