Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Stacking Windows Macro 
Author Message

Joined: 2010-01-06 10:58:07
Posts: 39
New to Nisus.

How would I go about writing a macro to automatically stack all of the open windows exactly on top of each other?

Thanks


2010-02-12 06:49:54
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
If I don’t misunderstand you, you don’t need a macro for that. With the option key pushed down, “Bring All to Front” command under Windows menu will change to “Arrange in Front” which does the job. This command is available in many OS X applications.


2010-02-12 07:15:35
Profile

Joined: 2010-01-06 10:58:07
Posts: 39
That's a nice feature, and close to what I had in mind. But what I actually would like is for all of the windows to stack 'exactly' on top of one another. Guess I'm just a neat freak, but it helps me concentrated on the current document.

I have set my Desktop background to the same color of the background of my NWP docs, so it appears as though the front doc is the only thing on the entire screen.

Thanks


2010-02-12 10:20:09
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
bjast wrote:
But what I actually would like is for all of the windows to stack 'exactly' on top of one another.


That is not feasible. There is no macro command for getting/setting the coordinates of a document window.


2010-02-12 19:03:10
Profile

Joined: 2010-01-06 10:58:07
Posts: 39
That's unfortunate. I suppose that means that the Arrange in Front command - implemented by pressing Option while selecting Window > Bring All to the Front - is system-wide, and not unique to NWP.

Is there a way to hide a window that, perhaps, could be exploited through a macro to hide more than one window in succession?

Thanks


2010-02-12 19:50:56
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
A macro can hide a window but only while a macro is running. So it is not usable for this purpose. But perhaps minimizing all windows except the frontmost would achieve something close to what you need?
Code:
$frontmost = Document.active
if $frontmost == undefined
   exit
end

$docs = Document.openDocuments
foreach $doc in $docs
   $doc.show
   if $doc != $frontmost
      Send Selector 'miniaturize:'
   end
end
The macro above de-minimizes documents already minimized before minimizing them. That is inelegant but there is no way for a macro to know if a document is minimized or not.

And the following shows (de-minimizes) all open documents.
Code:
$docs = Document.openDocuments
if $docs != undefined
   foreach $doc in $docs
      $doc.show
   end
end


2010-02-13 03:59:44
Profile

Joined: 2010-01-06 10:58:07
Posts: 39
Thanks Kino. I'll check this out.

It's intriguing that, for as extensive as it is for writing macros, NWP does have a way to handle the coordinates of open windows.

Curious ...


2010-02-13 08:11:00
Profile

Joined: 2003-11-21 19:25:28
Posts: 333
Location: Sydney, Australia
bjast wrote:
That's a nice feature, and close to what I had in mind. But what I actually would like is for all of the windows to stack 'exactly' on top of one another. Guess I'm just a neat freak, but it helps me concentrated on the current document.

I have set my Desktop background to the same color of the background of my NWP docs, so it appears as though the front doc is the only thing on the entire screen.

Thanks


If that's all you want then why not simply use View>Full Screen mode? Then the front window is the only thing on the entire screen.


2010-02-13 18:36:49
Profile

Joined: 2010-01-06 10:58:07
Posts: 39
dshan wrote:
If that's all you want then why not simply use View>Full Screen mode? Then the front window is the only thing on the entire screen.


Good observation. I would do as you suggested if there were not the limitations (bugs?) that currently exist in the Full Screen Mode: See this thread:

viewtopic.php?f=18&t=3645


2010-02-14 07:14:43
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
bjast wrote:
It's intriguing that, for as extensive as it is for writing macros, NWP does <not> have a way to handle the coordinates of open windows.

Even if the Full Screen view did not have those bugs or limitations, I think NWP macro should have commands for inspecting/modifying window coordinates (available in NW Classic) as well as a command reporting the text range of the currently visible area of a document (necessary for a Top of Page macro requested by you in another thread). So I just sent them a feedback requesting those commands. They will be a significant enhancement for the NW Pro macro language. Thank you very much!


2010-02-15 06:36:34
Profile

Joined: 2010-01-06 10:58:07
Posts: 39
Thanks Kino for adding < not > to my previous message. Am I hearing you correctly, that NW offers these window coordinates, and NWP does not? That is curious indeed, as you would think you were getting a more advanced product with the "Pro" version.


2010-02-15 07:37:58
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
Yes, the following commands (or rather keywords) are available in NW Classic macro.

RectRight Nisus[FrontWindow][WindowRect][...]
RectLeft Nisus[FrontWindow][WindowRect][...]
RectTop Nisus[FrontWindow][WindowRect][...]
RectBottom Nisus[FrontWindow][WindowRect][...]


I did not use them so often but they were indispensable for a macro which force-redraws document windows. I wrote it in order to solve a Classic environment issue.

Although NW Pro macro is much more advanced, efficient, and extensive in many points, not all NW Classic macro features are available yet. The most important missing one would be the ability to record a macro. Of course, we should understand that NW Pro/Express is not an updated version of NW Classic but a new application written from scratch and that something easily feasible in legacy Mac OS is not always so in OS X, though.


2010-02-15 08:13:01
Profile

Joined: 2010-01-06 10:58:07
Posts: 39
Thanks for the insight. Being new to NWP and Nisus in general, I didn't realize that NWP was a complete rewrite. This helps me to make more sense out of its limitations.


2010-02-15 08:27:13
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
kino wrote:
The macro above de-minimizes documents already minimized before minimizing them. That is inelegant but there is no way for a macro to know if a document is minimized or not.

I sent a feedback requesting such macro commands and Martin kindly reminded me of isVisible command. So here is a revised version.
Code:
### Minimize All Windows except the Frontmost ###
$frontmost = Document.active
if $frontmost == undefined
   exit  # because no window is open
end

$docs = Document.openDocuments
$docs.removeValueAtIndex 0  # exclude the frontmost document
foreach $doc in $docs
   if $doc.isVisible
      Document.setActive $doc
      Send Selector 'miniaturize:'
   end
end

Unfortunately this macro still cannot handle all possible situations. It is impossible to know in which space a document window is situated. In other words, the macro will minimize windows which are visible in other spaces, too. I don’t know if there is any user who puts NWP document windows in different spaces, though.


2010-02-15 22:59:00
Profile

Joined: 2010-01-06 10:58:07
Posts: 39
Thanks Kino. This is an improvement and does a good job of minimizing all but the frontmost window.

The challenge I'm finding is that I work with multiple windows at a time, and need to Command Tilde rotate between them. This, obviously, doesn't work when the windows are minimized.

Hopefully, they will add the option you requested to a future version of NWP.

Thanks


2010-02-22 07:57:04
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 17 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software