MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
December
Sun Mon Tue Wed Thu Fri Sat
26 27 28
29 30 31        
2024
Months
Dec


Thu, Feb 25, 2016 10:51 pm

Using AppleScript to record the Safari browser windows and tabs

Sometimes I'd like to be able to save a list of what web pages are open in the Safari browser's tabs. Using Apple's AppleScript scripting language it is possible to record that information to a text file. The following script will create a text file that lists each Safari browser window that is open and for each tab within a window, the title for the webpage and the URL. The script will prompt for the location and name for the file where you wish to store that information (example output file).

tell application "Safari"
	
	set myFile to open for access (choose file name) with write permission
	set windowNumber to 1
	repeat the number of windows times
		set myTabs to every tab of window windowNumber
		write "----- Window Number " & windowNumber & " -----

" to myFile
		set tabNumber to 0
		repeat with aTab in myTabs
			
			set tabTitle to name of aTab & "
"
			write tabTitle to myFile
			set tabURL to URL of aTab & "

"
			write tabURL to myFile
			set tabNumber to tabNumber + 1
			
		end repeat
		
		write "Window Number: " & windowNumber & " Number of tabs: " & tabNumber & "

" to myFile
		set windowNumber to windowNumber + 1
	end repeat
	close access myFile
	
end tell

[ More Info ]

[/os/os-x/applescript] permanent link

Wed, Feb 24, 2016 11:05 pm

Using AppleScript to record the Chrome browser windows and tabs

I often have a number of browser windows open with many tabs open in the windows and wanted a way of producing a list of the open windows and the tabs within each with the title and URL for each tab. I had a simple AppleScript script that will display Firefox windows titles, but that just lists the active tab in each window whereas I wanted a list of every tab's title and URL, so I created a new script for Chrome that will create a text file containing that information.

[ More Info ]

[/os/os-x/applescript] permanent link

Tue, Jan 12, 2016 11:28 pm

Displaying Firefox Windows Titles With AppleScript

On an Apple, OS X system, the following AppleScript script will display the titles for the currently open windows in Firefox.

tell application "Firefox"
	
	set windowTitles to ""
	repeat with w in (every window whose visible is true)
		set windowTitles to windowTitles & "
" & "
" & name of w
	end repeat
	display dialog windowTitles
	
end tell

E.g., if I have 3 Firefox windows open, one of which has multiple tabs open, I might see something like the following:

Firefox Windows

The first window title displayed is for a Firefox window with 9 tabs open, but only the title for the currently selected tab "After sticking a land-based return, SpaceX will try the ocan again | Ars Technica" is displayed.

Note: putting an ending double quote on the line below the opening one results in a new line.

[/os/os-x/applescript] permanent link

Tue, Dec 22, 2015 11:23 pm

Displaying mail account information with AppleScript

Apple's AppleScript scripting language provides a means to obtain information from applications on a OS X system. Applications have a "dictionary" that can be consulted to determine what properties can be queried or altered. E.g., to see the dictionary for the Mail application on an OS X system, I can open the AppleScript Editor program found in Applications/Utilities, then click on File, select Open Dictionary and scroll down until I see the Mail application listed. I can then click on it to highlight it and then click on the Choose button to open that dictionary.

[ More Info ]

[/os/os-x/applescript] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo