text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set ASFormattingStyle to import_script("ASFormattingStyle") | AppleScriptDoc.applescript |
set ASHTML to import_script("ASHTML")'s initialize() | AppleScriptDoc.applescript |
set XFile to make (import_script("XFileExtend")) | AppleScriptDoc.applescript |
set ASDocParser to import_script("ASDocParser") | AppleScriptDoc.applescript |
ASDocParser's set_wrap_with_block(false) | AppleScriptDoc.applescript |
set DocElements to import_script("DocElements") | AppleScriptDoc.applescript |
set ExportHelpBook to import_script("ExportHelpBook") | AppleScriptDoc.applescript |
set SetupHelpBook to import_script("SetupHelpBook") | AppleScriptDoc.applescript |
set SaveToFile to import_script("SaveToFile") | AppleScriptDoc.applescript |
set InfoPlistArranger to import_script("InfoPlistArranger") | AppleScriptDoc.applescript |
set ScriptLinkMaker to import_script("ScriptLinkMaker") | AppleScriptDoc.applescript |
set HandlerElement to import_script("HandlerElement") | AppleScriptDoc.applescript |
set my _ignoring_comment_pattern to XRegex's make_with("\\S+\\s*\\(\\*.+\\*\\)") | AppleScriptDoc.applescript |
if exists disk "MYDISK" then | Eject%20Disk%20image%20or%20External%20Disk%20Applescript.scpt |
tell application "Finder" to eject disk "MYDISK" | Eject%20Disk%20image%20or%20External%20Disk%20Applescript.scpt |
set thisCaseId to "file-spotCheck" | file.applescript |
POSIX File Exist | file.applescript |
POSIX File Don't Exist | file.applescript |
Read Text File | file.applescript |
Manual: POSIX Folder Exist | file.applescript |
set userPath to format {"/Users/{}", std's getUsername()} | file.applescript |
set existingFilePath to format {"{}/.zprofile", userPath} | file.applescript |
log posixFilePathExists(existingFilePath) | file.applescript |
set existingFilePath to format {"{}/virus.txt", userPath} | file.applescript |
set posixPath to "/etc/hosts" | file.applescript |
log readFile(POSIX file posixPath) | file.applescript |
set posixPath to "/Users/" & std's getUsername() & "/Desktop" | file.applescript |
logger's debugf("posix Folder Path exists: {}", posixFolderPathExists(posixPath)) | file.applescript |
set posixPath to "/Users/" & std's getUsername() & "/Unicorn" | file.applescript |
on readFile(posixFilePath as string) | file.applescript |
read file posixFilePath | file.applescript |
on posixFilePathExists(posixFilePath) | file.applescript |
set shellCommand to format {"test -f {} && echo 'true'", quoted form of posixFilePath} | file.applescript |
return (do shell script shellCommand) is equal to "true" | file.applescript |
end posixFilePathExists | file.applescript |
on posixFolderPathExists(posixFilePath) | file.applescript |
set shellCommand to format {"test -d {} && echo 'true'", quoted form of posixFilePath} | file.applescript |
end posixFolderPathExists | file.applescript |
on readTempFile() | file.applescript |
tell application "Finder" to set theFile to file "applescript.tmp" of folder "AppleScript" of (path to home folder) | file.applescript |
read file theFile | file.applescript |
end readTempFile | file.applescript |
on writeTextToTempFile(theText as text) | file.applescript |
set targetFolder to folder "AppleScript" of (path to home folder) | file.applescript |
if not (exists of file "applescript.tmp" of targetFolder) then | file.applescript |
make new file at targetFolder with properties {name:"applescript.tmp", file type:"text"} | file.applescript |
set theFile to file "applescript.tmp" of folder "AppleScript" of (path to home folder) | file.applescript |
write theText to theOpenedFile starting at eof | file.applescript |
end writeTextToTempFile | file.applescript |
on getBaseFileName(filePath) | file.applescript |
if (offset of ":" in filePath) is greater than 0 then -- Mac OS Notation | file.applescript |
set theDelimiter to ":" | file.applescript |
else -- assume POSIX format | file.applescript |
set theDelimiter to "/" | file.applescript |
set theList to textUtil's split(filePath, theDelimiter) | file.applescript |
last item of theList | file.applescript |
end getBaseFileName | file.applescript |
on convertPosixToMacOsNotation(posixFilePath) | file.applescript |
(POSIX file posixFilePath) as string | file.applescript |
end convertPosixToMacOsNotation | file.applescript |
POSIX path of thePath | file.applescript |
set logger to std's import("logger")'s new("file") | file.applescript |
newMethod("getBaseFileName") | file.applescript |
assertEqual("sublimetext3.applescript", my getBaseFileName("/Users/cloud.strife/projects/@rt-learn-lang/applescript/DEPLOYED/Common/sublimetext3.applescript"), "Happy Case") | file.applescript |
* Open In iTerm v1.3 | Open In iTerm copy 2.applescript |
* | Open In iTerm copy 2.applescript |
* This is a Finder-toolbar script, which opens iTerm tabs/windows conveniently. | Open In iTerm copy 2.applescript |
* When its icon is clicked on in the toolbar of a Finder window, it opens a new iTerm tab, | Open In iTerm copy 2.applescript |
* or window if the fn key is down, and switches the shell's current working directory | Open In iTerm copy 2.applescript |
* to the Finder window's folder. See README.md for more details, including how to build | Open In iTerm copy 2.applescript |
* and install. | Open In iTerm copy 2.applescript |
* Copyright (c) 2018, 2021 Jason Jackson | Open In iTerm copy 2.applescript |
* This program is free software: you can redistribute it and/or modify it under the terms | Open In iTerm copy 2.applescript |
* of the GNU General Public License as published by the Free Software Foundation, | Open In iTerm copy 2.applescript |
* either version 3 of the License, or (at your option) any later version. | Open In iTerm copy 2.applescript |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | Open In iTerm copy 2.applescript |
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | Open In iTerm copy 2.applescript |
* See the GNU General Public License for more details. | Open In iTerm copy 2.applescript |
* You should have received a copy of the GNU General Public License along with this program. | Open In iTerm copy 2.applescript |
* If not, see <http://www.gnu.org/licenses/>. | Open In iTerm copy 2.applescript |
ObjC.import('Foundation') | Open In iTerm copy 2.applescript |
var app = Application.currentApplication() | Open In iTerm copy 2.applescript |
function run() {
var iTerm, params = {} | Open In iTerm copy 2.applescript |
try {
iTerm = Application("iTerm")
} | Open In iTerm copy 2.applescript |
catch (ex) {
displayAlert("iTerm isn't installed", ex.toString())
return
} | Open In iTerm copy 2.applescript |
// figure out what to do, based on command-line parameters, keyboard state and/or Finder state | Open In iTerm copy 2.applescript |
parseCommandLineParameters(collectCommandLineParameters(), params) | Open In iTerm copy 2.applescript |
if (params.openTab == undefined) {
params.openTab = shouldOpenTabThisTime()
if (params.openTab === null) {
// the option key is down, and the Finder window will close, so we should do nothing
return
} | Open In iTerm copy 2.applescript |
try {
if (params.folderPath == undefined) {
params.folderPath = getFinderFolder()
} | Open In iTerm copy 2.applescript |
catch (ex) {
if (ex.noFolderFound) {
var details = "Finder can display some things that look like folders, but for which there is no actual on-disk folder; "
details += "since there's no actual \"" + ex.message + "\" folder, it can't be opened in iTerm.\n"
var reply = displayAlert("Can't open folder in iTerm", details, [ "Cancel", "Open iTerm Anyway" ])
if (reply.buttonReturned == "Cancel") return
} | Open In iTerm copy 2.applescript |
else {
displayAlert("Can't open folder in iTerm", ex.toString())
return
} | Open In iTerm copy 2.applescript |
// if we want to open a new window, and iTerm is already running with open windows, | Open In iTerm copy 2.applescript |
// "open -a" doesn't do what we want (it always opens a new tab in an existing window), | Open In iTerm copy 2.applescript |
// so we use iTerm's scripting API instead; it brings all iTerm windows to the front, | Open In iTerm copy 2.applescript |
// sadly, but I see no workaround | Open In iTerm copy 2.applescript |
if (!params.openTab && iTermIsRunning() && iTerm.windows.length) {
iTerm.createWindowWithDefaultProfile()
sendShellScript(iTerm, params.folderPath)
return
} | Open In iTerm copy 2.applescript |
// we also must use iTerm's scripting API if the path contains backslashes; otherwise, | Open In iTerm copy 2.applescript |
// the shell's working directory does not get changed, due to an apparent iTerm bug (v3.4.8) | Open In iTerm copy 2.applescript |
if (params.folderPath.indexOf('\\') != -1) {
if (!iTermIsRunning()) {
iTerm.activate() // opens a new window as iTerm starts up
} | Open In iTerm copy 2.applescript |
else if (!iTerm.windows.length || !params.openTab) {
iTerm.createWindowWithDefaultProfile() // brings all iTerm windows to the front, sadly
} | Open In iTerm copy 2.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.