text
stringlengths
0
15.7k
source
stringlengths
6
112
keystroke "n" using {command down}
menubarx-new-and-focus.applescript
repeat while i < max
menubarx-new-and-focus.applescript
if (i is equal to max) then return
menubarx-new-and-focus.applescript
log "..."
menubarx-new-and-focus.applescript
if (count of menu bar items) > iconCount
menubarx-new-and-focus.applescript
keystroke "d" using {command down, shift down}
menubarx-new-and-focus.applescript
log "nope"
menubarx-new-and-focus.applescript
set browserName to myGetBrowserName()
Open URLs from clipboard md.applescript
if browserName is "Microsoft Edge" then
Open URLs from clipboard md.applescript
set urls to (the clipboard)
Open URLs from clipboard md.applescript
set urls to my extract_urls(get the clipboard)
Open URLs from clipboard md.applescript
log "extracted urls:" & urls
Open URLs from clipboard md.applescript
set numParagraphs to (number of paragraphs of urls)
Open URLs from clipboard md.applescript
repeat with n from 1 to numParagraphs
Open URLs from clipboard md.applescript
log "** here"
Open URLs from clipboard md.applescript
log paragraph n of urls
Open URLs from clipboard md.applescript
set the theURL to paragraph n of urls
Open URLs from clipboard md.applescript
display dialog error_message with icon stop
Open URLs from clipboard md.applescript
else if browserName is "Microsoft Edge Beta" then
Open URLs from clipboard md.applescript
tell application "Microsoft Edge Beta"
Open URLs from clipboard md.applescript
on extract_urls(theMarkdownURLs)
Open URLs from clipboard md.applescript
set delimitedList to paragraphs of theMarkdownURLs
Open URLs from clipboard md.applescript
set theUrls to ""
Open URLs from clipboard md.applescript
repeat with i in delimitedList
Open URLs from clipboard md.applescript
set theURL to i -- my extract_urls(i)
Open URLs from clipboard md.applescript
set theURL to my extract_url(i)
Open URLs from clipboard md.applescript
if theURL is not "" then -- remove blanks
Open URLs from clipboard md.applescript
set theUrls to theURL & return & theUrls
Open URLs from clipboard md.applescript
log "4. " & (get theURL)
Open URLs from clipboard md.applescript
return theUrls
Open URLs from clipboard md.applescript
end extract_urls
Open URLs from clipboard md.applescript
on extract_url(theMarkdownURL)
Open URLs from clipboard md.applescript
set oldDelims to AppleScript's text item delimiters -- save their current state
Open URLs from clipboard md.applescript
set AppleScript's text item delimiters to {"]("} -- declare new delimiters
Open URLs from clipboard md.applescript
set theURL to (get text item 2 of theMarkdownURL)
Open URLs from clipboard md.applescript
set theURL to text 1 thru -2 of theURL -- strip off the last ")"
Open URLs from clipboard md.applescript
set AppleScript's text item delimiters to oldDelims -- restore them
Open URLs from clipboard md.applescript
set AppleScript's text item delimiters to oldDelims -- restore them in case something went wrong
Open URLs from clipboard md.applescript
return theURL
Open URLs from clipboard md.applescript
end extract_url
Open URLs from clipboard md.applescript
on myGetBrowserName()
Open URLs from clipboard md.applescript
set browserName to (name of every process where name contains "Microsoft Edge")
Open URLs from clipboard md.applescript
if browserName is {} then
Open URLs from clipboard md.applescript
display dialog "Microsoft Edge is not running. Cancel to stop script."
Open URLs from clipboard md.applescript
set browserName to "Microsoft Edge" -- browser to run if not running
Open URLs from clipboard md.applescript
set browserName to item 1 of browserName
Open URLs from clipboard md.applescript
browserName
Open URLs from clipboard md.applescript
end myGetBrowserName
Open URLs from clipboard md.applescript
if {"Script Debugger", "Script Editor"} contains the name of current application then spotCheck()
string.applescript
set thisCaseId to "string-spotCheck"
string.applescript
Unit Test
string.applescript
Wing It!
string.applescript
Encode Multi Line Command
string.applescript
unitTest()
string.applescript
set sut to "1
string.applescript
2"
string.applescript
log urlEncode(sut)
string.applescript
log format("Body: {}", "She said: \"hello?\"")
string.applescript
log format("Body: \"{}\"", "She")
string.applescript
log encodeUrl("docker container run
string.applescript
-it
string.applescript
-v ~/docker/mysql-data:/var/lib/mysql
string.applescript
-v \"`pwd`/init\":/docker-entrypoint-initdb.d
string.applescript
-e MYSQL_ROOT_PASSWORD=dev
string.applescript
-p 4306:3306
string.applescript
mysql:5")
string.applescript
on stringAfter(sourceText, substring)
string.applescript
if sourceText does not contain substring then return missing value
string.applescript
if sourceText ends with substring then return missing value
string.applescript
text ((offset of substring in sourceText) + (count of substring)) thru -1 of sourceText
string.applescript
end stringAfter
string.applescript
on lastStringAfter(sourceText, substring)
string.applescript
last item of split(sourceText, substring)
string.applescript
end lastStringAfter
string.applescript
on stringBefore(sourceText, substring)
string.applescript
if sourceText starts with substring then return missing value
string.applescript
text 1 thru ((offset of substring in sourceText) - 1) of sourceText
string.applescript
end stringBefore
string.applescript
on replaceFirst(sourceText, substring, replacement)
string.applescript
set substringOffset to offset of substring in sourceText
string.applescript
if substringOffset is 0 then return sourceText
string.applescript
if sourceText starts with substring then return replacement & text ((length of substring) + 1) thru (length of sourceText) of sourceText
string.applescript
if substringOffset + (length of (substring)) is equal to the (length of sourceText) + 1 then
string.applescript
set endIdx to (offset of substring in sourceText) - 1 + (length of substring)
string.applescript
return (text 1 thru (substringOffset - 1) of sourceText) & replacement
string.applescript
if length of substring is greater than length of sourceText then return sourceText
string.applescript
if substringOffset is greater than 1 then
string.applescript
set startText to text 1 thru (substringOffset - 1) of sourceText
string.applescript
set replaceEndOffset to length of sourceText
string.applescript
if length of sourceText is greater than substringOffset + (length of substring) - 1 then set replaceEndOffset to substringOffset + (length of substring)
string.applescript
set endText to text replaceEndOffset thru (length of sourceText) of sourceText
string.applescript
return startText & replacement & endText
string.applescript
end replaceFirst
string.applescript
on removeUnicode(textWithUnicodeChar)
string.applescript
do shell script "echo " & quoted form of textWithUnicodeChar & " | iconv -c -f utf-8 -t ascii || true"
string.applescript
end removeUnicode
string.applescript
end urlEncode
string.applescript
*)
string.applescript
on encodeUrl(theString as text)
string.applescript
set replacedText to replace(theString, ASCII character 10, "%0A")
string.applescript