text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
if firstToken is "" or RESERVED_DOC_NAMES contains firstToken then return missing value | atom.applescript |
firstToken | atom.applescript |
end getCurrentBaseFilename | atom.applescript |
on getCurrentResourcePath() | atom.applescript |
set docPath to getCurrentFilePath() | atom.applescript |
if docPath is missing value then return missing value | atom.applescript |
set folderPath to last item of titleTokens | atom.applescript |
set expandedFolderPath to textUtil's replace(folderPath, "~", "/Users/" & std's getUsername()) | atom.applescript |
textUtil's replace(docPath, expandedFolderPath & "/", "") | atom.applescript |
end getCurrentResourcePath | atom.applescript |
on closeAllTabs() | atom.applescript |
activate application "Atom" | atom.applescript |
perform action "AXPress" of menu item "Close All Tabs" of menu 1 of menu bar item "File" of menu bar 1 | atom.applescript |
end closeAllTabs | atom.applescript |
on cleanUp() | atom.applescript |
if not running of application "Atom" then return | atom.applescript |
if running of application "Atom" is true then tell application "Atom" to quit | atom.applescript |
repeat while running of application "Atom" is true | atom.applescript |
end cleanUp | atom.applescript |
on _extractDocPathByHotkey() | atom.applescript |
script GetFromClipboard | atom.applescript |
kb's pressControlShiftKey("c") | atom.applescript |
set docPath to cp's extract(GetFromClipboard) | atom.applescript |
docPath | atom.applescript |
end _extractDocPathByHotkey | atom.applescript |
set RESERVED_DOC_NAMES to {"Settings", "Project", "Project Find Results", "Welcome Guide"} | atom.applescript |
set logger to std's import("logger")'s new("atom") | atom.applescript |
set retry to std's import("retry") | atom.applescript |
set fileUtil to std's import("file") | atom.applescript |
set syseve to std's import("system-events") | atom.applescript |
set uni to std's import("unicodes") | atom.applescript |
set textUtil to std's import("string") | atom.applescript |
set cp to std's import("clipboard")'s new() | atom.applescript |
set kb to std's import("keyboard")'s new() | atom.applescript |
property NSString : a reference to current application's NSString | Kevin's Library.applescript |
property name : "Kevin's Scripting Library" | Kevin's Library.applescript |
property id : "com.kfunderburg.library.kevinsScriptingLibrary" | Kevin's Library.applescript |
property version : "1.0.0" | Kevin's Library.applescript |
property cr : character id 13 | Kevin's Library.applescript |
property lf : character id 10 | Kevin's Library.applescript |
property vt : character id 11 | Kevin's Library.applescript |
on transformText(inString, caseIndicator) | Kevin's Library.applescript |
set the sourceString to NSString's stringWithString:inString | Kevin's Library.applescript |
if the caseIndicator is "upper" then | Kevin's Library.applescript |
set the adjustedString to sourceString's uppercaseString() | Kevin's Library.applescript |
else if the caseIndicator is "lower" then | Kevin's Library.applescript |
set the adjustedString to sourceString's lowercaseString() | Kevin's Library.applescript |
set the adjustedString to sourceString's capitalizedString() | Kevin's Library.applescript |
return (adjustedString as text) | Kevin's Library.applescript |
end transformText | Kevin's Library.applescript |
on capFirstWord(inString) | Kevin's Library.applescript |
set char1 to first character of inString | Kevin's Library.applescript |
set comparisonString to "abcdefghijklmnopqrstuvwxyz" | Kevin's Library.applescript |
if char1 is in comparisonString then set char1 to transformText(char1, "upper") | Kevin's Library.applescript |
set newText to (char1 & (characters 2 thru end of inString)) as string | Kevin's Library.applescript |
end capFirstWord | Kevin's Library.applescript |
on split(theString, theSeparator) | Kevin's Library.applescript |
local saveTID, theResult | Kevin's Library.applescript |
set saveTID to AppleScript's text item delimiters | Kevin's Library.applescript |
set AppleScript's text item delimiters to theSeparator | Kevin's Library.applescript |
set theResult to text items of theString | Kevin's Library.applescript |
set AppleScript's text item delimiters to saveTID | Kevin's Library.applescript |
return theResult | Kevin's Library.applescript |
on join(theString, theSeparator) | Kevin's Library.applescript |
set theResult to theString as text | Kevin's Library.applescript |
end join | Kevin's Library.applescript |
on extractBetween(SearchText, startText, endText) | Kevin's Library.applescript |
set AppleScript's text item delimiters to startText | Kevin's Library.applescript |
set endItems to text of text item -1 of SearchText | Kevin's Library.applescript |
set AppleScript's text item delimiters to endText | Kevin's Library.applescript |
set beginningToEnd to text of text item 1 of endItems | Kevin's Library.applescript |
return beginningToEnd | Kevin's Library.applescript |
end extractBetween | Kevin's Library.applescript |
on SearchandReplace(sourceText, replaceThis, withThat) | Kevin's Library.applescript |
set theString to NSString's stringWithString:sourceText | Kevin's Library.applescript |
set theString to theString's stringByReplacingOccurrencesOfString:replaceThis withString:withThat | Kevin's Library.applescript |
return theString as text | Kevin's Library.applescript |
end SearchandReplace | Kevin's Library.applescript |
on SearchWithRegEx(thePattern, theString, n) | Kevin's Library.applescript |
set theNSString to NSString's stringWithString:theString | Kevin's Library.applescript |
set theOptions to ((current application's NSRegularExpressionDotMatchesLineSeparators) as integer) + ((current application's NSRegularExpressionAnchorsMatchLines) as integer) | Kevin's Library.applescript |
set theRegEx to current application's NSRegularExpression's regularExpressionWithPattern:thePattern options:theOptions |error|:(missing value) | Kevin's Library.applescript |
set theFinds to theRegEx's matchesInString:theNSString options:0 range:{location:0, |length|:theNSString's |length|()} | Kevin's Library.applescript |
set theResult to {} -- we will add to this | Kevin's Library.applescript |
repeat with i from 1 to count of items of theFinds | Kevin's Library.applescript |
set oneFind to (item i of theFinds) | Kevin's Library.applescript |
if (oneFind's numberOfRanges()) as integer < (n + 1) then | Kevin's Library.applescript |
set end of theResult to missing value | Kevin's Library.applescript |
set theRange to (oneFind's rangeAtIndex:n) | Kevin's Library.applescript |
set end of theResult to (theNSString's substringWithRange:theRange) as string | Kevin's Library.applescript |
end SearchWithRegEx | Kevin's Library.applescript |
on TrimWhitespace(sourceString) | Kevin's Library.applescript |
set aString to ((NSString's stringWithString:sourceString)'s stringByTrimmingCharactersInSet:(current application's NSCharacterSet's whitespaceAndNewlineCharacterSet())) as text | Kevin's Library.applescript |
return aString | Kevin's Library.applescript |
end TrimWhitespace | Kevin's Library.applescript |
on isEmpty(str) | Kevin's Library.applescript |
if str is missing value then return true | Kevin's Library.applescript |
return length of str is 0 | Kevin's Library.applescript |
end isEmpty | Kevin's Library.applescript |
on encodePosixtoHFS(theString) | Kevin's Library.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.