brucexs wrote:

> One idea would be to dynamically create a bar with *control checkboxes
> for each active window as well as "Tile Hor" and "Tile Vert" buttons )
> (and close button too).    You'd need the latest beta, of course, and 
> also would have to be comfortable with scripting.

The attached script creates a bar with checkboxes for each visible
window. Check the windows you wish to tile and press left/middle/right
second button from the top.

Label @Action is called when you press the second button, and can
be changed to do something different from tiling windows. 

Label @Mark is called each time you check/uncheck a window.

If the vars plugin is loaded, this script also saves parameters of all
visible windows to file AllWindows.ini --I reused some code from an
unfinished window layout manager that I started a while ago. 

If you want to add buttons, do so at the top of the bar, and update
variable OFFSET accordingly. 

Save the script to file AllWindows.powerpro in your powerpro Scripts
folder. Run the script as       [EMAIL PROTECTED]

If you get syntax errors when you run the script verify that long lines
haven't been split by the forum software.

; ---- AllWindows.powerpro --------

jump Save

;---------------------------------------------------------------
;: ~
;: @Save saves parameters of all (visible) windows into
;: global vectore gvAllWindows
;: and into file AllWindows.ini (if vars.dll plugin loaded)
;: and returns ORDERED --as in [1..N]]-- list of window handles:
;: - parameters of i-th window are saved in vector gvAllWindows
;: - use @wininfoget(i,"named-parameter...") to retrieve them
@Save
  ;;0=visible, 1=hidden, 2=hidden no blank caption
local hl=win.handlelist("*",0)
if(not hl)
  quit("")

global gvAllWindows
if( gvAllWindows )do
  if( vec.exists(gvAllWindows) )
    gvAllWindows=vec.destroy(gvAllWindows)
endif
gvAllWindows=vec.create(5+word(hl,0),1)

local ret=""
local ml=word(hl,0)
local i h s
for(i=1; i<ml; i=i+1)
  h=word(hl,i)
  [EMAIL PROTECTED](h)
  ret=ret++" "++h
  gvAllWindows[i]=s
endfor

local _onerror=onerrorsetting
exec.onerror("clear none")
vars.save_var("gvAllWindows")
exec.onerror(_onerror)

quit(trim(ret," ",3))

;---------------------------------------------------------------
;: ~
;: @wininfo - grab and return parameters of window arg(1)
@wininfo
local n=esc(??\n?,??\?)
local h=arg(1)
local s = win.caption(h) ;;+
    ++n++win.visible(h) ;;+
    ++n++win.exename(h) ;;+
    ++n++win.exepath(h) ;;+
    ++n++win.getprocessid(h) ;;+
    ++n++win.class(h) ;;+
    ++n++win.maxxed(h)++win.minned(h)++;;+
         win.rolled(h)++win.topmost(h)++;;+
         win.trayminned(h) ;;+
    ++n++win.left(h)++","++win.top(h)++","++;;+
         win.width(h)++","++win.height(h) ;;+
    ++""
quit(s)

;---------------------------------------------------------------
;: ~
;: @wininfoidx - return index of parameter name arg(1)
;: return -1 if arg(1) not found
;i @wininfoidx must match lines returned by @wininfo
@wininfoidx
local list="caption visible exename exepath getprocessid "++;;+
           "class max-min-roll-top-min ltwh"

for(local i=word(list,0); i>0; i--)
  if( arg(1) == word(list,i) )
    quit(i)
endfor
quit(-1)

;---------------------------------------------------------------
;: ~
;: @wininfoget - return cancatenated values
;: of parameters in list arg(2) of window arg(1)
@wininfoget
args idx list
global gvAllWindows
local ret=""
for(local i=1; i<=word(list,0); i++)
  ret=ret++if(i>1," ")++;;+
      line(gvAllWindows[idx],[EMAIL PROTECTED](word(list,i)))
endfor
quit(ret)

;---------------------------------------------------------------
;: ~
;: @Selector creates dynamic bar with checkbox selection for
;: each window in global map gvAllWindows created by @Save
;: and returns list of selected window handles TODO
;i @Selector requires ppro version 4.5.08 and higher
@Selector
local i
local hcl=cl.create(scriptname++"Selector",1)
local [EMAIL PROTECTED]
if(not hw)
  quit
hcl.NewProperties("Vertical Position: Floating Flat "++;;+
"Tooltips AutoShowBar Topmost TextCenter "++;;+
"")
// "Back: 91 138 208 Text: 255 255 255 "++;;+
// "Gradient: 180"

local WIDTH=500 ;; button width

hcl.insert(0)
hcl.setwidth(0,WIDTH)
hcl.setbackcolor(0,0xa0a0a0)
hcl.settooltip(0,"(none)")
hcl.setlabel(0,"left=drag, middle=update right=close")
hcl.addleft(0,"format drag")
hcl.addmiddle(0,cb("@Selector"))
hcl.addright(0,"bar.close(cl.getlastbar)")
hcl.insert(1)
hcl.setbackcolor(1,0xd0d0d0)
hcl.setwidth(1,WIDTH)
hcl.settooltip(1,"(none)")
hcl.setlabel(1,"check windows then left=tile by rows, middle=by columns, 
right=by squares")
hcl.addleft(1,cb("@Action","r"))
hcl.addmiddle(1,cb("@Action","c"))
hcl.addright(1,cb("@Action","t"))

/* set OFFSET to next button index */
local OFFSET=2

for(i=word(hw,0); i>0; i--)
   hcl.insert(OFFSET)
   hcl.setwidth(OFFSET,WIDTH)
   hcl.settooltip(OFFSET,"(none)")
   hcl.setlabel(OFFSET,"*control button autocheckbox top ?'"++;;+
     [EMAIL PROTECTED](i,"caption exename")++"'")
   hcl.addleft(OFFSET,cb("@Mark",i,;;+
     "cl.getctrlvalue(cl.getlastbar,"++(i+OFFSET-1)++")",word(hw,i)) )
endfor
bar.show(scriptname++"Selector")
quit

;--------------------------------------------------------------
;: ~
;: @Mark is called by @Selector upon (un)ticking a window in
;: the control bar
;: arg(1) is the window index in global vector gvAllWindows
;: arg(2) is an expression yielding the control value (0|1)
;: arg(3) is the window handle
;: static CheckedWindows holds the list of checked windows
@Mark
args idx sChecked hWin
local bChecked=eval(sChecked)
static CheckedWindows
CheckedWindows["(?#g)"++hWin]=""
if( bChecked )
  CheckedWindows=trim(CheckedWindows++" "++hWin," ",3)
//win.debug(CheckedWindows)

/* see [EMAIL PROTECTED]
 caption visible exename exepath getprocessid class
 max-min-roll-top-min ltwh
*/
win.debug([EMAIL PROTECTED](idx,"caption ltwh"),;;+
  if(not bChecked,"un")++"checked")

/*
if( bChecked )do
  win.show(hWin)
else
  win.back(hWin)
endif
*/

quit

;--------------------------------------------------------------
;: ~
;: @Action performs an action on CheckedWindows
@Action
args sMode
  exec.tile("w"++sMode,replacechars(CheckedWindows," ,"))
quit
; ---------- script end --------



Attention: PowerPro's Web site has moved: http://www.ppro.org 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/power-pro/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/power-pro/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to