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.

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}}
share|improve this question

1 Answer 1

up vote 3 down vote accepted

AbsoluteCurrentValue should do what you want:

AbsoluteCurrentValue[EvaluationNotebook[], "WindowMargins"]
(* {{624, -2}, {-47, -19}} *)
share|improve this answer
    
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. –  Liam William Dec 12 '13 at 18:46

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.