text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
if number of text items of theName > 1 then | example.scpt |
set theName to text items 1 thru -2 of theName | example.scpt |
set theItems to "" | example.scpt |
repeat with i from 1 to count of theName | example.scpt |
set theItems to theItems & "\"" & ((item i of theName) as text) & "\"" & "," | example.scpt |
set theItems to text 1 thru -2 of theItems | example.scpt |
do shell script "python /PATH/TO/THE/PYTHON/SCRIPT" & theItems & " " & quoted form of thePath | example.scpt |
set wkday to (get weekday of (current date)) as Unicode text | gday.applescript |
set the clipboard to wkday | gday.applescript |
property imageURLPath : "http://www.example.com/" | Finder images to img tag markup.applescript |
property localFileOutput : "~/Desktop/IMG\\ Tag\\ Markup.html" | Finder images to img tag markup.applescript |
display dialog "Enter the URL Path to the image folder" default answer imageURLPath buttons {"Cancel", "OK"} default button 2 | Finder images to img tag markup.applescript |
if button_pressed is "OK" then | Finder images to img tag markup.applescript |
set imageURLPath to text_returned | Finder images to img tag markup.applescript |
repeat with anItem in theSelection | Finder images to img tag markup.applescript |
set thisImage to open (get anItem as alias) | Finder images to img tag markup.applescript |
set {thisWidth, thisHeight} to dimensions of thisImage | Finder images to img tag markup.applescript |
close thisImage | Finder images to img tag markup.applescript |
set thisLine to "<IMG SRC=\"" & imageURLPath & (name of anItem) & "\" WIDTH=" & thisWidth & " HEIGHT=" & thisHeight & " />" | Finder images to img tag markup.applescript |
do shell script "echo '" & thisLine & "' >> " & localFileOutput | Finder images to img tag markup.applescript |
display dialog "title" buttons {"btn1","btn2","btn3"} default button "btn2" | default button.applescript |
set returned to display dialog "Enter project name" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue" | new_evernote_project.applescript |
set projectName to text returned of returned | new_evernote_project.applescript |
if projectName is not equal to "" then exit repeat | new_evernote_project.applescript |
if tag named projectName exists then | new_evernote_project.applescript |
tell current application to display dialog "exists" | new_evernote_project.applescript |
set parentTag to tag named "projects" | new_evernote_project.applescript |
set projectTag to make tag with properties {name:projectName, parent:parentTag} | new_evernote_project.applescript |
set parent of projectTag to parentTag | new_evernote_project.applescript |
set projectNote to create note title projectName notebook "H1: Projects" with text " " | new_evernote_project.applescript |
assign projectTag to projectNote | new_evernote_project.applescript |
open note window with projectNote | new_evernote_project.applescript |
if (not downloaded of _art) then | Remove Embedded Artwork.applescript |
delete _art | Remove Embedded Artwork.applescript |
set ffolder to "Users:Me:Music" | Wait For Copy To Finish Before Execute.applescript |
set x to ffolder as alias | Wait For Copy To Finish Before Execute.applescript |
set y to (size of (info for x)) / 1024 as integer | Wait For Copy To Finish Before Execute.applescript |
set z to (size of (info for x)) / 1024 as integer | Wait For Copy To Finish Before Execute.applescript |
if y is equal to z then | Wait For Copy To Finish Before Execute.applescript |
copy {1993, 4, 10, 0} to {year of exampleDate, day of exampleDate, month of exampleDate, time of exampleDate} | datestamp.applescript |
log datestamp(exampleDate, 1) | datestamp.applescript |
log datestamp(exampleDate, 3) | datestamp.applescript |
log datestamp(exampleDate, 4) | datestamp.applescript |
on datestamp(aDate as date, aFormat) | datestamp.applescript |
if aFormat is 1 or aFormat is 2 then | datestamp.applescript |
return text 1 thru 10 | datestamp.applescript |
return item (month of aDate) of shortMonths & " " & (day of aDate as text) | datestamp.applescript |
else if aFormat is 4 or aFormat is 5 then | datestamp.applescript |
return text 1 thru 4 & text 6 thru 7 & text 9 thru 10 | datestamp.applescript |
error "datestamp(): Unknown time format: " & (aFormat as text) number 1 | datestamp.applescript |
end datestamp | datestamp.applescript |
set user_name to word -1 of my findReplace(".scpt", "", (path to me as text)) | Switch to User.applescript |
set user_id to do shell script "/usr/bin/id -u " & user_name | Switch to User.applescript |
set user_password to (do shell script "security find-generic-password -g -s \"" & user_name & "\" -D \"User Login\" 2>&1 1>/dev/null | sed -e 's/password: \"//' -e 's/\"//'") | Switch to User.applescript |
do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID " & user_id | Switch to User.applescript |
repeat until exists process "SecurityAgent" | Switch to User.applescript |
tell process "SecurityAgent" | Switch to User.applescript |
set value of text field 1 of window 1 to user_password | Switch to User.applescript |
exit | Switch to User.applescript |
on control(keyCode) | controller.scpt |
set code to "(function (keyCode) {
const event = new KeyboardEvent('keydown', { keyCode }) | controller.scpt |
document.dispatchEvent(event) | controller.scpt |
})(" & keyCode & ") | controller.scpt |
set targetTab to activeTab() of me | controller.scpt |
if targetTab is not null then | controller.scpt |
executeJavaScript(targetTab, code) of me | controller.scpt |
end control | controller.scpt |
on getPlayState() | controller.scpt |
set stateCode to "document.querySelector('#player-bar-play-pause').getAttribute('aria-label')" | controller.scpt |
set oppositeState to executeJavaScript(targetTab, stateCode) of me | controller.scpt |
if oppositeState is "Play" then | controller.scpt |
return "Paused" | controller.scpt |
return "Playing" | controller.scpt |
end getPlayState | controller.scpt |
on getCurrentSong() | controller.scpt |
set songCode to "document.querySelector('#currently-playing-title').innerHTML" | controller.scpt |
set song to executeJavaScript(targetTab, songCode) of me | controller.scpt |
set artistCode to "document.querySelector('.currently-playing-details').innerText" | controller.scpt |
set artist to executeJavaScript(targetTab, artistCode) of me | controller.scpt |
return {song, artist} | controller.scpt |
end getCurrentSong | controller.scpt |
on notifyCurrentSong() | controller.scpt |
set songDetails to getCurrentSong() of me | controller.scpt |
notify(item 1 of songDetails, item 2 of songDetails) of me | controller.scpt |
end notifyCurrentSong | controller.scpt |
on notify(name, message) | controller.scpt |
display notification message with title name | controller.scpt |
on activeTab() | controller.scpt |
set targetTab to null | controller.scpt |
if theTab's title ends with "- Google Play Music" then | controller.scpt |
return targetTab | controller.scpt |
end activeTab | controller.scpt |
on executeJavaScript(activeTab, code) | controller.scpt |
return execute activeTab javascript code | controller.scpt |
end executeJavaScript | controller.scpt |
-- This property should contain the path to our template | Script 26-9.applescript |
property template_path : "Macintosh HD:Users:sstanley:Documents:Template.indd" | Script 26-9.applescript |
on open file_list | Script 26-9.applescript |
set desktop_path to path to desktop as text | Script 26-9.applescript |
set user interaction level of script preferences to never interact | Script 26-9.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.