text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
if fpath starts with "~/" then set fpath to "$HOME/" & text 3 thru -1 of fpath | ExploringTypicalObjectModel.applescript |
do shell script "printf '%s\\n' " & quoted form of (prefixDateTime & txtCombined) & " >> \"" & fpath & "\"" | ExploringTypicalObjectModel.applescript |
end dlog | ExploringTypicalObjectModel.applescript |
on getAllDisks() | ExploringTypicalObjectModel.applescript |
set d to get every disk | ExploringTypicalObjectModel.applescript |
set aas to disk "Macintosh HD" | ExploringTypicalObjectModel.applescript |
log "Disks: " & toString(d) | ExploringTypicalObjectModel.applescript |
log "Alias: " & aas | ExploringTypicalObjectModel.applescript |
d | ExploringTypicalObjectModel.applescript |
end getAllDisks | ExploringTypicalObjectModel.applescript |
on getHomeFolders() | ExploringTypicalObjectModel.applescript |
set dthole to folder "dthole" of folder "Users" of disk "Macintosh HD" | ExploringTypicalObjectModel.applescript |
set dthole_folders to folders of dthole | ExploringTypicalObjectModel.applescript |
log "Dthole (Object): " & toString(dthole) | ExploringTypicalObjectModel.applescript |
dthole_folders | ExploringTypicalObjectModel.applescript |
end getHomeFolders | ExploringTypicalObjectModel.applescript |
set all_disks to getAllDisks() | ExploringTypicalObjectModel.applescript |
set dthole_folders to getHomeFolders() | ExploringTypicalObjectModel.applescript |
on parse_input_string(theString) | Convert%20Currency.scpt |
set theFromAmount to text item 1 of theString as text | Convert%20Currency.scpt |
if length of text items of theString is greater than 1 then | Convert%20Currency.scpt |
set theFromCurrency to text item 2 of theString as text | Convert%20Currency.scpt |
set theToCurrency to text item -1 of theString as text | Convert%20Currency.scpt |
set currenciesGiven to true | Convert%20Currency.scpt |
set theFromCurrency to "USD" | Convert%20Currency.scpt |
set theToCurrency to "EUR" | Convert%20Currency.scpt |
set currenciesGiven to false | Convert%20Currency.scpt |
return {fromAmount:theFromAmount, fromCurrency:theFromCurrency, toCurrency:theToCurrency, areCurrenciesGiven:currenciesGiven} | Convert%20Currency.scpt |
end parse_input_string | Convert%20Currency.scpt |
on currency_convert(fromAmount, fromCurrency, toCurrency, currenciesGiven) | Convert%20Currency.scpt |
set theURL to "http://www.google.com/finance/converter?a=" & fromAmount & "&from=" & fromCurrency & "&to=" & toCurrency | Convert%20Currency.scpt |
if currenciesGiven then | Convert%20Currency.scpt |
set theShellScript to "curl " & quoted form of theURL & " 2> /dev/null | xmllint --html --xpath \"//div[@id='currency_converter_result']/span/text()\" - 2> /dev/null" | Convert%20Currency.scpt |
return text item 1 of (do shell script theShellScript) | Convert%20Currency.scpt |
open location theURL | Convert%20Currency.scpt |
end currency_convert | Convert%20Currency.scpt |
on handle_string(theString) | Convert%20Currency.scpt |
set parsedData to my parse_input_string(theString) | Convert%20Currency.scpt |
set toAmount to my currency_convert(fromAmount of parsedData, fromCurrency of parsedData, toCurrency of parsedData, areCurrenciesGiven of parsedData) | Convert%20Currency.scpt |
if areCurrenciesGiven of parsedData then | Convert%20Currency.scpt |
tell application "LaunchBar" | Convert%20Currency.scpt |
set theMessage to toAmount & " " & toCurrency of parsedData | Convert%20Currency.scpt |
set theTitle to (fromAmount of parsedData & " " & fromCurrency of parsedData & " = ") as text | Convert%20Currency.scpt |
display in large type theMessage with title theTitle | Convert%20Currency.scpt |
end handle_string | Convert%20Currency.scpt |
global std, retry, fileUtil, textUtil, cp, kb, uni | atom.applescript |
global RESERVED_DOC_NAMES | atom.applescript |
set thisCaseId to "atom-spotCheck" | atom.applescript |
set configSystem to std's import("config")'s new("system") | atom.applescript |
Manual: Load File (App Open, Not Running, Already Loaded) | atom.applescript |
Manual: Document Info (sample.txt, no file, search result, nav bar focused, Settings) | atom.applescript |
Manual: Close Front Tab | atom.applescript |
set sampleNoteFilePath to configSystem's getValue("AppleScript Core Project Path") & "/apps/3rd-party/Atom/1.60.0/sample.txt" | atom.applescript |
logger's infof("Note Path: [{}]", sampleNoteFilePath) | atom.applescript |
sut's openFile(sampleNoteFilePath) | atom.applescript |
logger's infof("Current Document Name: [{}]", sut's getCurrentDocumentName()) | atom.applescript |
logger's infof("Current File Path: [{}]", sut's getCurrentFilePath()) | atom.applescript |
logger's infof("Current File Extension: [{}]", sut's getCurrentFileExtension()) | atom.applescript |
logger's infof("Current Resource Path: [{}]", sut's getCurrentResourcePath()) | atom.applescript |
logger's infof("Current Base Filename: [{}]", sut's getCurrentBaseFilename()) | atom.applescript |
sut's closeFrontTab() | atom.applescript |
script AtomInstance | atom.applescript |
on openFile(posixPath) | atom.applescript |
set pathUrl to posixPath | atom.applescript |
open location "atom://core/open/file?filename=" & textUtil's encodeUrl(pathUrl) | atom.applescript |
end openFile | atom.applescript |
on getCurrentDocumentName() | atom.applescript |
if running of application "Atom" is false then return missing value | atom.applescript |
tell application "System Events" to tell process "Atom" | atom.applescript |
if (count of windows) is 0 then return missing value | atom.applescript |
set windowTitle to name of window 1 | atom.applescript |
set tokens to textUtil's split(windowTitle, uni's SEPARATOR) | atom.applescript |
set docNameFromTitle to first item of tokens | atom.applescript |
if docNameFromTitle is not "Project" then return docNameFromTitle | atom.applescript |
set docPath to _extractDocPathByHotkey() | atom.applescript |
fileUtil's getBaseFilename(docPath) | atom.applescript |
end getCurrentDocumentName | atom.applescript |
on getCurrentFilePath() | atom.applescript |
set windowTitle to name of front window | atom.applescript |
set titleTokens to textUtil's split(windowTitle, uni's SEPARATOR) | atom.applescript |
if the number of titleTokens is 1 then return missing value | atom.applescript |
set firstItemInTitle to first item of titleTokens | atom.applescript |
if firstItemInTitle is "Project" then return _extractDocPathByHotkey() | atom.applescript |
if RESERVED_DOC_NAMES contains firstItemInTitle then return missing value | atom.applescript |
set filePath to get value of attribute "AXDocument" of front window | atom.applescript |
textUtil's decodeUrl(textUtil's stringAfter(filePath, "file://")) | atom.applescript |
end getCurrentFilePath | atom.applescript |
on closeFrontTab() | atom.applescript |
if running of application "Atom" is false then return | atom.applescript |
click menu item "Close Tab" of menu 1 of menu bar item "File" of menu bar 1 | atom.applescript |
end closeFrontTab | atom.applescript |
on getCurrentFileExtension() | atom.applescript |
set docName to getCurrentDocumentName() | atom.applescript |
if docName is missing value then return missing value | atom.applescript |
set filenameTokens to textUtil's split(docName, ".") | atom.applescript |
if the (count of filenameTokens) is 1 then return missing value | atom.applescript |
last item of filenameTokens | atom.applescript |
end getCurrentFileExtension | atom.applescript |
on getCurrentBaseFilename() | atom.applescript |
set firstToken to first item of filenameTokens | atom.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.