text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set the clipboard to theString | note.applescript |
keystroke "d" using {command down} | note.applescript |
keystroke "v" using {command down} | note.applescript |
key code 36 | note.applescript |
end addFavoriteChrome | note.applescript |
addFavoriteChrome("aaa") | note.applescript |
/* | SpotifyLyrics.scpt |
Written in JXA (Javascript for Automation). | SpotifyLyrics.scpt |
Simple script to Google search for lyrics of the song currently playing on Spotify. | SpotifyLyrics.scpt |
*/ | SpotifyLyrics.scpt |
var app = Application.currentApplication(); | SpotifyLyrics.scpt |
app.includeStandardAdditions = true; | SpotifyLyrics.scpt |
var spotify = Application('Spotify'); | SpotifyLyrics.scpt |
if (spotify.running()){
var trackName = spotify.currentTrack().name();
var artist = spotify.currentTrack().artist();
var mySearch = trackName + ' ' + artist + ' lyrics OR 歌詞';
app.doShellScript("open 'https://google.com/search?q='" + encodeURI(mySearch));
} else { | SpotifyLyrics.scpt |
app.displayAlert('👋 Spotify is not running', { message: 'I can only search for lyrics of songs playing in Spotify.' }); | SpotifyLyrics.scpt |
} | SpotifyLyrics.scpt |
on checkForceOpen(this_URL, appName, handle) | UrlToAppHandler.applescript |
set diagText to appName & " handle '" & handle & "' - from URL '" & this_URL & "' might not be valid. Open in " & appName & " anyway?" | UrlToAppHandler.applescript |
display dialog diagText buttons {"Open in " & appName, "Open in Browser", "Cancel"} with icon caution default button 1 cancel button 3 | UrlToAppHandler.applescript |
if result = {button returned:"Open in " & appName} then | UrlToAppHandler.applescript |
openApp(appName, handle) | UrlToAppHandler.applescript |
else if result = {button returned:"Open in Browser"} then | UrlToAppHandler.applescript |
openApp("Browser", this_URL) | UrlToAppHandler.applescript |
display notification "Not opening URL '" & this_URL & "'" | UrlToAppHandler.applescript |
end checkForceOpen | UrlToAppHandler.applescript |
on regexTest(str, regex) | UrlToAppHandler.applescript |
set retVal to (do shell script "[[ " & quoted form of str & " =~ " & regex & " ]]; printf $?") | UrlToAppHandler.applescript |
return "0" = retVal | UrlToAppHandler.applescript |
end regexTest | UrlToAppHandler.applescript |
on openApp(appName, handle) | UrlToAppHandler.applescript |
if appName = "Chime" then | UrlToAppHandler.applescript |
do shell script "open " & "chime://meeting?pin=" & handle | UrlToAppHandler.applescript |
else if appName = "Quip" then | UrlToAppHandler.applescript |
do shell script "open " & "quip://" & handle | UrlToAppHandler.applescript |
else if appName = "Browser" then | UrlToAppHandler.applescript |
do shell script "open " & "x-choosy://chrome.work/" & handle | UrlToAppHandler.applescript |
else if appName = "Outlook" then | UrlToAppHandler.applescript |
do shell script "mdfind 'com_microsoft_outlook_recordID == " & handle & "' -0 | xargs -0 open" | UrlToAppHandler.applescript |
end openApp | UrlToAppHandler.applescript |
on processChimeURL(this_URL) | UrlToAppHandler.applescript |
set handle to text item 4 of this_URL | UrlToAppHandler.applescript |
if regexTest(handle, "^[[:digit:]]{10}") then | UrlToAppHandler.applescript |
openApp("Chime", handle) | UrlToAppHandler.applescript |
checkForceOpen(this_URL, "Chime", handle) | UrlToAppHandler.applescript |
end processChimeURL | UrlToAppHandler.applescript |
on processQuipURL(this_URL) | UrlToAppHandler.applescript |
if regexTest(handle, "^[A-Za-z0-9]{12}") then | UrlToAppHandler.applescript |
openApp("Quip", handle) | UrlToAppHandler.applescript |
checkForceOpen(this_URL, "Quip", handle) | UrlToAppHandler.applescript |
end processQuipURL | UrlToAppHandler.applescript |
on processOutlookURL(this_URL) | UrlToAppHandler.applescript |
set handle to text item 3 of this_URL | UrlToAppHandler.applescript |
if regexTest(handle, "^[[:digit:]]+") then | UrlToAppHandler.applescript |
openApp("Outlook", handle) | UrlToAppHandler.applescript |
display dialog "Outlook handle '" & handle & "' from URL '" & this_URL & "' is not valid." | UrlToAppHandler.applescript |
end processOutlookURL | UrlToAppHandler.applescript |
on open location this_URL | UrlToAppHandler.applescript |
set AppleScript's text item delimiters to "/" | UrlToAppHandler.applescript |
if regexTest(this_URL, "chime.aws") then | UrlToAppHandler.applescript |
processChimeURL(this_URL) | UrlToAppHandler.applescript |
else if regexTest(this_URL, "quip-amazon.com") then | UrlToAppHandler.applescript |
processQuipURL(this_URL) | UrlToAppHandler.applescript |
else if regexTest(this_URL, "^outlookmsg") then | UrlToAppHandler.applescript |
processOutlookURL(this_URL) | UrlToAppHandler.applescript |
display dialog "URL not supported: '" & this_URL & "'" | UrlToAppHandler.applescript |
end open location | UrlToAppHandler.applescript |
set chosenWorkspace to (choose from list (workspaces as list) ¬ | Switch workspace.applescript |
with prompt "Choose workspace" ¬ | Switch workspace.applescript |
without multiple selections allowed ¬ | Switch workspace.applescript |
and empty selection allowed) | Switch workspace.applescript |
if chosenWorkspace ≠ false then -- User chose, not cancelled | Switch workspace.applescript |
if exists (current workspace) then | Switch workspace.applescript |
save workspace (get current workspace) | Switch workspace.applescript |
close every think window | Switch workspace.applescript |
load workspace (item 1 of chosenWorkspace) | Switch workspace.applescript |
on error msg number err | Switch workspace.applescript |
if err is not -128 then ¬ | Switch workspace.applescript |
display alert "DEVONthink" message msg as warning | Switch workspace.applescript |
set full_path to (path to desktop as text) &"record_data" | Script 17-11.applescript |
set the_record to read file full_path as record | Script 17-11.applescript |
set query to "{query}" | controller copy.applescript |
set PAUSE_A to "pause" | controller copy.applescript |
set PAUSE_SHORT to "p" | controller copy.applescript |
set NEXT to "next" | controller copy.applescript |
set NEXT_SHORT to "ne" | controller copy.applescript |
set PREVIOUS to "previous" | controller copy.applescript |
set PREVIOUS_SHORT to "pr" | controller copy.applescript |
set LOVE to "love" | controller copy.applescript |
set LOVE_SHORT to "lv" | controller copy.applescript |
set VOLUME_UP to "volumeup" | controller copy.applescript |
set VOLUME_DOWN to "volumedown" | controller copy.applescript |
set VOLUME_UP_SHORT to "vu" | controller copy.applescript |
set VOLUME_DOWN_SHORT to "vd" | controller copy.applescript |
set OPEN_LYRIC to "lyric" | controller copy.applescript |
set OPEN_LYRIC_SHORT to "ly" | controller copy.applescript |
set EXIT_A to "exit" | controller copy.applescript |
set EXIT_SHORT to "ex" | controller copy.applescript |
tell application "System Events" to tell process "QQMusic" | controller copy.applescript |
if query is equal to EXIT_A or query is equal to EXIT_SHORT then | controller copy.applescript |
click menu item "退出QQ音乐" of menu "QQ音乐" of menu bar item "QQ音乐" of menu bar 1 | controller copy.applescript |
Subsets and Splits