text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set theURL to current application's |NSURL|'s fileURLWithPath:"/Users/shane/Desktop/Untitled.rtfd"
|
lns1.scpt
|
set theWrapper to current application's NSFileWrapper's alloc()'s initWithURL:theURL options:0 |error|:(missing value)
|
lns1.scpt
|
set attribString to current application's NSAttributedString's alloc()'s initWithRTFDFileWrapper:theWrapper documentAttributes:(missing value)
|
lns1.scpt
|
set theString to (attribString's |string|()'s stringByReplacingOccurrencesOfString:(character id 65532) withString:"") as text
|
lns1.scpt
|
property NSXMLDocumentXMLKind : a reference to 0
|
lns1.scpt
|
property NSXMLNodePrettyPrint : a reference to 131072
|
lns1.scpt
|
property NSXMLElement : a reference to current application's NSXMLElement
|
lns1.scpt
|
property NSXMLDocument : a reference to current application's NSXMLDocument
|
lns1.scpt
|
display dialog "No document open" buttons {"OK"} default button 1
|
lns1.scpt
|
set theResult to compile document 1
|
lns1.scpt
|
set appName to name
|
lns1.scpt
|
set appVersion to version
|
lns1.scpt
|
set docName to name
|
lns1.scpt
|
set docFile to file spec
|
lns1.scpt
|
set appNames to used applications
|
lns1.scpt
|
set additionNames to used scripting additions
|
lns1.scpt
|
set additionFiles to used scripting addition files
|
lns1.scpt
|
set libNames to used script libraries
|
lns1.scpt
|
set libFiles to used script library files
|
lns1.scpt
|
set frameworkNames to used frameworks
|
lns1.scpt
|
set frameworkFiles to used framework files
|
lns1.scpt
|
set embeddedLibs to embedded script libraries
|
lns1.scpt
|
set theDest to choose file name with prompt "Save Manifest XML report" default name (docName & " manifest.xml")
|
lns1.scpt
|
set attribs to {creator:appName, |version|:appVersion, |name|:docName}
|
lns1.scpt
|
if docFile is not missing value then set attribs to attribs & {|path|:(POSIX path of docFile)}
|
lns1.scpt
|
set rootElement to NSXMLElement's elementWithName:"manifest"
|
lns1.scpt
|
rootElement's setAttributesWithDictionary:attribs
|
lns1.scpt
|
set theXMLDocument to NSXMLDocument's alloc()'s initWithRootElement:rootElement
|
lns1.scpt
|
theXMLDocument's setDocumentContentKind:NSXMLDocumentXMLKind
|
lns1.scpt
|
theXMLDocument's setStandalone:true
|
lns1.scpt
|
theXMLDocument's setCharacterEncoding:"UTF-8"
|
lns1.scpt
|
if (count of appNames) > 0 then
|
lns1.scpt
|
set newElement to NSXMLElement's elementWithName:"applications"
|
lns1.scpt
|
rootElement's addChild:newElement
|
lns1.scpt
|
repeat with aName in appNames
|
lns1.scpt
|
set childElement to (NSXMLElement's elementWithName:"application" stringValue:aName)
|
lns1.scpt
|
(newElement's addChild:childElement)
|
lns1.scpt
|
if (count of additionNames) > 0 then
|
lns1.scpt
|
set newElement to NSXMLElement's elementWithName:"scripting_additions"
|
lns1.scpt
|
repeat with i from 1 to count of additionNames
|
lns1.scpt
|
set childElement to (NSXMLElement's elementWithName:"addition" stringValue:(item i of additionNames))
|
lns1.scpt
|
set theFile to item i of additionFiles
|
lns1.scpt
|
if theFile is not missing value then (childElement's setAttributesWithDictionary:{|path|:(POSIX path of theFile)})
|
lns1.scpt
|
if (count of libNames) > 0 then
|
lns1.scpt
|
set newElement to NSXMLElement's elementWithName:"used_script_libraries"
|
lns1.scpt
|
repeat with i from 1 to count of libNames
|
lns1.scpt
|
set childElement to (NSXMLElement's elementWithName:"library" stringValue:(item i of libNames))
|
lns1.scpt
|
set theFile to item i of libFiles
|
lns1.scpt
|
if (embeddedLibs is not missing value and (count of embeddedLibs) > 0) then
|
lns1.scpt
|
set newElement to NSXMLElement's elementWithName:"embedded_script_libraries"
|
lns1.scpt
|
repeat with aName in embeddedLibs
|
lns1.scpt
|
set childElement to (NSXMLElement's elementWithName:"library" stringValue:aName)
|
lns1.scpt
|
if (count of frameworkFiles) > 0 then
|
lns1.scpt
|
set newElement to NSXMLElement's elementWithName:"frameworks"
|
lns1.scpt
|
repeat with i from 1 to count of frameworkNames
|
lns1.scpt
|
set childElement to (NSXMLElement's elementWithName:"framework" stringValue:(item i of frameworkNames))
|
lns1.scpt
|
set theFile to item i of frameworkFiles
|
lns1.scpt
|
set theNSData to theXMLDocument's XMLDataWithOptions:NSXMLNodePrettyPrint
|
lns1.scpt
|
set theResult to theNSData's writeToFile:(POSIX path of theDest) atomically:true
|
lns1.scpt
|
use sorter : script "Custom Iterative Ternary Merge Sort"
|
lns1.scpt
|
set listOfStrings to paragraphs of "6:00 am|(BEIN1)|SPORTS|Footvolley|2021 Miami Beach World Series, Part 3|||||||||1 hr.|
|
lns1.scpt
|
6:00 am|(BSW)|SPORTS|NHL Hockey|Tampa Bay Lightning at Los Angeles Kings|From Staples Center in Los Angeles.||||||||2 hrs.|
|
lns1.scpt
|
6:00 am|(ESPNU)|SPORTS|College Basketball|Iowa State at Texas Tech|From United Supermarkets Arena in Lubbock, Texas.||||||||2 hrs.|
|
lns1.scpt
|
7:30 am|(NBATV)|SPORTS|NBA Basketball|Detroit Pistons at Golden State Warriors|From Chase Center in San Francisco.||||||||2 hrs. 30 mins.|
|
lns1.scpt
|
6:00 am|(BEIN1)|SPORTS|Footvolley|2021 Miami Beach World Series, Part 3|||||||||1 hr.|
|
lns1.scpt
|
8:30 am|(GOLTV)|SPORTS|Fútbol Ecuatoriano Primera División||Final, partido de vuelta. Emelec enfrenta a Independiente del Valle en el estadio Banco del Pacífico Capwell. En el primer encuentro de la serie definitoria, disputado en Sangolquí, los rayados se impusieron a los eléctricos por 3-1.||||||||2 hrs. 30 mins.|"
|
lns1.scpt
|
set listOfLists to {}
|
lns1.scpt
|
repeat with x from 1 to count of listOfStrings
|
lns1.scpt
|
set the end of listOfLists to text items of item x of listOfStrings
|
lns1.scpt
|
set sortedTextList to my sortTextList(listOfStrings)
|
lns1.scpt
|
set sortedTextListDescending to my sortTextListDescending(listOfStrings)
|
lns1.scpt
|
set sortedListsOfLists to my SortAListOfListsByItem(listOfLists, 4)
|
lns1.scpt
|
return {sortedTextList, sortedTextListDescending, sortedListsOfLists}
|
lns1.scpt
|
on SortAListOfListsByItem(listOfLists, itemToSortOn)
|
lns1.scpt
|
script sortByItem
|
lns1.scpt
|
return (item itemToSortOn of a > item itemToSortOn of b)
|
lns1.scpt
|
tell sorter to sort(listOfLists, 1, -1, {comparer:sortByItem})
|
lns1.scpt
|
return listOfLists
|
lns1.scpt
|
end SortAListOfListsByItem
|
lns1.scpt
|
on sortTextList(listToSort)
|
lns1.scpt
|
script descending
|
lns1.scpt
|
return (a < b)
|
lns1.scpt
|
tell sorter to sort(listToSort, 1, -1, {})
|
lns1.scpt
|
end sortTextList
|
lns1.scpt
|
on sortTextListDescending(listToSort)
|
lns1.scpt
|
tell sorter to sort(listToSort, 1, -1, {comparer:descending})
|
lns1.scpt
|
end sortTextListDescending
|
lns1.scpt
|
use framework “Foundation”
|
lns1.scpt
|
use framework “AppKit”
|
lns1.scpt
|
property NSAlert : a reference to current application’s NSAlert
|
lns1.scpt
|
my performSelectorOnMainThread:“dispAlert:” withObject:(missing value) waitUntilDone:true
|
lns1.scpt
|
on dispAlert:paramObj
|
lns1.scpt
|
–Move to frontmost (By edama2)
|
lns1.scpt
|
current application’s NSApplication’s sharedApplication()'s setActivationPolicy:(current application’s NSApplicationActivationPolicyRegular)
|
lns1.scpt
|
current application’s NSApp’s activateIgnoringOtherApps:(true)
|
lns1.scpt
|
tell NSAlert’s alloc()'s init()
|
lns1.scpt
|
set theAlert to it
|
lns1.scpt
|
its setMessageText:“The quick brown fox jumps over the dog”
|
lns1.scpt
|
its setInformativeText:“Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt.”
|
lns1.scpt
|
its runModal()
|
lns1.scpt
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.