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".
But I am not getting any output when I click on these two buttons in case of CDF or Player Pro.