text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
end parser:didStartElement:namespaceURI:qualifiedName:attributes: | lns1.scpt |
on parser:anNSXMLParser didEndElement:elementName namespaceURI:aString qualifiedName:qName | lns1.scpt |
if my textInProgress's |length|() > 0 then | lns1.scpt |
set dictInProgress to my dictStack's lastObject() | lns1.scpt |
dictInProgress's setObject:textInProgress forKey:"contents" | lns1.scpt |
set my textInProgress to current application's NSMutableString's |string|() | lns1.scpt |
my dictStack's removeLastObject() | lns1.scpt |
end parser:didEndElement:namespaceURI:qualifiedName: | lns1.scpt |
on parser:anNSXMLParser foundCharacters:aString | lns1.scpt |
if (aString's stringByTrimmingCharactersInSet:(current application's NSCharacterSet's whitespaceAndNewlineCharacterSet()))'s |length|() > 0 then | lns1.scpt |
(my textInProgress)'s appendString:aString | lns1.scpt |
end parser:foundCharacters: | lns1.scpt |
on parser:anNSXMLParser parseErrorOccurred:anNSError | lns1.scpt |
set my anError to anNSError | lns1.scpt |
end parser:parseErrorOccurred: | lns1.scpt |
set xmlString to "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?> | lns1.scpt |
<character> | lns1.scpt |
<firstName>Saga</firstName> | lns1.scpt |
<lastName>Norén</lastName> | lns1.scpt |
<city>Malmö</city> | lns1.scpt |
<partner approach=\"dogged\"> | lns1.scpt |
<firstName>Martin</firstName> | lns1.scpt |
<lastName>Rohde</lastName> | lns1.scpt |
<city>København</city> | lns1.scpt |
</partner> | lns1.scpt |
</character>" | lns1.scpt |
its makeRecordWithXML:xmlString | lns1.scpt |
set theXML to "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"Adobe XMP Core 5.6-c137 79.159768, 2016/08/11-13:24:42 \"> | lns1.scpt |
<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"> | lns1.scpt |
<rdf:Description rdf:about=\"\" | lns1.scpt |
xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\" | lns1.scpt |
xmlns:xmpMM=\"http://ns.adobe.com/xap/1.0/mm/\" | lns1.scpt |
xmlns:stEvt=\"http://ns.adobe.com/xap/1.0/sType/ResourceEvent#\" | lns1.scpt |
xmlns:stRef=\"http://ns.adobe.com/xap/1.0/sType/ResourceRef#\" | lns1.scpt |
xmlns:dc=\"http://purl.org/dc/elements/1.1/\" | lns1.scpt |
xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\"> | lns1.scpt |
<xmp:CreatorTool>Adobe InDesign CC 2017 (Macintosh)</xmp:CreatorTool> | lns1.scpt |
<xmp:CreateDate>2017-03-19T12:21:51+11:00</xmp:CreateDate> | lns1.scpt |
<xmp:MetadataDate>2017-03-19T12:21:51+11:00</xmp:MetadataDate> | lns1.scpt |
<xmp:ModifyDate>2017-03-19T12:21:51+11:00</xmp:ModifyDate> | lns1.scpt |
<xmpMM:InstanceID>uuid:e826b00e-8f3d-d448-be8f-1b4a3e36b6e4</xmpMM:InstanceID> | lns1.scpt |
<dc:format>application/pdf</dc:format> | lns1.scpt |
<pdf:Producer>Adobe PDF Library 15.0</pdf:Producer> | lns1.scpt |
<pdf:Trapped>False</pdf:Trapped> | lns1.scpt |
</rdf:Description> | lns1.scpt |
</rdf:RDF> | lns1.scpt |
</x:xmpmeta>" | lns1.scpt |
set {theXMLDoc, theError} to current application's NSXMLDocument's alloc()'s initWithXMLString:theXML options:0 |error|:(reference) | lns1.scpt |
set {theNodes, theError} to theXMLDoc's nodesForXPath:"//*[local-name()='InstanceID']" |error|:(reference) | lns1.scpt |
set {theNodes, theError} to theXMLDoc's nodesForXPath:"//*:InstanceID" |error|:(reference) | lns1.scpt |
set {theNodes, theError} to theXMLDoc's nodesForXPath:"//*[local-name()='Description']/*[local-name()='InstanceID']" |error|:(reference) | lns1.scpt |
set {theNodes, theError} to theXMLDoc's nodesForXPath:"//*[local-name()='RDF']/*[local-name()='Description']/*[local-name()='InstanceID']" |error|:(reference) | lns1.scpt |
set {theNodes, theError} to theXMLDoc's nodesForXPath:"/*[local-name()='xmpmeta']/*[local-name()='RDF']/*[local-name()='Description']/*[local-name()='InstanceID']" |error|:(reference) | lns1.scpt |
if theNodes = missing value then error (theError's localizedDescription() as text) | lns1.scpt |
return theNodes's valueForKey:"stringValue" | lns1.scpt |
set myShortPath to "~/Library/Script Libraries" | lns1.scpt |
set myNSURL to getNSURL(myShortPath, true) of me | lns1.scpt |
set myFullPath to myNSURL's |path|() as text | lns1.scpt |
on getNSURL(pPosixPath, pEnsurePathExistsBool) -- @Path @NSURL @ASObjC | lns1.scpt |
local curApp, nsPath, myNSURL, doesItExistBool | lns1.scpt |
set nsPath to curApp's NSString's stringWithString:pPosixPath | lns1.scpt |
set myNSURL to curApp's |NSURL|'s fileURLWithPath:nsPath | lns1.scpt |
set {myNSURL, nsError} to curApp's |NSURL|'s URLByResolvingAliasFileAtURL:myNSURL options:0 |error|:(reference) | lns1.scpt |
if myNSURL is missing value then | lns1.scpt |
error "NSURL Error for Path: " & pPosixPath ¬ | lns1.scpt |
& return & (nsError's |description|() as text) | lns1.scpt |
if (pEnsurePathExistsBool) then | lns1.scpt |
set doesItExistBool to (myNSURL's checkResourceIsReachableAndReturnError:(missing value)) as boolean | lns1.scpt |
if (doesItExistBool is false) then | lns1.scpt |
error "Path does NOT exist: " & return & pPosixPath | lns1.scpt |
return myNSURL | lns1.scpt |
end getNSURL | lns1.scpt |
property OtherHostsList : {} | lns1.scpt |
property CurrentHostName : "" | lns1.scpt |
property DoneGettingServices : false | lns1.scpt |
on netServiceBrowser:NotUsed1 didFindService:NetworkService moreComing:StillServicesLeft | lns1.scpt |
set DoneGettingServices to not StillServicesLeft | lns1.scpt |
set NetworkServiceName to (NetworkService's |name|()) as text | lns1.scpt |
if (NetworkServiceName ≠ CurrentHostName) and (NetworkServiceName is not in OtherHostsList) then | lns1.scpt |
set the end of OtherHostsList to NetworkServiceName | lns1.scpt |
end netServiceBrowser:didFindService:moreComing: | lns1.scpt |
set DoneGettingServices to false | lns1.scpt |
set OtherHostsList to {} | lns1.scpt |
set CurrentHostName to (current application's NSHost's currentHost()'s localizedName()) as string | lns1.scpt |
set TheServiceBrowser to current application's NSNetServiceBrowser's alloc()'s init() | lns1.scpt |
TheServiceBrowser's setDelegate:me | lns1.scpt |
TheServiceBrowser's searchForServicesOfType:"_afpovertcp._tcp" inDomain:"" | lns1.scpt |
repeat while not DoneGettingServices | lns1.scpt |
delay 1.0E-5 | lns1.scpt |
TheServiceBrowser's setDelegate:(missing value) | lns1.scpt |
OtherHostsList | lns1.scpt |
set currentApp to current application | lns1.scpt |
set luKeyList to {"Date Added", "Date Modified", "Date Accessed", "Date Created", ¬
"Size Allocated", "Size", "Label Color", "Label Number", "Label Local", ¬
"Type Local", "Name", "Size Allocated Total", "Size Total", "Type"} | lns1.scpt |
set nsKeyList to {currentApp's NSURLAddedToDirectoryDateKey, ¬
currentApp's NSURLAttributeModificationDateKey, currentApp's NSURLContentAccessDateKey, ¬
currentApp's NSURLCreationDateKey, currentApp's NSURLFileAllocatedSizeKey, ¬
currentApp's NSURLFileSizeKey, currentApp's NSURLLabelColorKey, currentApp's NSURLLabelNumberKey, ¬
currentApp's NSURLLocalizedLabelKey, currentApp's NSURLLocalizedTypeDescriptionKey, ¬
currentApp's NSURLNameKey, currentApp's NSURLTotalFileAllocatedSizeKey, ¬
currentApp's NSURLTotalFileSizeKey, currentApp's NSURLTypeIdentifierKey} | lns1.scpt |
set itemPath to "~/Downloads/NewFolder5.zip" | lns1.scpt |
set itemKeyData to itemPath & return & "(Copied to clipboard)" & return | lns1.scpt |
set itemPath to (current application's NSString's stringWithString:itemPath)'s stringByExpandingTildeInPath | lns1.scpt |
set itemNSURL to current application's class "NSURL"'s fileURLWithPath:itemPath | lns1.scpt |
repeat with j from 1 to length of luKeyList | lns1.scpt |
set keyName to item j of luKeyList | lns1.scpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.