text
stringlengths
0
15.7k
source
stringlengths
6
112
set partner to do JavaScript "document.getElementsByClassName('card-info vertical-box')[" & j & "].childNodes[1].textContent"
Web Scraping - Coursera Specializations.applescript
set subject to do JavaScript "document.getElementsByClassName('color-primary-text card-title headline-1-text')[" & j & "].textContent"
Web Scraping - Coursera Specializations.applescript
set difficulty to do JavaScript "document.getElementsByClassName('difficulty')[" & j & "].textContent"
Web Scraping - Coursera Specializations.applescript
set productType to do JavaScript "document.getElementsByClassName('_jen3vs _1d8rgfy3')[" & j & "].textContent"
Web Scraping - Coursera Specializations.applescript
set end of specializations to {partner, subject, difficulty, productType}
Web Scraping - Coursera Specializations.applescript
repeat with i from 1 to count of specializations
Web Scraping - Coursera Specializations.applescript
set value of cell (i + 1) of column 1 to item 1 of item i of specializations
Web Scraping - Coursera Specializations.applescript
set value of cell (i + 1) of column 2 to item 2 of item i of specializations
Web Scraping - Coursera Specializations.applescript
set value of cell (i + 1) of column 3 to item 3 of item i of specializations
Web Scraping - Coursera Specializations.applescript
set value of cell (i + 1) of column 4 to item 4 of item i of specializations
Web Scraping - Coursera Specializations.applescript
set mode to "disable"
disable_iphoto_sharing.applescript
return cur_path
get_cur_working_dir.applescript
computer name of (get system info)
computer name of (get system info).applescript
on rateTrack(trackToRate, newRating)
Rate Track.scpt
set the rating of the trackToRate to newRating
Rate Track.scpt
if the rating of the trackToRate is greater than or equal to 80 then
Rate Track.scpt
set disliked of the trackToRate to false
Rate Track.scpt
set loved of the trackToRate to true
Rate Track.scpt
if the rating of the trackToRate is less than or equal to 40 then
Rate Track.scpt
set loved of the trackToRate to false
Rate Track.scpt
set disliked of the trackToRate to true
Rate Track.scpt
set {updatedArtist, updatedAlbum, updatedSong, updatedRating} to the {artist, album, name, rating} of the trackToRate
Rate Track.scpt
set singleDigitRating to updatedRating / 20
Rate Track.scpt
set starRating to ""
Rate Track.scpt
repeat singleDigitRating times
Rate Track.scpt
set starRating to starRating & "★"
Rate Track.scpt
set response to "Rated “" & updatedSong & "“ by " & updatedArtist & " to " & starRating
Rate Track.scpt
end rateTrack
Rate Track.scpt
set today to date (short date string of (current date)) -- e.g. Friday, May 27, 2022 at 12:00:00 AM
Rate Track.scpt
set useUIAutomation to false
Rate Track.scpt
set newRating to 60 -- The default value for testing
Rate Track.scpt
if (count of input) is greater than 0 then
Rate Track.scpt
set newRating to the (first item of input) * 1
Rate Track.scpt
set currentAppProcess to the first process whose visible is true and frontmost is true
Rate Track.scpt
set currentApp to application (name of currentAppProcess as text)
Rate Track.scpt
if kind of current track is not "" then
Rate Track.scpt
return my rateTrack(current track, newRating)
Rate Track.scpt
set {artistName, albumName, songName, songLength} to the {artist, album, name, time} of the current track
Rate Track.scpt
set matchedTracks to (every track whose name is songName and album is albumName and artist is artistName)
Rate Track.scpt
if (count of matchedTracks) is greater than 0 then
Rate Track.scpt
return my rateTrack(first item of matchedTracks, newRating)
Rate Track.scpt
duplicate current track to source "Library"
Rate Track.scpt
set useUIAutomation to true
Rate Track.scpt
if useUIAutomation is true then
Rate Track.scpt
tell application process "Music"
Rate Track.scpt
if the name of the first window is not "MiniPlayer" then
Rate Track.scpt
if (windows whose name is "MiniPlayer") = {} then
Rate Track.scpt
tell menu "Window"
Rate Track.scpt
tell menu item "MiniPlayer"
Rate Track.scpt
tell (the first window whose name is "MiniPlayer")
Rate Track.scpt
perform action "AXRaise"
Rate Track.scpt
tell menu "Song"
Rate Track.scpt
if (menu items whose name is "Add to Library") is not {} then
Rate Track.scpt
click (the first menu item whose name is "Add to Library")
Rate Track.scpt
tell currentApp
Rate Track.scpt
set matchedTracks to (every track whose name is songName and album is albumName and artist is artistName and date added is greater than today)
Rate Track.scpt
repeat while (count of matchedTracks) is 0
Rate Track.scpt
set matchedTracks to (every track whose name is songName and album is albumName and artist is artistName and time is songLength)
Rate Track.scpt
on openWindow(radio_url)
pandoractl.scpt
tell window 0 -- this is the active window?
pandoractl.scpt
set new_tab to make new tab
pandoractl.scpt
tell new_tab to set URL to radio_url
pandoractl.scpt
on clickScript(button_class)
pandoractl.scpt
return "var elem = document.getElementsByClassName('" & button_class & "')[0]; if (elem.style.display != 'none') { elem.click(); }"
pandoractl.scpt
end clickScript
pandoractl.scpt
on sendCommand(cmd, radio_url)
pandoractl.scpt
set script_playpause to "var buttons = ['playButton', 'pauseButton']; var elem; for (index=0; index < buttons.length; ++index) { elem = document.getElementsByClassName(buttons[index])[0]; if (elem.style.display != 'none') { elem.click(); break; } }"
pandoractl.scpt
set script_play to clickScript("playButton")
pandoractl.scpt
set script_pause to clickScript("pauseButton")
pandoractl.scpt
set script_skip to clickScript("skipButton")
pandoractl.scpt
set script_voteup to clickScript("thumbUpButton")
pandoractl.scpt
set script_votedown to clickScript("thumbDownButton")
pandoractl.scpt
repeat with window_ in (every window)
pandoractl.scpt
repeat with tab_ in (every tab whose URL contains radio_url) of window_
pandoractl.scpt
if cmd = "play" then
pandoractl.scpt
tell tab_ to execute javascript script_play
pandoractl.scpt
else if cmd = "playpause" then
pandoractl.scpt
tell tab_ to execute javascript script_playpause
pandoractl.scpt
else if cmd = "pause" then
pandoractl.scpt
tell tab_ to execute javascript script_pause
pandoractl.scpt
else if cmd = "skip" then
pandoractl.scpt
tell tab_ to execute javascript script_skip
pandoractl.scpt
else if cmd = "upvote" then
pandoractl.scpt
tell tab_ to execute javascript script_voteup
pandoractl.scpt
else if cmd = "downvote" then
pandoractl.scpt
tell tab_ to execute javascript script_votedown
pandoractl.scpt
end sendCommand
pandoractl.scpt
set usage to "USAGE: pandoractl.scpt {play,playpause,pause,skip,upvote,downvote}"
pandoractl.scpt
set commands to {"play", "playpause", "pause", "skip", "upvote", "downvote"}
pandoractl.scpt
set radio_url to "http://www.pandora.com/"
pandoractl.scpt
if count of argv is equal to 1 then
pandoractl.scpt
set cmd to item 1 of argv
pandoractl.scpt
return usage & "\nerror: invalid arguments"
pandoractl.scpt
if commands does not contain cmd then
pandoractl.scpt
return usage & "\nerror: invalid command: " & cmd
pandoractl.scpt
if sendCommand(cmd, radio_url) is false and cmd is "play" then
pandoractl.scpt
openWindow(radio_url)
pandoractl.scpt
global d3status
d3status.scpt
set d3status to ""
d3status.scpt
if d3status is not "Available" then
d3status.scpt