I always start my syntax with: dataset close all. new file. output close all. get file = 'fname.sav'. ...followed by the relevant analysis. What I find is that each time I rerun the complete syntax the data and output windows are in a different position or at least loose their previous position I had manual set?
I'm hoping I could run a little code (most likely python/script?) which could find the active data and output window and be able to explicitly set a position for it? Would be very grateful if anyone could shed any information how this could be made possible?
Many thanks in advance. Jignesh |
Statistics always offsets new windows a
little so that they do not lie exactly on top of older windows, but it
does not try to reuse "vacated" window positions.
The SpssDataUI class available via Python scripting with the SpssClient.py module provides methods such as SetLeft and SetTop that control the positioning. There are similar methods for the other window types. You get the DE windows, for example, like this. SpssClient.StartClient() ActiveDataDoc = SpssClient.GetActiveDataDoc() DataUI = ActiveDataDoc.GetDataUI() HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: J Sutar <[hidden email]> To: [hidden email] Date: 03/13/2012 06:04 AM Subject: [SPSSX-L] Window Position Sent by: "SPSSX(r) Discussion" <[hidden email]> I always start my syntax with: dataset close all. new file. output close all. get file = 'fname.sav'. ...followed by the relevant analysis. What I find is that each time I rerun the complete syntax the data and output windows are in a different position or at least loose their previous position I had manual set? I'm hoping I could run a little code (most likely python/script?) which could find the active data and output window and be able to explicitly set a position for it? Would be very grateful if anyone could shed any information how this could be made possible? Many thanks in advance. Jignesh |
Hi Jon, Is there a method which replicates the Windows Key + Left/Right arrow keys for docking window to left or right? There is a SetWindowState method which can be used to replicate WIN+UP (maximize) & WIN+DOWN (minimize)
Also, if I run the below syntax in its entirety then I get an error. If I re-run the program block only I still get the same error. But if I select the DE window and make it active and then re-run the program block it works as intended. Ideally, the purpose of this is to set the window position automatically at the start of a session.
dataset close all. new file. output close all. get file = "C:\Program Files\IBM\SPSS\Statistics\22\Samples\English\accidents.sav". dataset name ds1. begin program. import SpssClient SpssClient.StartClient() ActiveDataDoc = SpssClient.GetActiveDataDoc() DataUI = ActiveDataDoc.GetDataUI() DataUI.SetLeft(0) DataUI.SetTop(0) DataUI.SetHeight(992) DataUI.SetWidth(800) DataUI.SetWindowState(SpssClient.SpssWindowStates.SpssMaximized) end program. Traceback (most recent call last): File "<string>", line 5, in <module> AttributeError: 'NoneType' object has no attribute 'GetDataUI' Thanks in advance, Jignesh
On 13 March 2012 13:59, Jon K Peck <[hidden email]> wrote: Statistics always offsets new windows a little so that they do not lie exactly on top of older windows, but it does not try to reuse "vacated" window positions. |
Free forum by Nabble | Edit this page |