Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use Safari as a 'sliding' browser' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use Safari as a 'sliding' browser
Authored by: ehouwink on Dec 28, '05 01:24:20PM
With this modification of the script, it now handles multiple Safari windows:

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

if (keys pressed) ? {} then tell application fApp to activate

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


[ Reply to This | # ]
Multi window 'sliding' browser
Authored by: mark hunte on Dec 29, '05 03:43:53AM

As far as I know,
Your
if (keys pressed)
will not work without people having the jons commands scripting addition.

http://www.versiontracker.com/dyn/moreinfo/macosx/2274

99% of people will not have this addition. So your script will not compile.

IMHO its best not to submit scripts that can not be compiled or run without explaining this in the submit.



---
mh



[ Reply to This | # ]
Multi window 'sliding' browser
Authored by: robg on Dec 29, '05 05:46:03AM

This script worked fine for me (10.4.3), and I do *not* have Jon's Command installed...

-rob.



[ Reply to This | # ]
Multi window 'sliding' browser
Authored by: bschmidt on Dec 29, '05 09:55:02AM

hmm. I'm running 10.4.3 and I don't have Jon's Commands installed, and the script is failing for me on 'keys pressed'...

---
...ben



[ Reply to This | # ]
(Keys Pressed) issue
Authored by: ehouwink on Dec 29, '05 01:26:37PM
Your right. Just delete the line containing

(keys pressed) 
as it is not functional anymore (slipped through from debugging

[ Reply to This | # ]
Use Safari as a 'sliding' browser
Authored by: robg on Dec 29, '05 05:47:17AM

I have updated the file linked in the hint to match the modified script above...

-rob.



[ Reply to This | # ]