text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
set theNewFields to every field of tempPub | Fill according to DOI.applescript |
repeat with theField in every field of tempPub | Fill according to DOI.applescript |
set fieldName to name of theField | Fill according to DOI.applescript |
set value of field fieldName of originalPub to (get value of field fieldName of tempPub) | Fill according to DOI.applescript |
delete tempPub | Fill according to DOI.applescript |
set originalPub's cite key to originalPub's generated cite key | Fill according to DOI.applescript |
if linked file of originalPub is not {} then auto file originalPub | Fill according to DOI.applescript |
select originalPub -- So it appears nicely at the top of the window | Fill according to DOI.applescript |
copyURLsToFiles() | Copy URLs to Files.applescript |
on copyURLsToFiles() | Copy URLs to Files.applescript |
set theURLs to "" | Copy URLs to Files.applescript |
set theURLs to URL of (target of front window as alias) | Copy URLs to Files.applescript |
if theURLs as string is equal to "" then | Copy URLs to Files.applescript |
set theURLs to theURL | Copy URLs to Files.applescript |
set theURLs to theURLs & " | Copy URLs to Files.applescript |
" & theURL | Copy URLs to Files.applescript |
set the clipboard to theURLs | Copy URLs to Files.applescript |
end copyURLsToFiles | Copy URLs to Files.applescript |
set distractingApps to {"Adium", "Mail", "Nambu", "NetNewsWire", "Thunderbird", "Vienna"} | do_not_disturb.applescript |
repeat with distraction in distractingApps | do_not_disturb.applescript |
tell application distraction | do_not_disturb.applescript |
on fromHex(theDigits) | Pages%20-%20Actual%20Size.scpt |
set theValue to 0 | Pages%20-%20Actual%20Size.scpt |
repeat with theDigit in theDigits | Pages%20-%20Actual%20Size.scpt |
set theValue to (theValue * 16) + (offset of theDigit in "0123456789ABCDEF") - 1 | Pages%20-%20Actual%20Size.scpt |
end fromHex | Pages%20-%20Actual%20Size.scpt |
on hasKey(theKey, theDict) | Pages%20-%20Actual%20Size.scpt |
set theScript to "on run {theDict}" & return & "return " & theKey & " of theDict" & return & "end run" | Pages%20-%20Actual%20Size.scpt |
run script theScript with parameters {theDict} | Pages%20-%20Actual%20Size.scpt |
script Display | Pages%20-%20Actual%20Size.scpt |
property name : "Unnamed Display" | Pages%20-%20Actual%20Size.scpt |
property edid : "" | Pages%20-%20Actual%20Size.scpt |
on getDiagonal() | Pages%20-%20Actual%20Size.scpt |
return ((my height) ^ 2 + (my width) ^ 2) ^ 0.5 | Pages%20-%20Actual%20Size.scpt |
end getDiagonal | Pages%20-%20Actual%20Size.scpt |
on getDensity() | Pages%20-%20Actual%20Size.scpt |
return ((my horz) * ((1 + ((my vert) ^ 2) / ((my horz) ^ 2)) ^ 0.5)) / (getDiagonal()) | Pages%20-%20Actual%20Size.scpt |
end getDensity | Pages%20-%20Actual%20Size.scpt |
on initWithDict(theDict) | Pages%20-%20Actual%20Size.scpt |
set my name to _name of theDict | Pages%20-%20Actual%20Size.scpt |
if hasKey("spdisplays_main", theDict) and spdisplays_main of theDict is "spdisplays_yes" then | Pages%20-%20Actual%20Size.scpt |
set my isMain to true | Pages%20-%20Actual%20Size.scpt |
set my edid to items 3 thru end of _spdisplays_edid of theDict | Pages%20-%20Actual%20Size.scpt |
set {my width, my height} to {fromHex(items 43 thru 44 of my edid) * 0.3937, fromHex(items 45 thru 46 of my edid) * 0.3937} | Pages%20-%20Actual%20Size.scpt |
set AppleScript's text item delimiters to " x " | Pages%20-%20Actual%20Size.scpt |
set {my horz, my vert} to (every text item of spdisplays_resolution of theDict) | Pages%20-%20Actual%20Size.scpt |
end initWithDict | Pages%20-%20Actual%20Size.scpt |
on make with data theDict | Pages%20-%20Actual%20Size.scpt |
copy me to newObj | Pages%20-%20Actual%20Size.scpt |
tell newObj to initWithDict(theDict) | Pages%20-%20Actual%20Size.scpt |
return newObj | Pages%20-%20Actual%20Size.scpt |
on getDisplays() | Pages%20-%20Actual%20Size.scpt |
set theDisplays to {} | Pages%20-%20Actual%20Size.scpt |
do shell script "/usr/sbin/system_profiler -xml SPDisplaysDataType" | Pages%20-%20Actual%20Size.scpt |
set thePlist to make new property list item with data the result | Pages%20-%20Actual%20Size.scpt |
set theData to value of property list item 1 of (make new property list item with data the result) | Pages%20-%20Actual%20Size.scpt |
delete thePlist -- Free up memory | Pages%20-%20Actual%20Size.scpt |
set graphicsCards to _items of theData | Pages%20-%20Actual%20Size.scpt |
repeat with theGPU in graphicsCards | Pages%20-%20Actual%20Size.scpt |
if hasKey("spdisplays_ndrvs", theGPU) then | Pages%20-%20Actual%20Size.scpt |
set gpuDisplays to spdisplays_ndrvs of theGPU | Pages%20-%20Actual%20Size.scpt |
repeat with displayDict in gpuDisplays | Pages%20-%20Actual%20Size.scpt |
set the end of theDisplays to make Display with data displayDict | Pages%20-%20Actual%20Size.scpt |
return theDisplays | Pages%20-%20Actual%20Size.scpt |
end getDisplays | Pages%20-%20Actual%20Size.scpt |
set myDisplays to getDisplays() | Pages%20-%20Actual%20Size.scpt |
set mainDisplay to missing value | Pages%20-%20Actual%20Size.scpt |
repeat with theDisplay in myDisplays | Pages%20-%20Actual%20Size.scpt |
if isMain of theDisplay is true then | Pages%20-%20Actual%20Size.scpt |
set mainDisplay to theDisplay | Pages%20-%20Actual%20Size.scpt |
if mainDisplay is missing value then | Pages%20-%20Actual%20Size.scpt |
display dialog "Could not find the main display." | Pages%20-%20Actual%20Size.scpt |
set theDiagonal to getDiagonal() of mainDisplay | Pages%20-%20Actual%20Size.scpt |
set theDensity to getDensity() of mainDisplay | Pages%20-%20Actual%20Size.scpt |
log "I'm using the display named " & quoted form of name of mainDisplay & ", which is " & width of mainDisplay & "in x " & height of mainDisplay & "in (" & theDiagonal & "in diag.) and " & horz of mainDisplay & "x" & vert of mainDisplay & " at " & theDensity & "ppi." | Pages%20-%20Actual%20Size.scpt |
set view scale of the first window to (theDensity * 100.0) / 72.0 | Pages%20-%20Actual%20Size.scpt |
set new_person to make new person at end of people with properties {first name:"Janet", last name:"Brown", organization:"Brown & Black Inc."} | Script 21-14.applescript |
make new phone at end of phones of new_person with properties {label:"Mobile", value:"901-555-2124"} | Script 21-14.applescript |
save -- Remember to save your changes! | Script 21-14.applescript |
set modified_count to 0 | PhoneNumberCleaning.scpt |
set all_people to every person | PhoneNumberCleaning.scpt |
repeat with each_person in all_people | PhoneNumberCleaning.scpt |
repeat with each_phone in (get phones of each_person) | PhoneNumberCleaning.scpt |
set phone_number to value of each_phone | PhoneNumberCleaning.scpt |
if phone_number does not start with "+" then | PhoneNumberCleaning.scpt |
set cleaned_number to my clean_number(phone_number) | PhoneNumberCleaning.scpt |
if length of cleaned_number is 10 then | PhoneNumberCleaning.scpt |
set formatted_number to my format_number(cleaned_number) | PhoneNumberCleaning.scpt |
else if length of cleaned_number is 11 and item 1 of cleaned_number is "1" then | PhoneNumberCleaning.scpt |
set formatted_number to my format_number(text 2 thru 11 of cleaned_number) | PhoneNumberCleaning.scpt |
set formatted_number to null | PhoneNumberCleaning.scpt |
if formatted_number is not null then | PhoneNumberCleaning.scpt |
set country_prefix_number to "+1 " & formatted_number | PhoneNumberCleaning.scpt |
log phone_number & " -> " & country_prefix_number | PhoneNumberCleaning.scpt |
tell each_phone | PhoneNumberCleaning.scpt |
set value to country_prefix_number | PhoneNumberCleaning.scpt |
set modified_count to modified_count + 1 | PhoneNumberCleaning.scpt |
if modified_count is 1 then | PhoneNumberCleaning.scpt |
"modified " & (modified_count) & " contact" | PhoneNumberCleaning.scpt |
"modified " & (modified_count) & " contacts" | PhoneNumberCleaning.scpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.