Archive for the ‘Safari’ Category

Открыть и сохранить

Friday, August 22nd, 2008

Скрипт открывает страницу в Safari и сохраняет ее как myfile_03-05-2008.html

tell application "Safari"
 	activate
	make new document at end of documents
	set URL of document 1 to "http://mymans.org"
	get document 1
	delay 3
	set pathToSave to (path to desktop as text) & ("myfile_") & (do shell script "date '+%d-%m-%Y'")
	save document 1 in file pathToSave
end tell

Дебаг для Safari под Window

Monday, March 31st, 2008

добавить в

C:\Documents and Settings\%username%\
Application Data\Apple Computer\Safari\Preferences.plist

строчки

IncludeDebugMenu

автор Pavel Grishin

Вызов JS через AppleScript

Wednesday, March 5th, 2008

Ага, не удивляйтесь, но AppleScript позваляет управлять JavaScript на прямую через браузер. Например вызывать alert

tell application "Safari"
	do JavaScript "alert('hi')" in document 1
end tell

Или вызвать функцию на странице

tell application "Safari"
	do JavaScript "doSome()" in document 1
end tell