Hazel本身“寄居”在OS X的偏好設(shè)置里,默認(rèn)第一項(xiàng)“Folders”是我們定義規(guī)則的地方,左側(cè)欄設(shè)置規(guī)則執(zhí)行目錄,右側(cè)欄管理規(guī)則,點(diǎn)擊加號(hào)開始添加規(guī)則,這里舉3個(gè)栗子:
]]>ES 在官網(wǎng)提供了sample scripts ,里面分普通 Scripts 與Mobile Scripts 兩種,可以先down下來嘗試一把?!?a target="_blank">下載】。
如果手頭有一部iPhone的話,就可以安裝EventScripts Mobile App來遠(yuǎn)程觸發(fā)Mac上的腳本自動(dòng)運(yùn)行,這里用到了Bonjour技術(shù),使用前要在Mac端EventScripts里添加專用的Mobile Scripts,同時(shí)Event選擇“EventScripts Mobile”,然后在Preference-Server中勾選第一項(xiàng),隨意填入一個(gè)名稱,以此為桌面版EventScripts設(shè)立一個(gè)Server(password不用勾選也可):
這樣在Mobile App里會(huì)自動(dòng)發(fā)現(xiàn)server,連接后你會(huì)看到桌面版里添加的scripts赫然在列:
點(diǎn)擊script即可遠(yuǎn)程觸發(fā)腳本在Mac上運(yùn)行。
EventScripts 使用 Growl 來為用戶報(bào)告腳本執(zhí)行結(jié)果,同時(shí)也支持與Prowl連接來推送結(jié)果到iPhone/iPad上。
]]>
tell application "iTunes" set setupNeeded to false --fetch prior selected playlist name and playback rate try set targetPlaylistName to do shell script "defaults read com.jeffporten.fastpodcast SelectedPlaylist" set playbackRate to do shell script "defaults read com.jeffporten.fastpodcast PlaybackRate" on error -- probably first run of script set setupNeeded to true end try if setupNeeded is false then -- confirm using last settings set userReply to button returned of (display dialog "Play playlist \"" & targetPlaylistName & "\" at " & playbackRate & " speed?" buttons {"Cancel", "Change...", "OK"} default button "OK") if userReply is "Change..." then set setupNeeded to true end if if setupNeeded is true then -- set up new settings set listPlaylists to the name of every playlist set targetPlaylistName to (choose from list listPlaylists with prompt "Which playlist to play?" without multiple selections allowed and empty selection allowed) as text set selectedSpeed to button returned of (display dialog "Playback rate to use?" & return & return & "(?X and 2X correspond to iPod playback speeds, actually 75% and 150%)" buttons {"Custom", "?X", "2X"}) if selectedSpeed is "2X" then set playbackRate to 1.5 else if selectedSpeed is "?X" then set playbackRate to 0.75 else set playbackRate to text returned of (display dialog "Enter a playback speed. (1.0 is normal speed, 2.0 is true double-speed, 0.5 is true half-speed.)" default answer "1.0") end if end if --store settings in a non-AppleScripty way do shell script "defaults write com.jeffporten.fastpodcast SelectedPlaylist " & (quoted form of targetPlaylistName) do shell script "defaults write com.jeffporten.fastpodcast PlaybackRate " & (quoted form of (playbackRate as text)) --actually do the playback in QuickTime Player set targetPlaylist to playlist targetPlaylistName set trackList to tracks of targetPlaylist repeat with i from 1 to count trackList set thisTrack to item i of trackList set podcastName to album of thisTrack set thisLoc to location of thisTrack set thisDuration to duration of thisTrack tell application "QuickTime Player" activate open thisLoc play document 1 set rate of document 1 to playbackRate --if some podcasts should never be rate-altered, delete last line and use this instead --if (podcastName does not contain "Onion") then set rate of document 1 to 1.5 --or for multiple podcasts, add as many of these as you like before "then set rate": --and (podcastName does not contain "someOtherPodcast") set nextTrack to false set j to 0 --if the QTP player is manually ended by dragging the slider to the end, automatically starts next podcast --if QTP player is closed, script errors out of existence --otherwise, when playback is finished, script will close the QuickTime Player document and open the next track in the playlist repeat until nextTrack is true delay 2 if current time of document 1 ≥ duration of document 1 then set nextTrack to true end repeat close document 1 end tell --mark the track as played set played count of thisTrack to (played count of thisTrack) + 1 --I use this AppleScript line to set the rating of the podcast track to one star, which I delete later from a smart playlist --set rating of thisTrack to 20 end repeat end tell
粘入Applescipt,點(diǎn)擊“運(yùn)行”
在第一個(gè)彈出框中選擇播放速度,有1/2X和2X兩種,分別是實(shí)際速度的75%和150%
或是選擇“Custom”自定義速度,中間會(huì)讓你選擇播放列表,選擇“Podcasts”即可,輸入以0.5為增量的數(shù)值可以定義自己需要的快進(jìn)速度
確認(rèn)點(diǎn)“OK”
定義的速度會(huì)立即通過Quicktime實(shí)現(xiàn),在恢復(fù)普通播放速度后,你還可以使用Quicktime的快進(jìn)/快退鍵控制播放進(jìn)程。
]]>