text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
end substr | +strings.applescript |
on LCS(|s₀| as text, |t₀| as text) | +strings.applescript |
local |s₀|, |t₀| | +strings.applescript |
property s : substr(|s₀|) | +strings.applescript |
property t : substr(|t₀|) | +strings.applescript |
property list : intersection(s, t) | +strings.applescript |
return the last item of the result's list | +strings.applescript |
end LCS | +strings.applescript |
on anagrams(t as text) | +strings.applescript |
property s : characters of t | +strings.applescript |
to permute(i, k) | +strings.applescript |
local i, k | +strings.applescript |
if i > k then set end of my result to s as text | +strings.applescript |
repeat with j from i to k | +strings.applescript |
swap(s, i, j) | +strings.applescript |
permute(i + 1, k) | +strings.applescript |
end permute | +strings.applescript |
permute(1, length of t) | +strings.applescript |
unique_(its result) | +strings.applescript |
end anagrams | +strings.applescript |
set people2Send to {} -- start off with an empty list | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set everybody to read file ("Macintosh HD:Users:sjardim:people_to_send.txt") | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set rootPath to "/Users/sjardim/pdf/" | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set pcount to count paragraphs in everybody | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
repeat with i from 1 to number of paragraphs in everybody | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set this_item to paragraph i of everybody | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set thisName to "" -- set to blank | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set para_text to text of this_item | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set thisName to text item 1 of para_text | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set emailAddress to text item 2 of para_text | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set thisFile to rootPath & text item 3 of para_text & ".pdf" | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
log thisFile | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set emailCcAddress to text item 4 of para_text | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set emailCcAddress2 to text item 5 of para_text | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set ccAddressesList to {} -- new list to contain multiple cc address | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
copy emailCcAddress to the end of the ccAddressesList | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
copy emailCcAddress2 to the end of the ccAddressesList | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
if emailCcAddress as string is not equal to "" then | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
copy {_name:thisName, _address:emailAddress, _Ccaddress:emailCcAddress, _file:thisFile} to end of people2Send | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
copy {_name:thisName, _address:emailAddress, _Ccaddress:"", _file:thisFile} to end of people2Send | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
repeat with eachPerson in people2Send -- now loop through the names/addresses from above | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set theAccount to (second exchange account) | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set msgSubject to "Your Workshop Certificate" | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set fromPerson to "<strong>John Smith</strong>" | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set msgBody to "Dear " & (_name of eachPerson) & "," & "<br>" & "Thank you for attending our workshop. Please find enclosed your certificate of attendance as a PDF attachment." & "<br>" & "We thank you for taking part in this training initiative." & "<br><br>" & "Best regards," & "<br>" & fromPerson -- here's where you craft the message text | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
set newMsg to (make new outgoing message with properties {account:theAccount, subject:msgSubject, content:msgBody}) -- create the message | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
tell newMsg | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
make new recipient at end of to recipients with properties {email address:{name:eachPerson's _name, address:eachPerson's _address}} -- add the recipient | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
repeat with address in ccAddressesList | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
if eachPerson's _Ccaddress as string is not equal to "" then | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
make new recipient at end of cc recipients with properties {email address:{address:address}} -- add the recipient | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
make new attachment with properties {file:eachPerson's _file} -- add an attachment | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
open newMsg -- and just open it | sent-mail-text-file-en_outlook-multiple-cc-addresses.scpt |
do shell script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --allow-ssl-mitm-proxies" | chrome_allow_ssl_proxies.scpt |
set shouldDisplayNotification to false | count_favorites.applescript |
set favCount to count of (every collection whose user is true and kind is favorite) | count_favorites.applescript |
if shouldDisplayNotification then | count_favorites.applescript |
display notification "There are " & (favCount) & " favorites" | count_favorites.applescript |
display dialog "There are " & (favCount) & " favorites" buttons {"OK"} default button "OK" | count_favorites.applescript |
set currentName to currentTab's name | Script example.applescript |
log currentName | Script example.applescript |
log currentURL | Script example.applescript |
set currentVisi to currentTab's visible | Script example.applescript |
log currentVisi | Script example.applescript |
set URL of currentTab to "http://www.google.com" | Script example.applescript |
set twoName to (tab 2 of front window)'s name | Script example.applescript |
log twoName | Script example.applescript |
set lastName to (last tab of front window)'s name | Script example.applescript |
log lastName | Script example.applescript |
set currentTabNum to index of current tab of front window | Script example.applescript |
log currentTabNum --the selected tab can't be the first or last | Script example.applescript |
set nextTab to (tab (currentTabNum + 1) of front window) | Script example.applescript |
set nextName to nextTab's name | Script example.applescript |
log nextName | Script example.applescript |
set prevTab to (tab (currentTabNum - 1) of front window) | Script example.applescript |
set prevName to prevTab's name | Script example.applescript |
log prevName | Script example.applescript |
set tabsInfo to {} as list | Script example.applescript |
set tabsInfo to tabsInfo() as list | Script example.applescript |
log tabsInfo | Script example.applescript |
log _name of item 2 of tabsInfo | Script example.applescript |
close current tab of front window | Script example.applescript |
if exists tab 3 of front window then beep | Script example.applescript |
make new tab at (end of front window) | Script example.applescript |
make new tab at (tab 4 of front window) --this has to be a tab number that doesn't already exist | Script example.applescript |
open (((path to desktop as string) & "file.txt") as string) --obviously, this has to be a real file. can be alias or string | Script example.applescript |
email contents of (current tab of front window) --only works with some mail clients | Script example.applescript |
show bookmarks | Script example.applescript |
set URL of (make new tab at end of front window) to "topsites://" --you can nest things like using parentheses. | Script example.applescript |
clean up first window by kind | cleanbykind.scpt |
tell record 3 of table "equipment" | Script 25-3.applescript |
get cellValue of cell "cost" | Script 25-3.applescript |
get cell "cost" | Script 25-3.applescript |
global usrBin, binArray, mongoVersion | mongodb-installer.app.scpt |
set scriptName to "MongoDB Installer" | mongodb-installer.app.scpt |
set usrBin to "/usr/local/bin/" | mongodb-installer.app.scpt |
set mongoVersion to "mongodb-osx-x86_64-4.0.6" | mongodb-installer.app.scpt |
set binArray to {} | mongodb-installer.app.scpt |
if mongoExistance() = true then | mongodb-installer.app.scpt |
set goMongo to display dialog "MongoDB was found in \"" & usrBin & "\" would you still like to install?" buttons {"yes", "no"} default button "no" giving up after 10 with title scriptName | mongodb-installer.app.scpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.