text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set twoTabs to tab & tab
|
lns3.scpt
|
repeat while theString contains twoTabs
|
lns3.scpt
|
replaceString(twoTabs, tab)
|
lns3.scpt
|
set twoSpaces to space & space
|
lns3.scpt
|
repeat while theString contains twoSpaces
|
lns3.scpt
|
replaceString(twoSpaces, space)
|
lns3.scpt
|
if length of theString > 1 then
|
lns3.scpt
|
repeat while character 1 of theString = tab or character 1 of theString = space or character 1 of theString = lf
|
lns3.scpt
|
set theString to text 2 thru -1 of theString
|
lns3.scpt
|
repeat while last character of theString = tab or last character of theString = space or last character of theString = lf
|
lns3.scpt
|
set theString to text 1 thru -2 of theString
|
lns3.scpt
|
end trimWhitespace
|
lns3.scpt
|
on uppercase() --> string
|
lns3.scpt
|
set theString to (current application's NSString's stringWithString:theString)'s uppercaseString as item
|
lns3.scpt
|
end uppercase
|
lns3.scpt
|
on lowercase() --> string
|
lns3.scpt
|
set theString to (current application's NSString's stringWithString:theString)'s lowercaseString as item
|
lns3.scpt
|
end lowercase
|
lns3.scpt
|
on titlecase() --> string
|
lns3.scpt
|
set theString to (current application's NSString's stringWithString:theString)'s capitalizedString as item
|
lns3.scpt
|
end titlecase
|
lns3.scpt
|
property lowers : "œæáàâäãåéèêëóòôöõúùûüíìîïñçøÿπß"
|
lns3.scpt
|
property uppers : "ŒÆÁÀÂÄÃÅÉÈÊËÓÒÔÖÕÚÙÛÜÍÌÎÏÑÇØŸ∏ẞ"
|
lns3.scpt
|
on uppercase_pureAS() --> string
|
lns3.scpt
|
local newString
|
lns3.scpt
|
set newString to ""
|
lns3.scpt
|
set ncl to number of characters of lowers
|
lns3.scpt
|
repeat with c in characters of theString
|
lns3.scpt
|
set a to id of c
|
lns3.scpt
|
if a > 96 and a < 123 then
|
lns3.scpt
|
set a to a - 32
|
lns3.scpt
|
set newString to newString & (character id a)
|
lns3.scpt
|
set found to true
|
lns3.scpt
|
if (not found) and (a > 128) then
|
lns3.scpt
|
repeat with lc from 1 to ncl
|
lns3.scpt
|
if contents of c = character lc of lowers then
|
lns3.scpt
|
set newString to newString & character lc of uppers
|
lns3.scpt
|
if not found then
|
lns3.scpt
|
set newString to newString & c
|
lns3.scpt
|
set theString to newString
|
lns3.scpt
|
end uppercase_pureAS
|
lns3.scpt
|
on lowercase_pureAS() --> string
|
lns3.scpt
|
set ncl to number of characters of uppers
|
lns3.scpt
|
if a > 64 and a < 91 then
|
lns3.scpt
|
set a to a + 32
|
lns3.scpt
|
if contents of c = character lc of uppers then
|
lns3.scpt
|
set newString to newString & character lc of lowers
|
lns3.scpt
|
end lowercase_pureAS
|
lns3.scpt
|
on titlecase_pureAS() --> string
|
lns3.scpt
|
set firstChar to true -- start with first char
|
lns3.scpt
|
if a is in {9, 11, 32, 34, 39, 160, 2018, 8220} then
|
lns3.scpt
|
set firstChar to true
|
lns3.scpt
|
if a > 64 and a < 91 and not firstChar then
|
lns3.scpt
|
else if a > 96 and a < 123 and firstChar then
|
lns3.scpt
|
if not firstChar then
|
lns3.scpt
|
set firstChar to false
|
lns3.scpt
|
end titlecase_pureAS
|
lns3.scpt
|
on abs(n)
|
lns3.scpt
|
if n < 0 then
|
lns3.scpt
|
return -n
|
lns3.scpt
|
on isWhiteSpace(c)
|
lns3.scpt
|
return c = space or c = tab or c = return or c = linefeed
|
lns3.scpt
|
end isWhiteSpace
|
lns3.scpt
|
property gLeftApostrophe : character id 8216
|
lns3.scpt
|
property gRightApostrophe : character id 8217
|
lns3.scpt
|
property gLeftQuote : character id 8220
|
lns3.scpt
|
property gRightQuote : character id 8221
|
lns3.scpt
|
property singleQuote : "'"
|
lns3.scpt
|
property doubleQuote : "\""
|
lns3.scpt
|
on smartenQuotes()
|
lns3.scpt
|
set newString to {}
|
lns3.scpt
|
set n to number of characters of theString
|
lns3.scpt
|
set s to theString
|
lns3.scpt
|
set prevChar to ""
|
lns3.scpt
|
set theChar to character i of theString
|
lns3.scpt
|
if (theChar = singleQuote or theChar = doubleQuote) then
|
lns3.scpt
|
if (prevChar = 0 or ¬
|
lns3.scpt
|
prevChar = "(" or prevChar = "[" or prevChar = "{" or ¬
prevChar = "<" or prevChar = 171 or ¬
prevChar = character id 12296 or prevChar = character id 12298 or ¬
(prevChar = gLeftQuote and theChar = singleQuote) or ¬
(prevChar = gLeftApostrophe and theChar = doubleQuote) or ¬
isWhiteSpace(prevChar)) then
if theChar = singleQuote then
set theChar to gLeftApostrophe
else
set theChar to gLeftQuote
end if
else
if theChar = singleQuote then
set theChar to gRightApostrophe
else
set theChar to gRightQuote
end if
end if
set prevChar to theChar as string
end if
copy theChar to end of newString
end repeat
setString(newString as string)
return getString()
end smartenQuotes
-- file path utilities
on filename()
return lastToken("/")
end filename
on dirPath()
return beforeString(filename())
end dirPath
on fileExtension()
tell newString(filename())
return afterString(".")
end tell
end fileExtension
on fileBasename()
tell newString(filename())
return beforeString(".")
end tell
end fileBasename
end script
on display overlay text sourceText duration durationValue : 0 goose honk gooseHonkValue : false advanced settings advancedSettingsRecord : {}
|
lns3.scpt
|
set the honkUtility to the quoted form of the POSIX path of (path to resource "BigHonkingText")
|
lns3.scpt
|
set the commandString to honkUtility & space & (quoted form of the (space & sourceText & space))
|
lns3.scpt
|
if durationValue is not missing value then
|
lns3.scpt
|
set the durationValue to (durationValue as integer) as string
|
lns3.scpt
|
set the commandSubstring to "-p" & space & durationValue
|
lns3.scpt
|
set the commandString to commandString & space & commandSubstring
|
lns3.scpt
|
if gooseHonkValue is not missing value then
|
lns3.scpt
|
if gooseHonkValue is true then
|
lns3.scpt
|
set the commandString to commandString & space & "-H"
|
lns3.scpt
|
if advancedSettingsRecord is not missing value then
|
lns3.scpt
|
try -- will fail if the matching setting is not in the passed record
|
lns3.scpt
|
set fontColorValue to the font color of advancedSettingsRecord
|
lns3.scpt
|
if fontColorValue is not missing value then
|
lns3.scpt
|
if the class of fontColorValue is list then
|
lns3.scpt
|
set fontColorValue to text 2 thru -1 of (my RBGtoHTML(fontColorValue))
|
lns3.scpt
|
set the commandString to commandString & space & "-f" & space & fontColorValue
|
lns3.scpt
|
set backgroundColorValue to the background color of advancedSettingsRecord
|
lns3.scpt
|
if backgroundColorValue is not missing value then
|
lns3.scpt
|
if the class of backgroundColorValue is list then
|
lns3.scpt
|
set backgroundColorValue to text 2 thru -1 of (my RBGtoHTML(backgroundColorValue))
|
lns3.scpt
|
set the commandString to commandString & space & "-b" & space & backgroundColorValue
|
lns3.scpt
|
set backgroundDimensions to the background dimensions of advancedSettingsRecord
|
lns3.scpt
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.