text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
set theWords to theWords's filteredArrayUsingPredicate:(current application's NSPredicate's predicateWithFormat:"length > 0") | lns2.scpt |
set theString to current application's NSString's stringWithString:"hello, world-wide" | lns2.scpt |
set theSet to (current application's NSMutableCharacterSet's alphanumericCharacterSet()'s invertedSet()) | lns2.scpt |
theSet's removeCharactersInString:"'’-" | lns2.scpt |
set theWords to theString's componentsSeparatedByCharactersInSet:theSet | lns2.scpt |
use framework "iTunesLibrary" | lns2.scpt |
set {iTunesLib, theError} to current application's ITLibrary's libraryWithAPIVersion:"1.0" |error|:(reference) | lns2.scpt |
set thePred to current application's NSPredicate's predicateWithFormat:"(artist.name BEGINSWITH[cd] %@) AND (title BEGINSWITH[cd] %@)" argumentArray:{"a", "b"} | lns2.scpt |
set theTracks to iTunesLib's allMediaItems() | lns2.scpt |
set x to ((theTracks's filteredArrayUsingPredicate:thePred)'s valueForKey:"title") as list | lns2.scpt |
set theClip to current application's NSPasteboard's generalPasteboard() | lns2.scpt |
theClip's clearContents() | lns2.scpt |
theClip's setData:theData forType:"public.jpeg" | lns2.scpt |
set posixPath to "/Users/shane/desktop/test-1200.png" | lns2.scpt |
set {theData, theError} to current application's NSData's dataWithContentsOfFile:posixPath options:0 |error|:(reference) | lns2.scpt |
theClip's setData:theData forType:"public.png" | lns2.scpt |
theClip's (pasteboardItems()'s objectAtIndex:0)'s |types|() as list | lns2.scpt |
set theFont to current application's NSFont's fontWithName:"Helvetica" |size|:30.0 | lns2.scpt |
set userAttributes to current application's NSDictionary's dictionaryWithObjects:{theFont, current application's NSColor's blackColor()} forKeys:{current application's NSFontAttributeName, current application's NSForegroundColorAttributeName} | lns2.scpt |
set theText to current application's NSString's stringWithString:"hello" | lns2.scpt |
set textSize to theText's sizeWithAttributes:userAttributes | lns2.scpt |
tell application id "InDn" | lns2.scpt |
tell selection | lns2.scpt |
set textBase to baseline | lns2.scpt |
set textBottom to end baseline | lns2.scpt |
set textAscent to ascent | lns2.scpt |
set textDescent to descent | lns2.scpt |
set textLeft to horizontal offset | lns2.scpt |
set textRight to end horizontal offset | lns2.scpt |
set countLine to (count of line) | lns2.scpt |
if countLine > 1 then | lns2.scpt |
set {textBottom, textDescent, textRight} to {0, 0, 0} | lns2.scpt |
repeat with iLine from 1 to countLine | lns2.scpt |
tell line iLine | lns2.scpt |
set a1 to end baseline | lns2.scpt |
if a1 > textBottom then set textBottom to a1 | lns2.scpt |
set a2 to descent | lns2.scpt |
if a2 > textDescent then set textDescent to a2 | lns2.scpt |
set a3 to end horizontal offset | lns2.scpt |
if a3 > textRight then set textRight to a3 | lns2.scpt |
set textAscent to textBase - textAscent | lns2.scpt |
set textDescent to textBottom + textDescent | lns2.scpt |
set textMiddle to textAscent + ((textBottom - textAscent) / 2) | lns2.scpt |
set textCenter to textLeft + ((textRight - textLeft) / 2) | lns2.scpt |
tell selection to set newbox to create outlines without delete original | lns2.scpt |
if (count of newbox) > 1 then tell active document to set newbox to make group with properties {group items:(newbox)} | lns2.scpt |
set {vectTop, vectLeft, vectBottom, vectRight} to geometric bounds of item 1 of (newbox) | lns2.scpt |
set vectHorizontal to vectTop + ((vectBottom - vectTop) / 2) | lns2.scpt |
set vectVertical to vectLeft + ((vectRight - vectLeft) / 2) | lns2.scpt |
delete newbox | lns2.scpt |
{textAscent, textLeft, textDescent, textRight, textCenter, textMiddle} -- with typo | lns2.scpt |
{vectTop, vectLeft, vectBottom, vectRight, vectVertical, vectHorizontal} -- with vector | lns2.scpt |
current application's NSScriptClassDescription's classDescriptionForClass:(current application's NSApplication) | lns2.scpt |
set theFile to POSIX path of (choose file) | lns2.scpt |
set theFile to current application's NSString's stringWithString:theFile | lns2.scpt |
set theName to theFile's lastPathComponent() | lns2.scpt |
set theContainer to theFile's stringByDeletingLastPathComponent() | lns2.scpt |
set thePred to current application's NSPredicate's predicateWithFormat_("kMDItemFSName == %@", theName) | lns2.scpt |
theQuery's setSearchScopes:{theContainer} | lns2.scpt |
set metaItem to theQuery's resultAtIndex:0 | lns2.scpt |
set theAttrs to metaItem's attributes() | lns2.scpt |
return (metaItem's valuesForAttributes:theAttrs) as record | lns2.scpt |
property AceptableFileExtensions : {"mp4"} -- Add more video file extentions as I come across them | lns2.scpt |
set WindowLevelOffest to 0 | lns2.scpt |
set FileList to selection | lns2.scpt |
if (FileList = {}) then | lns2.scpt |
display dialog "!There are no items selected in the Finder. Please select some video files." buttons {"OK"} default button "OK" with title "Error" | lns2.scpt |
if (FileList ≠ {}) then | lns2.scpt |
repeat with TheFile in FileList | lns2.scpt |
if (AceptableFileExtensions does not contain ((name extension of TheFile) as text)) then | lns2.scpt |
display dialog "1 or more itmes selected in the Finder is not a video file." buttons {"OK"} default button "OK" with title "Error" | lns2.scpt |
use script "BridgePlus" ## REQUIRED SCRIPT LIB ### | lns2.scpt |
load framework | lns2.scpt |
set mdQueryStr to "kMDItemContentTypeTree CONTAINS 'public.movie'" | lns2.scpt |
set folderToSearch to (choose folder) as alias | lns2.scpt |
set fileList to my spotSearch(folderToSearch, mdQueryStr) | lns2.scpt |
on spotSearch(pFolderToSearchAlias, pQueryStr) | lns2.scpt |
set nsFileList to current application's SMSForder's runSpotlightQuery:pQueryStr inFolders:{pFolderToSearchAlias} |error|:(missing value) | lns2.scpt |
ASify from nsFileList | lns2.scpt |
return nsFileList as list | lns2.scpt |
end spotSearch | lns2.scpt |
property WindowLevelOffest : 0 | lns2.scpt |
on MakeMiniBBEditWin(WindowName, DocText) | lns2.scpt |
make new document with properties {name:WindowName, text:DocText, bounds:{50 + (WindowLevelOffest * 40), 60 + (WindowLevelOffest * 40), 700 + (WindowLevelOffest * 40), 100 + (WindowLevelOffest * 40)}} -- {left, top, right, bottom} | lns2.scpt |
display dialog "Error " & (errNum as string) & " occured while creating the BBEdit document." & return & return & errMsg ¬ | lns2.scpt |
with title "Error" | lns2.scpt |
end MakeMiniBBEditWin | lns2.scpt |
on CreateResults(VideoName, PixelHeight, PixelWidth, FileSize, ItemKind, VideoLength, AudioBitRate, VideoBitRate) | lns2.scpt |
set TheText to "" | lns2.scpt |
if (FileSize ≠ missing value) then | lns2.scpt |
set theFormatter to current application's NSByteCountFormatter's alloc()'s init() | lns2.scpt |
theFormatter's setCountStyle:(current application's NSByteCountFormatterCountStyleDecimal) | lns2.scpt |
theFormatter's setIncludesActualByteCount:true | lns2.scpt |
set ConvertedFileSize to theFormatter's stringFromByteCount:FileSize | lns2.scpt |
set ConvertedFileSize to missing value | lns2.scpt |
if (VideoName ≠ missing value) then | lns2.scpt |
set TheText to TheText & "Video name: " & VideoName & return & return | lns2.scpt |
set TheText to TheText & "Video name: Could not find the video file name" & return & return | lns2.scpt |
set VideoName to "Untitled" | lns2.scpt |
if ((PixelHeight ≠ missing value) and (PixelWidth ≠ missing value)) then | lns2.scpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.