home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 6
/
AACD06.ISO
/
AACD
/
System
/
T.H.E.
/
REXX
/
SortAppIcon.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-11-14
|
2KB
|
82 lines
/*
$VER: SortAppIcon.rexx 1.0 (14.11.99) Copyright (c) Nils Görs.
will sort APPICONS and TOOLS at the bottom of the Workbench window.
*/
spacex = 6
spacey = 10
startx = 10
options results
ADDRESS WORKBENCH
GETATTR OBJECT WINDOWS.ACTIVE /* Ist "root" das aktive Fenster? */
IF result ~= "root" THEN EXIT /* Nein, dann brechen wir an dieser Stelle ab! */
activeWin = result
GETATTR OBJECT WINDOW.ICONS.ALL.COUNT NAME '"'||activeWin||'"'
NumOfIcons = result
GETATTR OBJECT WINDOW.SCREEN.HEIGHT NAME '"'||activeWin||'"'
winHeight = result
GETATTR OBJECT WINDOW.SCREEN.WIDTH NAME '"'||activeWin||'"'
winWidth = result
GETATTR APPLICATION.FONT.SCREEN.HEIGHT
FontHeight = result
maxiconheight = 0
maxiconwidth = 0
posx = 0
numIcon = 0
changes = 0
do i = 0 to numofIcons-1
GETATTR OBJECT WINDOW.ICONS.ALL.i NAME '"'||activeWin||'"' STEM IconInfo.i
IF IconInfo.i.type = "APPICON" | IconInfo.i.type = "TOOL" THEN DO
IF posx > winWidth THEN DO
winheight = winheight - maxiconheight - fontHeight
posx = 0
numIcon = 0
END
GETATTR APPLICATION.FONT.SCREEN.SIZE NAME '"'||IconInfo.i.name||'"'
namesize = result
IF IconInfo.i.HEIGHT > maxiconheight THEN maxiconheight = IconInfo.i.HEIGHT
posy = winHeight-4 - IconInfo.i.height - fontHeight - fontHeight
IF namesize > IconInfo.i.WIDTH THEN posx = namesize + posx + spacex
ELSE posx = IconInfo.i.WIDTH + posx + spacex
IF posx+IconInfo.i.WIDTH > winWidth THEN DO
posy = posy - maxiconheight - fontHeight
posx = 0
winheight = posy + maxiconheight + fontHeight + fontHeight
numIcon = 0
END
IF numicon = 0 THEN posx = startx
ICON WINDOW '"'||activeWin||'"' '"'||IconInfo.i.Name||'"' X posx Y posy
numIcon = 1
changes = 1
END
END
IF changes = 1 THEN DO
requesterdata='`requestchoice "SortAppIcon.rexx" "Save changes to disk?" "Yes|No"`'
IF ShellResult(requesterdata) = 1 THEN MENU WINDOW '"'||activeWin||'"' INVOKE WINDOW.SNAPSHOT.ALL
END
EXIT
ShellResult:
PARSE ARG ShellCmd
cmdid='req'pragma('id')
address command 'rxset' cmdid Shellcmd
from_Shell=getclip(cmdid)
call setclip(cmdid,'')
RETURN(from_Shell)