text
stringlengths
0
15.7k
source
stringlengths
6
112
property NSMutableArray : a reference to NSMutableArray of this
+regex.applescript
property NSRange : a reference to NSRange of this
+regex.applescript
property NSRegularExpression : a reference to NSRegularExpression of this
+regex.applescript
property NSSet : a reference to NSSet of this
+regex.applescript
property NSRegExSearch : a reference to 1024
+regex.applescript
property NSTextCheckingTypeLink : a reference to 32
+regex.applescript
to __NSString__(str)
+regex.applescript
NSString's stringWithString:str
+regex.applescript
end __NSString__
+regex.applescript
to __any__(obj)
+regex.applescript
item 1 of ((NSArray's arrayWithObject:obj) as list)
+regex.applescript
end __any__
+regex.applescript
to match(str as text, re)
+regex.applescript
local str, re
+regex.applescript
set str to __NSString__(str)
+regex.applescript
set range to str's rangeOfString:re options:NSRegExSearch
+regex.applescript
if range's |length| = 0 then return {}
+regex.applescript
set x to NSRange's NSMaxRange(range)
+regex.applescript
set s to (str's substringWithRange:range) as text
+regex.applescript
{s} & match(str's substringWithRange:{¬
+regex.applescript
x, (str's |length|()) - x}, re)
+regex.applescript
to replace(str as text, re, t)
+regex.applescript
local str, re, t
+regex.applescript
set str to __NSString__(str's contents)
+regex.applescript
(str's stringByReplacingOccurrencesOfString:re ¬
+regex.applescript
withString:t options:NSRegExSearch ¬
+regex.applescript
range:{0, str's |length|()}) as text
+regex.applescript
to map(str as text, re, t)
+regex.applescript
set results to NSMutableArray's array()
+regex.applescript
tell (NSRegularExpression's regularExpressionWithPattern:re ¬
+regex.applescript
options:1 |error|:nil) to repeat with match in ¬
+regex.applescript
(its matchesInString:str options:0 range:{0, str's length})
+regex.applescript
(results's addObject:(its replacementStringForResult:match ¬
+regex.applescript
inString:str offset:0 template:t))
+regex.applescript
results as list
+regex.applescript
to extractLinks from input as text
+regex.applescript
set input to __NSString__(input)
+regex.applescript
set predicate to "self BEGINSWITH[c] 'mailto:'"
+regex.applescript
tell (NSString's stringWithContentsOfURL:(NSURL's ¬
+regex.applescript
fileURLWithPath:(input's stringByStandardizingPath())) ¬
+regex.applescript
encoding:UTF8 |error|:nil) to if missing value ≠ it ¬
+regex.applescript
then set input to it
+regex.applescript
set matches to NSSet's setWithArray:((NSDataDetector's ¬
+regex.applescript
dataDetectorWithTypes:NSTextCheckingTypeLink |error|:nil)'s ¬
+regex.applescript
matchesInString:input options:0 range:[0, input's |length|()])
+regex.applescript
tell (matches's valueForKeyPath:"URL.absoluteString") to set ¬
+regex.applescript
results to {emails:filteredSetUsingPredicate_(NSPredicate's ¬ predicateWithFormat:predicate)'s allObjects() as list ¬ , URLs:filteredSetUsingPredicate_(NSPredicate's ¬ predicateWithFormat:("!" & predicate))'s allObjects() as list}
+regex.applescript
repeat with email in (a reference to emails of results)
+regex.applescript
tell the email to set its contents to text 8 thru -1 of it
+regex.applescript
return the results
+regex.applescript
end extractLinks
+regex.applescript
if (my isYosemiteOrLaterMail()) then
Mail-Load-Images.scpt
set loadImagesButtonNameTextString to "Load Remote Content" -- English
Mail-Load-Images.scpt
set loadImagesButtonNameTextString to "Load Images" -- English
Mail-Load-Images.scpt
GUIScripting_status()
Mail-Load-Images.scpt
if not (window 1 exists) then return beep 1
Mail-Load-Images.scpt
set loadImagesButton to my getLoadImagesButtonReference(loadImagesButtonNameTextString)
Mail-Load-Images.scpt
if not (loadImagesButton exists) then return beep 1
Mail-Load-Images.scpt
click loadImagesButton
Mail-Load-Images.scpt
on GUIScripting_status()
Mail-Load-Images.scpt
set UI_enabled to UI elements enabled
Mail-Load-Images.scpt
if UI_enabled is false then
Mail-Load-Images.scpt
if (my isMavericksOrLaterMail()) then
Mail-Load-Images.scpt
set current pane to pane id "com.apple.preference.security"
Mail-Load-Images.scpt
display dialog "This script uses the Graphic User Interface Scripting architecture of Mac OS X, which is currently disabled." & return & return & "In System Preferences, enable your script trigger utility in the Accessibility section of the Privacy tab of the Security & Privacy preference pane." with icon 1 buttons {"OK"} default button 1
Mail-Load-Images.scpt
display dialog "This script uses the Graphic User Interface Scripting architecture of Mac OS X, which is currently disabled." & return & return & "Enable GUI Scripting by checking \"Enable access for assistive devices\" in the Accessibility preference pane." with icon 1 buttons {"OK"} default button 1
Mail-Load-Images.scpt
end GUIScripting_status
Mail-Load-Images.scpt
on getLoadImagesButtonReference(loadImagesButtonName)
Mail-Load-Images.scpt
if (my isBeforeLionMail()) then
Mail-Load-Images.scpt
set loadImagesButtonRef to a reference to button loadImagesButtonName of front window
Mail-Load-Images.scpt
else if (my isLionMail()) then
Mail-Load-Images.scpt
set loadImagesButtonRef to a reference to button ¬
Mail-Load-Images.scpt
loadImagesButtonName of UI element 1 of row 1 of table 1 of scroll area 1 of front window
Mail-Load-Images.scpt
if not (loadImagesButtonRef exists) then
Mail-Load-Images.scpt
loadImagesButtonName of UI element 1 of row 1 of table 1 of scroll area 2 of splitter group 2 of splitter group 1 of front window
Mail-Load-Images.scpt
loadImagesButtonName of UI element 1 of row 1 of table 1 of scroll area 1 of splitter group 2 of splitter group 1 of front window
Mail-Load-Images.scpt
else if (my isMavericksOrLaterMail()) then
Mail-Load-Images.scpt
loadImagesButtonName of group 1 of group 1 of scroll area 1 of front window
Mail-Load-Images.scpt
loadImagesButtonName of group 1 of group 1 of scroll area 2 of splitter group 1 of splitter group 1 of front window
Mail-Load-Images.scpt
loadImagesButtonName of group 1 of group 1 of scroll area 1 of splitter group 1 of splitter group 1 of front window
Mail-Load-Images.scpt
return beep 2
Mail-Load-Images.scpt
return loadImagesButtonRef
Mail-Load-Images.scpt
end getLoadImagesButtonReference
Mail-Load-Images.scpt
on isBeforeLionMail()
Mail-Load-Images.scpt
set osVersion to system version of (system info)
Mail-Load-Images.scpt
if ((osVersion begins with "10.4") or (osVersion begins with "10.5") or (osVersion begins with "10.6")) then
Mail-Load-Images.scpt
end isBeforeLionMail
Mail-Load-Images.scpt
on isLionMail()
Mail-Load-Images.scpt
return ((osVersion begins with "10.7") or (osVersion begins with "10.8"))
Mail-Load-Images.scpt
end isLionMail
Mail-Load-Images.scpt
on isMavericksMail()
Mail-Load-Images.scpt
return (system version of (system info) begins with "10.9")
Mail-Load-Images.scpt
end isMavericksMail
Mail-Load-Images.scpt
on isYosemiteMail()
Mail-Load-Images.scpt
return (system version of (system info) begins with "10.10")
Mail-Load-Images.scpt
end isYosemiteMail
Mail-Load-Images.scpt
on isElCapMail()
Mail-Load-Images.scpt
return (system version of (system info) begins with "10.11")
Mail-Load-Images.scpt
end isElCapMail
Mail-Load-Images.scpt
on isSierraMail()
Mail-Load-Images.scpt