Friday, December 15, 2017

#1 2009-11-03 08:10:06 pm

Richard
Member
From:: Herefordshire, UK
Registered: 2009-09-09
Posts: 529
Website

Resizing Windows

I would like to resize a window a bit like System preferences or most other preference windows when I change tabs (hide/unhide custom views), the closest I can get this effect is:

Applescript:

windd's setFrame_display_animate_({{item 1 of (item 1 of (windd's frame() as list) as list), (item 2 of (item 1 of (windd's frame() as list) as list)) + ((item 2 of (item 2 of (windd's frame() as list) as list)) - 200)}, {900, 200}}, true, true)

And setting the size I want by changing those numbers, this is long, and sounds a bit too hard to be true, is there a more automatic or shorter way?

Offline

 

#2 2009-11-04 01:30:56 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5199

Re: Resizing Windows

As you've posted it, you're getting the window's frame three times, and it's not exactly reader-friendly. Your code will make more sense when you come back to it if you use something like this:

Applescript:

       set theFrame to windd's frame()
       set {{x:x1, y:y1}, {width:theWidth, height:theHeight}} to theFrame as list
       windd's setFrame_display_animate_({{x1, y1 + theHeight - 200)}, {900, 200}}, true, true)


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#3 2009-11-04 11:31:56 am

Richard
Member
From:: Herefordshire, UK
Registered: 2009-09-09
Posts: 529
Website

Re: Resizing Windows

Thanks, it's much easier now.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)