I have a lesson notebook for a class I am teaching. I'd like to separate the lesson content and the practice problems. Students are using the CDFPlayer program, not Mathematica.
I created a button that will open a specific notebook…
Button[ "open", NotebookOpen[FileNameJoin[{NotebookDirectory[ButtonNotebook[]], "sample.nb"}]]] and this works fine in the CDFPlayer.
However, selecting a "random" question from a list of files doesn't. Something in my code doesn't work in the free player. (The same code works fine in Mathematica)
This is what I tried:
Button[ "open", NotebookOpen[RandomChoice[FileNames[{"*.nb"}, {NotebookDirectory[ButtonNotebook[]]}]]]] I'm wondering if someone could offer a suggestion? I'd like a button that when clicked, will open a notebook from a folder of practice problems, and work in the CDFPlayer.
Any suggestions are appreciated.
I see (and appreciate) the feedback that the free CDFPlayer is NOT able to open files. So that answers my question...
FileNames[{"*.nb"}is disallowed because it looks as if you were fishing for what files are available. TryButton["open", Print @ RandomChoice[FileNames[{"*.nb"}, {NotebookDirectory[ButtonNotebook[]]}]]]. It might give you more insight. $\endgroup$