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

Use Safari as a 'sliding' browser Web Browsers
Browsing has become much of a "add-on" these days, looking-up some info being a side-activity to what you do. New browsers (such as DeskBrowse) appear that quickly pop-up and disappear after use.

However, there is something to be said for keepng your main browser, as it holds all your URLs, history, log-ins, etc. So instead of changing browsers, try using this AppleScript with Safari. It gently slides your main Safari window in and out at the left of your screen with a pseudo-Quartz effect (yes, AppleScript is fast these days) as you hold your cursor there for a second.

It can be best invoked by defining a left-edge mouse trigger in Quicksilver, but you may define a similar event in QuicKeys X3, etc.

[robg adds: I tested this one (using Butler and a screen hot corner), and it works as described.]
    •    
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[13,237 views]  

Use Safari as a 'sliding' browser | 16 comments | Create New Account
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: julian1008 on Dec 28, '05 12:45:21PM

works great with iKey too. nice hint.
http://www.scriptsoftware.com/ikey



[ Reply to This | # ]
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 | # ]
Use Safari as a 'sliding' browser
Authored by: Bakari on Dec 28, '05 02:44:04PM

Thanks for this. Very nice work. It's a bit slow but it's nice to know it's an option. I'm using it as a Quicksilver corner action. And yes, it will be convenient when your desktop is crowded with other windows.



[ Reply to This | # ]
Use Safari as a 'sliding' browser
Authored by: ehouwink on Dec 29, '05 01:00:52AM

If you find the action too slow, experiment with the "speedfact" introduced in the latter (multi-window) version of the script.
At some point, however, I think that Applescript limits the speed.



[ Reply to This | # ]
Another direction?
Authored by: bilemshious on Dec 28, '05 11:40:43PM

Is there anyway to modify the script so that it slides in and out of another direction? Also, what other browsers have this ability besides the one mentioned?



[ Reply to This | # ]
Another direction?
Authored by: bilemshious on Dec 30, '05 09:49:02AM

No one has a clue how to change the direction?



[ Reply to This | # ]
Use Safari as a 'sliding' browser
Authored by: mark hunte on Dec 30, '05 03:44:39AM
And of course, you can use this Very nice script, with other apps. I change it to work with "Script Editor" which I have open most of the time. All I did was replace every instance of "Safari" with "Script Editor". Remember that application process names are case sensitive.

---
mh

[ Reply to This | # ]

Use Safari as a 'sliding' browser
Authored by: stevek on Dec 30, '05 12:42:27PM

I love this script, but when I use it to try and slide Safari back in, it just jitters around the left side of my screen and then disappears again. When I click the Safari dock icon, about 1/2 inch of my window appears from the left side, and I have to drag it out myself.

Is this happening to anyone else??



[ Reply to This | # ]
Use Safari as a 'sliding' browser
Authored by: ehouwink on Dec 30, '05 01:05:01PM

Try running it from within Script Editor and see what Safari's response is on the script's "set bounds" events. It should only stop as soon as item 1 of bounds > -10. You may try to increase that value. Here it runs as it should on 4 different Macs/Powerbooks with OSX 10.4.2 and 10.4.3



[ Reply to This | # ]
Use Safari as a 'sliding' browser
Authored by: sannixtudio on Jan 23, '06 04:09:15PM

How would I edit the script to "slide left"..... thanks.



[ Reply to This | # ]
Use Safari as a 'sliding' browser
Authored by: sannixtudio on Jan 23, '06 04:12:44PM

I meant "slide right".



[ Reply to This | # ]