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.

I have made a package

 BeginPackage["top`"]
 t[x_]:=MessageDialog["This is top"]
 t1[x_]:=MessageDialog["This is top1"]
 EndPackage[]

and used the code of this link and I am able to auto load packages in Mathematica and it is working fine. But when I have used it with Player Pro. It is not working.

Automatically load packages at startup

 initFileName = FileNameJoin[{$UserBaseDirectory, "Kernel", "init.m"}];

(* Make a back-up *)
 CopyFile[initFileName, initFileName <> "_" <>
StringReplace[ToString@Round[DateList[]], " " -> ""] <> ".bak"];
exprs = Import[initFileName, {"Package", "HeldExpressions"}];

 Export[initFileName,
   Append[exprs, HoldComplete[Needs["VectorAnalysis`"]]],
     {"Package", "HeldExpressions"}
  ]  

  Row[{Button["Click for function t", top`t[5]], Button["Click for f1", top`t[7]]}]

I have deployed the notebook in to CDF Player. But when I am opening the CDF by closing Mathematica and opening it with CDF Player, it is not working. I have also added that package in Autoload folder of Mathematica Player. What should I do so that my CDF or Player Pro also works fine as Mathematica notebook was working fine by autoloading packages at startup?

I was getting this output in mathematica when I clicked at "click for function t".enter image description here

But I am not getting any output when I click on these two buttons in case of CDF or Player Pro.

share|improve this question
    
what do you actually see? can you post a screen grab? –  Mike Honeychurch Jul 25 '12 at 9:31
    
I don't know anything about Player Pro, but I doubt that the CDF Player is customizable like this. CDFs are supposed to be portable and work everywhere, not only in a customized environment. –  Szabolcs Jul 25 '12 at 10:44
    
@MikeHoneychurch: i have edited my question. –  subbu Jul 25 '12 at 11:26
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.