text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set theOpaque to (bitmapImage's valueForKey:"isOpaque") as boolean | lns1.scpt |
return {alpha:theAlpha, opaque:theOpaque} | lns1.scpt |
(bitmapImage's valueForKey:"properties") as record | lns1.scpt |
set testList to text 2 thru -2 of " | lns1.scpt |
one | lns1.scpt |
three | lns1.scpt |
four | lns1.scpt |
five | lns1.scpt |
six | lns1.scpt |
seven | lns1.scpt |
eight | lns1.scpt |
nine | lns1.scpt |
ten | lns1.scpt |
set testList to text items of testList | lns1.scpt |
set longestLineLength to 0 | lns1.scpt |
set longestLineText to null | lns1.scpt |
repeat with i in testList | lns1.scpt |
set lineLength to length of (contents of i) | lns1.scpt |
if lineLength > longestLineLength then | lns1.scpt |
set longestLineLength to lineLength | lns1.scpt |
set longestLineText to contents of i | lns1.scpt |
{longestLineLength, longestLineText} | lns1.scpt |
global theDefaults | lns1.scpt |
set theVers to my version | lns1.scpt |
display dialog theVers | lns1.scpt |
if my id = missing value then error "This code works only in an applet or script bundle." | lns1.scpt |
if current application's id = my id then -- must be running as applet | lns1.scpt |
set theDefaults to current application's NSUserDefaults's standardUserDefaults() | lns1.scpt |
else -- being run by editor or other host app | lns1.scpt |
set theData to current application's NSData's dataWithContentsOfFile:(myPath & "Contents/Info.plist") | lns1.scpt |
set myID to infoDict's objectForKey:"CFBundleIdentifier" | lns1.scpt |
set theDefaults to current application's NSUserDefaults's alloc()'s initWithSuiteName:myID | lns1.scpt |
use framework "AppleScriptObjC" | lns1.scpt |
set resourcePath to POSIX path of (path to me) & "Contents/Resources/Classes" | lns1.scpt |
set theBundle to current application's NSBundle's bundleWithPath:resourcePath | lns1.scpt |
theBundle's loadAppleScriptObjectiveCScripts() | lns1.scpt |
theBundle's |description|() as text | lns1.scpt |
my prepareWindow:me | lns1.scpt |
my performSelectorOnMainThread:"prepareWindow:" withObject:(missing value) waitUntilDone:true | lns1.scpt |
on prepareWindow:sender | lns1.scpt |
set theWindow to current application's NSWindow's new() | lns1.scpt |
its setStyleMask:(3) | lns1.scpt |
its setContentSize:{400, 220} | lns1.scpt |
set aView to current application's MYView's alloc()'s initWithFrame:{{10, 10}, {380, 200}} | lns1.scpt |
theWindow's contentView's addSubview:aView | lns1.scpt |
theWindow's makeKeyAndOrderFront:me | lns1.scpt |
end prepareWindow: | lns1.scpt |
script MYView | lns1.scpt |
property parent : class "NSView" | lns1.scpt |
property NSColor : class "NSColor" | lns1.scpt |
on initWithFrame:frame | lns1.scpt |
me is equal to (continue initWithFrame:frame) | lns1.scpt |
end initWithFrame: | lns1.scpt |
on drawRect:dirtyRect | lns1.scpt |
continue drawRect:dirtyRect | lns1.scpt |
NSColor's brownColor()'s setFill() | lns1.scpt |
current application's NSRectFill(dirtyRect) | lns1.scpt |
end drawRect: | lns1.scpt |
display dialog (current application's NSStringFromRect(my frame())) as text | lns1.scpt |
set theURL to "https://localhost" | lns1.scpt |
log (current application's NSURLComponents's componentsWithString:theURL)'s |description|() as text | lns1.scpt |
set components to (current application's NSURLComponents's componentsWithString:theURL) | lns1.scpt |
set theItems to (components's valueForKey:"host") as text | lns1.scpt |
set theHost to (current application's |NSURL|'s URLWithString:"https://images.google.co.uk/")'s |host|() | lns1.scpt |
set theItems to (theHost's componentsSeparatedByString:".") as list | lns1.scpt |
set theDomain to items 2 thru -1 of theItems | lns1.scpt |
set theDomain to theDomain as text | lns1.scpt |
return theDomain | lns1.scpt |
set theURL to "https://images.google.co.uk/" | lns1.scpt |
set theItems to ((components's valueForKey:"host")'s componentsSeparatedByString:".") as list | lns1.scpt |
set theDomain to text -3 thru -1 of theItems | lns1.scpt |
on domain for |url| as {record, text} | lns1.scpt |
set subdomains to the text items of (hostname for |url|) | lns1.scpt |
repeat while the hostnameDoesResolve(rest of subdomains) | lns1.scpt |
set subdomains to the rest of the subdomains | lns1.scpt |
return the subdomains as text | lns1.scpt |
end domain | lns1.scpt |
on hostname for |url| as {record, text} | lns1.scpt |
tell the |url| as {URL, record} to ¬ | lns1.scpt |
return the host's DNS form | lns1.scpt |
end hostname | lns1.scpt |
on hostnameDoesResolve(hostname as text) | lns1.scpt |
tell ("mailto:" & hostname) as URL to tell ¬ | lns1.scpt |
host & {dotted decimal form:false} ¬ | lns1.scpt |
to get dotted decimal form ≠ false | lns1.scpt |
end hostnameDoesResolve | lns1.scpt |
log (my getRGBandHSB:"6ec264") | lns1.scpt |
on getRGBandHSB:colorString | lns1.scpt |
set {theResult, theRed} to (current application's NSScanner's scannerWithString:(text -6 thru -5 of colorString))'s scanHexInt:(reference) | lns1.scpt |
set {theResult, theGreen} to (current application's NSScanner's scannerWithString:(text -4 thru -3 of colorString))'s scanHexInt:(reference) | lns1.scpt |
set {theResult, theBlue} to (current application's NSScanner's scannerWithString:(text -2 thru -1 of colorString))'s scanHexInt:(reference) | lns1.scpt |
set theColor to current application's NSColor's colorWithRed:theRed / 255 green:theGreen / 255 blue:theBlue / 255 alpha:1.0 | lns1.scpt |
set theHue to round ((theColor's hueComponent()) * 360) | lns1.scpt |
set theSat to round ((theColor's saturationComponent()) * 100) | lns1.scpt |
set theBright to round ((theColor's brightnessComponent()) * 100) | lns1.scpt |
return {{theRed, theGreen, theBlue}, {theHue, theSat, theBright}} | lns1.scpt |
end getRGBandHSB: | lns1.scpt |
set theData to thePasteboard's dataForType:(current application's NSRTFDPboardType) | lns1.scpt |
if theData is missing value then error "No RTFD on the clipboard" | lns1.scpt |
set {theRTFD, theAtts} to current application's NSMutableAttributedString's alloc()'s initWithRTFD:theData documentAttributes:(reference) | lns1.scpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.