Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

CurrentValue can be used to poll the state of numerous system values such as the mouse position. Its help page doesn't list all possible items, though. An item like "TooltipFontFamily" isn't listed but it works nevertheless:

In[49]:= CurrentValue["TooltipFontFamily"]    
Out[49]= "Segoe UI"

My question is: where can I find a (more) complete list of items that can be used with CurrentValue. Or, alternatively, how could I programmatically generate such a list?


EDIT

Based on John Fultz' answer I wrote the following:

Union[
 Flatten[
  Cases[
       Import[#], HoldPattern[CurrentValue[a_]] :> a, Infinity
       ] & /@ FileNames[#] & /@
   {
    FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", 
          "StyleSheets", "*.nb"}],
        FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", 
          "TextResources", "*.nb"}],
        FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", 
      "SystemResources", "*.nb"}]
    },
  2
  ]
 ]

and got this:

(*
==> 
{CommandKey, ControlKey, ControlsFontFamily, ControlsFontSize, 
 DefaultButtonSize, 
 DefaultNewGraphics, HyperlinkModifierKey, LicenseValid, MenuFontFamily, 
 MouseButtonTest, MouseClickCount, MouseOver, NotebookSelected, OptionKey, 
 PanelBackground, PanelFontFamily, PanelFontSize, ScreenArea, ShiftKey, 
 ToolbarBackground, TooltipFontFamily, TooltipFontSize, TooltipFrameMargins, 
 Enabled, Language, {ControlsFontSize, Large}, {ControlsFontSize, Medium}, 
 {ControlsFontSize, Small}, {SystemColor, DialogText},
 {SystemColor,DialogTextDisabled}, {SystemColor, MenuText}, 
 {SystemColor, Tooltip}, {SystemColor, TooltipFrame}, 
 {SystemColor, TooltipText}, {TaggingRules, Highlight}, 
 {ScreenRectangle, 1, 2}, {ScreenRectangle, 2, 2}}
*)

in addition to a message complaining about:

Syntax::sntufn: Unknown unicode longname NumberComma.

Other items known by CurrentValue (not in the list above) that were used in answers/comments here:

  • As per this comment by celtschk:

    {"Thickness", "Opacity", "Dashing", "FontFamily", "FontSize", "FontSlant",
     "FontWeight", "FontColor", "FontOpacity"}
    
share|improve this question
1  
given the comments to answers below I think a more interesting, and separate, general question would be how do you find out a list of all the built in option strings. –  Mike Honeychurch Feb 6 '12 at 0:40
    
out of curiosity is anyone planning to ask Wolfram about how to find all these strings? I will but don't want to double up if someone else already has or is about to? –  Mike Honeychurch Feb 6 '12 at 3:56
1  
ok I logged the question -- finding all option strings/string options with tech support –  Mike Honeychurch Feb 6 '12 at 9:08
    
@mike Thanks! Will you be reporting back here? –  Sjoerd C. de Vries Feb 6 '12 at 11:38
2  
@SjoerdC.deVries I got a fast reply: "Since these do not have any context like a symbol would, there isn't any real programmatic way of accumulating them. It's possible to scrape the documentation for these, but not very simply." ...but looks like John Fultz has provided a pointer below. –  Mike Honeychurch Feb 6 '12 at 20:53

5 Answers 5

up vote 24 down vote accepted

Other answers have already suggested ways of querying options. There's no way of systematically generating a list of all string values, but it's not too difficult to put together a list of all of the values which are used by Wolfram Research in Mathematica itself. If you look in the various files in these locations:

  • $InstallationDirectory/SystemFiles/FrontEnd/StyleSheets
  • $InstallationDirectory/SystemFiles/FrontEnd/TextResources
  • $InstallationDirectory/SystemFiles/FrontEnd/SystemResources

for instances of CurrentValue, you'll get a pretty good list of what is in active use by Wolfram Research developers at any given time. Most of the undocumented string values are created specifically to fulfill a purpose required by one of these files, so that's a pretty good list.

There may be a few others used directly by the kernel but not anywhere in these files, but if so, not many. Any undocumented string values which are not in use by the product somewhere are likely to be untested as well, so if you're tempted to complain that this list isn't absolutely complete, be careful what you wish for.

share|improve this answer

In addition to the other very useful answers, I'd like to start a collection of links to posts mentioning interesting CurrentValue items:

share|improve this answer

Basing on Sjoerds self answer, you were missing the subdirectories. I added that and the tr files (don't know if it was worth something). Probably I'm missing some others because this doesn't check box structures, but it does get a few extras

fnames = FileNames[
   "*.nb" | 
    "*.tr", {FileNameJoin[{$InstallationDirectory, "SystemFiles", 
      "FrontEnd", "StyleSheets"}], 
    FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", 
      "TextResources"}], 
    FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", 
      "SystemResources"}]}, Infinity];

fimps = Import[#, "Text"] & /@ fnames;

DeleteDuplicates@
     Flatten@StringCases[fimps, 
       Shortest[
        "CurrentValue[" ~~ (i___ /; 
           SameQ @@ (StringCount[i, #] & /@ {"[", "]"})) ~~ "]"]] // 
    StringReplace[#, Whitespace -> ""] & // 
   MakeExpression[#, StandardForm][[1, 1]] & /@ # & // 
  DeleteDuplicates//Sort

You get

{
 {"CellCount"},
 {"CommandKey"},
 {"ControlKey"},
 {"ControlsFontFamily"},
 {"ControlsFontSize"},
 {"CurrentFormatTime"},
 {"DefaultButtonSize"},
 {"DefaultNewGraphics"},
 {"GraphicsBoxOptionsImageSizeRaw"},
 {"HyperlinkModifierKey"},
 {"LicenseValid"},
 {"Magnification"},
 {"MenuFontFamily"},
 {"MouseButtonTest"},
 {"MouseClickCount"},
 {"MouseOver"},
 {"MousePosition"},
 {"NotebookFileName"},
 {"NotebookSelected"},
 {"OptionKey"},
 {"PanelBackground"},
 {"PanelFontFamily"},
 {"PanelFontSize"},
 {"PluginEnabled"},
 {"PreviousFormatTime"},
 {"ScreenArea"},
 {"SelectionData"},
 {"SelectionOver"},
 {"ShiftKey"},
 {"ToolbarBackground"},
 {"TooltipFontFamily"},
 {"TooltipFontSize"},
 {"TooltipFrameMargins"},
 {"WindowSize"},
 {dialog},
 {Enabled},
 {HomePage},
 {Inherited},
 {$CellContext`inputnb$$},
 {Language},
 {Magnification},
 {nb},
 {$CellContext`nb$},
 {$CellContext`nb$$},
 {FrontEnd`SelectionObject},
 {target},
 {WindowFrame},
 {WindowSize},
 {WindowTitle},
 {FrontEnd`$ActivationDialog},
 {$Failed},
 {FrontEnd`$FrontEnd},
 {FrontEnd`ButtonNotebook[]},
 {FrontEnd`EvaluationNotebook[]},
 {FrontEndObject[
   LinkObject["2t2_shm", 1, 1]]},
 {FrontEnd`InputNotebook[]},
 {{"ControllerData", {"Gamepad", "Joystick", "Multi-AxisController"}}},
 {{"ControlsFontSize", Large}},
 {{"ControlsFontSize", Medium}},
 {{"ControlsFontSize", Small}},
 {{"ControlsFontSize", Tiny}},
 {{"ControlsFontSize", #5}},
 {{"CounterValue", "SlideShowNavigationBar"}},
 {{"MaxCounterValue", "SlideShowNavigationBar"}},
 {{"ModifierKeys", "Command"}},
 {{"SystemColor", "DialogText"}},
 {{"SystemColor", "DialogTextDisabled"}},
 {{"SystemColor", "MenuText"}},
 {{"SystemColor", "Tooltip"}},
 {{"SystemColor", "TooltipFrame"}},
 {{"SystemColor", "TooltipText"}},
 {{ButtonBoxOptions, ButtonData}},
 {{TaggingRules, "Highlight"}},
 {{WindowSize, 1}},
 {{WindowSize, 2}},
 {{"ScreenRectangle", 1, 2}},
 {{"ScreenRectangle", 2, 2}},
 {{ConversionOptions, "ImportOptions", "PDF", "Editable"}},
 {{ConversionOptions, "ImportOptions", "PDF", "Pages"}},
 {NotebookObject[
   FrontEndObject[
    LinkObject["2t2_shm", 1, 1]], 193]},
 {target_},
 {#1}
}
share|improve this answer

Perhaps: using

  systemnames = Names["System`*"];
  Select[systemnames, CurrentValue[#] =!= $Failed &];
  CurrentValue /@ % // Short
  (*
  ==> {False, {FrontEnd`FileName[{$UserBaseDirectory, "Autoload"}],  ... }
  *)

for the System` context, and replacing System with the appropriate context name for other members of the list Contexts[]?

share|improve this answer
1  
+1 for the idea: asking the system is so much better than trusting the documentation :-). Unfortunately this will not find things that are only available as strings as the OPs example. My answer is even worse in that respect... –  Albert Retey Feb 5 '12 at 23:34
    
Also very nice, but Cases[Names["System`*"],"TooltipFontFamily"] yields {}. –  Sjoerd C. de Vries Feb 5 '12 at 23:40
    
@kguler I liked the example you removed in your latest edit. If you'd ask me I would have kept it. –  Sjoerd C. de Vries Feb 6 '12 at 11:44
    
@Sjoerd, I was not quite sure if the example that I erased was correct; I wanted to make sure that it was not a fluke due to corruption in my ContextPath after trying to do too many things in a single session. I will check and update if can verify that it was correct. Meanwhile, I hope there will be a response from WR to Mike's logged question soon. –  kguler Feb 6 '12 at 12:04
    
I didn't have mma available when I read your previous edit, but now that I have I don't see "TooltipFontFamily" in the Global` context; Context["TooltipFontFamily"] doesn't work as you showed. Come to think of it, can strings live in a context? –  Sjoerd C. de Vries Feb 6 '12 at 18:07

To my understanding CurrentValue adds an alternative syntax to what Options and SetOptions provide for the frontend and notebooks. So in addition to what's documented I think Options[$FrontEnd] and Options[Notebook] would be a good starting point. These are what I usually consult when searching for something.

share|improve this answer
    
That certainly yields a lot of options but the example I gave ("TooltipFontFamily") is not among them. That suggests there must be more options to be found than only those. In those list most of the options are not strings BTW, whereas most of the values listed in the CurrentValue doc page are strings. –  Sjoerd C. de Vries Feb 5 '12 at 23:36
2  
@SjoerdC.deVries: you are absolutely right about the fact that my list is not complete, and I know that very well. You should keep in mind that many options can nowadays be given as strings or as a symbol, try e.g. CurrentValue[AutoIndent] vs. CurrentValue["AutoIndent"]. Something that is also not clear to me is why there is a TooltipBoxOptions -> {"DefaultLabelStyle" -> "TooltipLabel"} and CurrentValue["TooltipFontFamily"] and if and how they are connected. Looks like a rich field for experiments... –  Albert Retey Feb 5 '12 at 23:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.