1
$\begingroup$

Is there a way to force getting the numerical values of WindowMargins instead of Automatic for a window?

For example let say I want to create a new Notebook that is $62$ pixels below and $62$ pixels to the right of the current EvalutaionNotebook. If I run the following it sometimes works and sometimes doesn't depending on the window position on the current screen.

x = CurrentValue[EvaluationNotebook[], "WindowMargins"];
NotebookPut[Notebook[{
   Cell["Some text.", "Text"]}],
 WindowMargins -> {
   {x[[1, 1]] + 62, Automatic},
   {Automatic, x[[2, 2]] + 62}
   }
 ]

For example sometimes the expression throws an error and results in the following because Mathematica is returning a different answer.

 {{131, Automatic}, {Automatic, 62 + Automatic}}
$\endgroup$
0
4
$\begingroup$

AbsoluteCurrentValue should do what you want:

AbsoluteCurrentValue[EvaluationNotebook[], "WindowMargins"]
(* {{624, -2}, {-47, -19}} *)
$\endgroup$
1
  • $\begingroup$ Thank you for the quick response. I should have checked the docs (Both Google and Mathematica.stackexchange.com turned up nothing in my initial search). Oh well silly me. $\endgroup$
    – William
    Dec 12 '13 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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