-- 打开一个safari新页签 tellapplication"Safari" tell window 1 set current tabto (make new tabwith properties {URL:"http://www.stackoverflow.com"}) endtell endtell
safari当前选中文字加上连接,制作成 markdown link
-- safari当前选中文字加上连接,制作成 markdown link
tellapplication"Safari"
ifnotrunningthen run delay0.5 endif activate -- Back up clipboard contents: set savedClipboard tothe clipboard tellapplication"System Events"to keystroke "c" using {command down} delay0.5-- Without this, the clipboard may have stale data. set nameText tothe clipboard tellapplication"System Events"to keystroke "l" using {command down} delay0.5-- Without this, the clipboard may have stale data. -- Copy selected text to clipboard: tellapplication"System Events"to keystroke "c" using {command down} delay0.5-- Without this, the clipboard may have stale data. set theSelectedText tothe clipboard -- display dialog "[" & name & "](" & theSelectedText & ")" setthe clipboardto"[" & nameText & "](" & theSelectedText & ")" endtell
set windowTitle to"" tellapplication"System Events" set frontApp tofirstapplication process whosefrontmostistrue set frontAppName tonameof frontApp asstring -- display dialog frontAppName if (frontAppName = "Firefox") then tellapplication"Firefox" activate -- Back up clipboard contents: set savedClipboard tothe clipboard tellapplication"System Events"to keystroke "c" using {command down} delay0.2-- Without this, the clipboard may have stale data. set nameText tothe clipboard tellapplication"System Events"to keystroke "l" using {command down} delay0.2-- Without this, the clipboard may have stale data. -- Copy selected text to clipboard: tellapplication"System Events"to keystroke "c" using {command down} delay0.2-- Without this, the clipboard may have stale data. set theSelectedText tothe clipboard -- display dialog "[" & name & "](" & theSelectedText & ")" setthe clipboardto"[" & nameText & "](" & theSelectedText & ")" endtell else tellapplication"Safari" activate -- Back up clipboard contents: set savedClipboard tothe clipboard tellapplication"System Events"to keystroke "c" using {command down} delay0.2-- Without this, the clipboard may have stale data. set nameText tothe clipboard tellapplication"System Events"to keystroke "l" using {command down} delay0.2-- Without this, the clipboard may have stale data. -- Copy selected text to clipboard: tellapplication"System Events"to keystroke "c" using {command down} delay0.2-- Without this, the clipboard may have stale data. set theSelectedText tothe clipboard -- display dialog "[" & name & "](" & theSelectedText & ")" setthe clipboardto"[" & nameText & "](" & theSelectedText & ") " endtell endif
-- us voice setting use sript -- 使用 alfed 来实现切换 siri的语音选项
on alfred_script(q) tellapplication"System Preferences" activate set current pane to pane "com.apple.preference.universalaccess" getthenameofevery anchor of current pane reveal anchor "TextToSpeech"of pane "com.apple.preference.universalaccess" endtell tellapplication"System Events" tell process "System Preferences" set visible totrue -- return every UI element of front window -- return name of every UI element of front window -- return every UI element of window 1 -- get name of every button of window 1 tell group 1of window 1 delay0.1 tell pop up button 1 click delay0.1 tell menu 1 click menu item6 endtell delay0.1 -- click menu item "系统声音" of menu 1 endtell endtell endtell endtell end alfred_script
-- jp voice setting use sript -- 使用 alfed 来实现切换 siri的语音选项,使用 jp 语音 on alfred_script(q) tellapplication"System Preferences" activate set current pane to pane "com.apple.preference.universalaccess" getthenameofevery anchor of current pane reveal anchor "TextToSpeech"of pane "com.apple.preference.universalaccess" endtell tellapplication"System Events" tell process "System Preferences" set visible totrue -- return every UI element of front window -- return name of every UI element of front window -- return every UI element of window 1 -- get name of every button of window 1 tell group 1of window 1 delay0.1 tell pop up button 1 click delay0.1 tell menu 1 click menu item3 endtell delay0.1 -- click menu item "系统声音" of menu 1 endtell endtell endtell endtell end alfred_script