SafariTabList



ONE Browser, formerly ibibo iBrowser, is a fast mobile browser designed to provide smartest internet browsing experience. Get Amazing Videos, Ringtones, Wallpapers, Games, Applications and News and much more - just a tap away. PokerGOPoker's OG rapper Prahlad Friedman goes up against HBO music producer Scott Vener and fan favorite WSOP Main Event final tablist Garry Gates. Two advance and one will.

SafariTabListFebruary 2012If you sometimes find yourself with so many tabs in Safari that you can't find things and end up opening them again in a new tab, this script can help.

It asks for a search term, which it matches against the name (title) of every open tab, as well as the URL. If it finds one match, it raises that window to the top and switches to that tab. If it finds multiple matches, it offers you a list of matches that you can select from.

setquestiontodisplay dialog ('Find Safari tab:') default answer '

setsearchpattotext returnedofquestion


tellapplication 'Safari'

setwinlisttoeverywindow

setwinmatchlistto {}

settabmatchlistto {}

settabnamematchlistto {}

repeatwithwininwinlist

setoktotrue

try

settablisttoeverytabofwin

onerrorerrmsg

--display dialog name of win as string

setoktofalse

endtry

ifokthen

repeatwithtintablist

ifsearchpatisin (nameoftasstring) then

setendofwinmatchlisttowin

setendoftabmatchlisttot

setendoftabnamematchlistto (idofwinasstring) & '.' & (indexoftasstring) & '.' & (nameoftasstring)

--display dialog name of t as string

elseifsearchpatisin (URLoftasstring) then

setendofwinmatchlisttowin

setendoftabmatchlisttot

setendoftabnamematchlistto (idofwinasstring) & '.' & (indexoftasstring) & '.' & (nameoftasstring)

--display dialog name of t as string

endif

endrepeat

endif

endrepeat

if (countoftabmatchlist) = 1 then

--display dialog 'one!'

setwtoitem 1 ofwinmatchlist

setttoitem 1 oftabmatchlist

setcurrent tabofwtot

setindexofwto 1

elseif (countoftabmatchlist) = 0 then

Safari tablet clear cache and cookies

display dialog 'No matches'

else

setwhichtabtochoose from listoftabnamematchlistwith prompt 'The following tabs match, please select one:'

Safari Tabs

setAppleScript's text item delimitersto '.'

ifwhichtabis notequal tofalsethen

settmptotext itemsof (whichtabasstring)

setwto (item 1 oftmp) asinteger

settto (item 2 oftmp) asinteger

SafariTabList

setcurrent tabofwindowidwtotabtofwindowidw

Safari Tablet Clear Cache And Cookies

setindexofwindowidwto 1

endif

endif

Safari Tabs Saver

endtell

To set this up, look in Applications, then Utilities, and run 'AppleScript Editor'. Cut and paste the program above into a new window there and save it as 'Find Safari Tab' (or whatever name you like), and place it in your home directory, under Library/Scripts. Then in the AppleScript Editor Preferences, check the box 'Show Script menu in menu bar (I also uncheck 'Show Computer scripts', which would show lots of system scripts you might not want). You'll get a script menu in your menubar with your new script in it. Just select it to run it.

This script has a younger brother which does roughlythe same thing for Terminal windows and tabs:Find Terminal Sessions.

And if you're wondering how I converted the AppleScript Editor formattedprogram into HTML, I also do that with software.I can convert any copied text that has formattinginto HTML.

Reader Comments(Experimental. Moderated, expect delays. Posts may be edited or ignored.I reserve the right to remove any or all comments, at any time.SafariTabList)

9 comments:

At 2017/05/09 11:27
Bob wrote:
What a great idea - been wanting to do something like this for a very long time. YEARS!!!

I then used this to create a service which allows a keyboard shortcut to be assigned to it and now anytime I need I just type in the shortcut and enter a string and get a list of Safari tabs that I can select from and bam - I'm where I wanted to be. So handy and so easy to use.

Thanks so much - you made my time in Safari so much more enjoyable.

At 2017/08/30 18:59
wrote:
Thanks, this is great (for a tab sprawler like me)!

I combined it with Safari>Debug>Miscellaneous flags>Show web process IDs in page titles.

Now I can also easily remedy PIDs that Activity Monitor identifies as not responding.

OSX 10.11.6 (15G1611), Safari 11.0 (11604.1.38.1.3)

At 2017/09/26 10:05
Xiang wrote:
This is a very important feature that Safari has been missing. Vim-emulation plugins for other browsers all allow searching through tabs with just one single key, e.g. Vimperator or cVim. If there could be a shortcut set to invoke this, it would be even better. Seems that one can indeed assign a shortcut to launch Applescript as described at for example here: https://apple.stackexchange.com/questions/175215/how-do-i-assign-a-keyboard-shortcut-to-an-applescript-i-wrote
At 2018/05/15 12:46
Don J J Carroll wrote:
Tuesday, May 15, 2018, 1:33 PM

I have a question about this script. What I am looking for is a way to search tabs in several open Safari (MacOS) windows, not just one window that has several tabs, but multiple window each with multiple tabs. Will this script do what I am looking for? If not, are there other alternatives for me to pursue?

I have tried to copy this script into my Mac OS 10.12.6 Sierra Utilities folder 'Script Editor' and it won't allow me. When I open the Script Editor I get a blank dialog box and I can't even type anything into that space.

Here's hoping you knowledgeable folks can help a computer Mac novice!

Don J J Carroll

At 2018/05/15 15:50
wrote:
Hi,

Yes it should search all tabs on all open windows.

Try opening the Script Editor Application in /Applications/Utilities, create a new script, and paste the program into the new script window.

At 2018/08/22 2:11
Wayne wrote:
I installed this a few months ago and it was working well - until recently. After launching it from the menu bar it would prompt for the search term but then *poof* - nada/rien/nihil.
Running it from Script Editor revealed that a number of items were returning missing value - quite a few like this: and then also this: and the resulting untrapped error was killing the script: So to stop it from bombing I've had to wrap the innards of the scan loop in try/end try: I can only surmise that this situation is perhaps the result of an embarrassingly large number of Safari windows/tabs, open for an extended period of time.

Thanks very much for publishing your script. While it isn't quite the 'Tab Organiser' for Chrome that I'm hoping to one day have it is nonetheless a very useful alternative.

At 2018/09/04 11:17
Demitri wrote:
Would you be willing to put your script as an answer here?

https://stackoverflow.com/questions/30242098/applescript-find-open-tab-in-safari-by-name-and-open-it#30242514

I didn't want to take the liberty of copying your code, but sometimes (when I'm on a new computer) my search engine brings me to that page. Your script is the best solution I've found and I use it all the time!

At 2018/09/04 12:28
wrote:
Feel free to put either a link to my code, or a copy of the code there. A link is probably better as it will lead people to any corrections or enhancements that get posted here.
At 2019/04/24 10:28
MacsSince87 wrote:
2019-04 Working great in Mojave with mods (1) to ignore spurious windows and (2) to add window activation workaround.
Posted a link to this page and the updated code at:
'Stackoverflow 30242098'

Safari Tablet

End Comments

More Mac OS X Stuff

Safari Tabs Ipad

Fine's HomeSend Me Email




Comments are closed.