tell application "Safari" to activate tell application "System Events" set fApp to name of some application process whose frontmost is true set appz to name of application processes end tell set SlideoutInitially to "Safari" is in appz and "Safari" is not in fApp set wasBig to false set wasF to "Safari" is in fApp tell application "Safari" if number of documents < 1 then make new document set theDocs to documents set docName to name of item 1 of theDocs set {bds1, bds2, bds3, bds4} to bounds of window docName end tell set wasBig to (bds3 > 1) if not wasF then if SlideoutInitially then tell application "Safari" set {bds1, bds2, bds3, bds4} to bounds of window docName set bounds of window docName to {1 + bds1 - bds3, bds2, 1, bds4} end tell end if my slidein(theDocs) return end if if not wasBig then my slidein(theDocs) else my slideout(theDocs) end if on slideout(theDocs) tell application "Safari" set speedfact to 3 * (number of items of theDocs) activate repeat with theDoc in theDocs set docName to name of theDoc set {bds1, bds2, bds3, bds4} to bounds of window docName set visible of window docName to true set bdSve to {bds1, bds2, bds3, bds4} set i to 1 repeat until bds3 < 20 set i to i + 1 set bds1 to bds1 - 2 * i * speedfact set bds3 to bds3 - 2 * i * speedfact set bdz to {bds1, bds2, bds3, bds4} set bounds of window docName to bdz end repeat set bounds of window docName to {1 + bds1 - bds3, bds2, 1, bds4} end repeat end tell tell application "System Events" to set visible of application process "Safari" to false end slideout on slidein(theDocs) tell application "Safari" activate set speedfact to 2 * (number of items of theDocs) repeat with i from number of items in theDocs to 1 by -1 set docName to name of document i set {bds1, bds2, bds3, bds4} to bounds of window docName set visible of window docName to true set bdSve to {bds1, bds2, bds3, bds4} set i to 1 repeat set i to i + 1 set bds1 to bds1 + 2 * i * speedfact set bds3 to bds3 + 2 * i * speedfact if bds1 > -10 then exit repeat set bdz to {bds1, bds2, bds3, bds4} set bounds of window docName to bdz end repeat set bounds of window docName to {1, bds2, 1 + bds3 - bds1, bds4} end repeat end tell end slidein