text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
on accessoryValues(accessory)
|
NSAlert.applescript
|
if accessory is missing value then return missing value
|
NSAlert.applescript
|
set values to current application's NSMutableDictionary's alloc's init()
|
NSAlert.applescript
|
repeat with aView in (accessory's contentView's subviews)
|
NSAlert.applescript
|
tell values to setValue:(aView's state) forKey:(aView's title)
|
NSAlert.applescript
|
return values as record
|
NSAlert.applescript
|
end accessoryValues
|
NSAlert.applescript
|
to makeGroupButton at origin given radio:radio : true, width:width : 100, buttonName:buttonName : "Button", lineBreakMode:lineBreakMode : 5, tag:tag : missing value, action:action : "buttonGroupAction:", target:target : missing value
|
NSAlert.applescript
|
do shell script "pkill -9 \"IBDesignablesAgentCocoaTouch\""
|
RestartXcodeServices.applescript
|
do shell script "pkill -9 \"SourceKitService\""
|
RestartXcodeServices.applescript
|
do shell script "pkill -9 \"Interface Builder Cocoa Touch Tool\""
|
RestartXcodeServices.applescript
|
do shell script "/bin/launchctl list | grep SimDevice | awk '{print $3}' | xargs -I %s /bin/launchctl stop %s"
|
RestartXcodeServices.applescript
|
set startTime to (date (date string of startTime)) -- set to midnight for today
|
move all current events 1 day.applescript
|
offset of "-1" in "123"
|
offset of "-1" in "123".applescript
|
keystroke "email.test"
|
f5.applescript
|
set greetingText to "Hello Mac"
|
variable.applescript
|
display dialog greetingText
|
variable.applescript
|
use AppleScript version "2.7" -- Yosemite (10.10) or later
|
route-screen.applescript
|
tell window "DELL U2415" -- change the window name for different display
|
route-screen.applescript
|
click radio button "Display" of tab group 1
|
route-screen.applescript
|
set theGroup to tab group 1
|
route-screen.applescript
|
tell pop up button "Rotation:" of theGroup
|
route-screen.applescript
|
set theStat to value of it
|
route-screen.applescript
|
if theStat = "Standard" then
|
route-screen.applescript
|
click menu item 4 -- 270 dig
|
route-screen.applescript
|
click menu item 1 -- standard
|
route-screen.applescript
|
tell application "Todoist"
|
MacTodoistAutomationExample.scpt
|
tell application "System Events" to keystroke "q"
|
MacTodoistAutomationExample.scpt
|
tell application "System Events" to keystroke "test task from AppleScript"
|
MacTodoistAutomationExample.scpt
|
tell application "System Events" to key code 76 -- press enter
|
MacTodoistAutomationExample.scpt
|
return runShellScript()
|
returnShellResult.applescript
|
on runShellScript()
|
returnShellResult.applescript
|
set currentscript to "ls /Applications/"
|
returnShellResult.applescript
|
set shellResults to do shell script currentscript without altering line endings
|
returnShellResult.applescript
|
return shellResults
|
returnShellResult.applescript
|
end runShellScript
|
returnShellResult.applescript
|
keystroke "t" using {command down} # +SHIFT
|
new.applescript
|
property numOfSafariWindows : 0
|
save_safari_window_pos.applescript
|
property posOfSafariWindows : {}
|
save_safari_window_pos.applescript
|
property sizeOfSafariWindows : {}
|
save_safari_window_pos.applescript
|
set theResults to display dialog "Restore window positions or save window positions?" buttons {"Restore", "Save"} default button "Restore" giving up after 5
|
save_safari_window_pos.applescript
|
log theResults
|
save_safari_window_pos.applescript
|
if (gave up of theResults) is true then
|
save_safari_window_pos.applescript
|
set the button returned of theResults to "Restore"
|
save_safari_window_pos.applescript
|
if (button returned of theResults) is "Restore" then
|
save_safari_window_pos.applescript
|
log {"numOfSafariWindows: " & numOfSafariWindows}
|
save_safari_window_pos.applescript
|
if (count of windows) < numOfSafariWindows then
|
save_safari_window_pos.applescript
|
repeat with i from (1 + (count of windows)) to numOfSafariWindows
|
save_safari_window_pos.applescript
|
make new document at the end of documents
|
save_safari_window_pos.applescript
|
repeat with i from 1 to numOfSafariWindows
|
save_safari_window_pos.applescript
|
set position of window i to (item i of posOfSafariWindows)
|
save_safari_window_pos.applescript
|
set size of window i to (item i of sizeOfSafariWindows)
|
save_safari_window_pos.applescript
|
set numOfSafariWindows to count of windows
|
save_safari_window_pos.applescript
|
set posOfSafariWindows to {}
|
save_safari_window_pos.applescript
|
set sizeOfSafariWindows to {}
|
save_safari_window_pos.applescript
|
set end of posOfSafariWindows to (position of window i)
|
save_safari_window_pos.applescript
|
set end of sizeOfSafariWindows to (size of window i)
|
save_safari_window_pos.applescript
|
tell application "System Events" to key code 124 using command down -- end of line
|
end_of_line.scpt
|
set termcommand to text returned of (display dialog "Enter a command to run:" default answer "" buttons {"Quit", "Run"} default button "Run")
|
NoTerminal.applescript
|
if termcommand contains "" then
|
NoTerminal.applescript
|
else if termcommand contains termcommand then
|
NoTerminal.applescript
|
set resultdisp to do shell script termcommand
|
NoTerminal.applescript
|
display alert resultdisp
|
NoTerminal.applescript
|
display alert "Your command failed to execute"
|
NoTerminal.applescript
|
/**
|
projFromTemplate.applescript
|
* Create Omnifocus tasks based on input template file
|
projFromTemplate.applescript
|
* Format of file:
|
projFromTemplate.applescript
|
$team = test1, test2, test 3
|
projFromTemplate.applescript
|
$stuff = something interesting
|
projFromTemplate.applescript
|
$project = Test Project
|
projFromTemplate.applescript
|
Do something @focus ::${project} #5pm #tomorrow //Note
|
projFromTemplate.applescript
|
Do another thing @focus ::${project}
|
projFromTemplate.applescript
|
subtask1 of ${stuff} @${team} ::${project}
|
projFromTemplate.applescript
|
subtask2 @${team} ::${project}
|
projFromTemplate.applescript
|
Main task ${undef} @test1 ::${project}
|
projFromTemplate.applescript
|
app = Application.currentApplication();
|
projFromTemplate.applescript
|
OF = Application('OmniFocus');
|
projFromTemplate.applescript
|
OFdoc = OF.defaultDocument
|
projFromTemplate.applescript
|
/* debugger */
|
projFromTemplate.applescript
|
// Select input file and retrieve contents
|
projFromTemplate.applescript
|
template = app.chooseFile({
withPrompt:"Select Omnifocus Template",
ofType:"public.text"
});
|
projFromTemplate.applescript
|
templateContents = app.read(template, {usingDelimiter:'\n'});
|
projFromTemplate.applescript
|
// Process each line of the template file
|
projFromTemplate.applescript
|
var templateVars = {}; // Associative array of text variables
|
projFromTemplate.applescript
|
var newTasks = []; // Array of new tasks to be created
|
projFromTemplate.applescript
|
for (var i = 0 ; i < templateContents.length ; i++) {
if (templateContents[i].trim().match(/^\$\w+\s*=/) != null) {
// Grab variables to be used for later substitution in text
parts = templateContents[i].split('=');
varname = parts[0].trim();
values = parts[1].split(',').map(function(s) { return s.trim() });
|
projFromTemplate.applescript
|
templateVars[varname] = values;
|
projFromTemplate.applescript
|
replaceVars(templateContents[i]);
|
projFromTemplate.applescript
|
// TODO Build nested project tree, create undefined project
|
projFromTemplate.applescript
|
for (var i = 0 ; i < newTasks.length ; i++) {
OFparse(newTasks[i]);
}
|
projFromTemplate.applescript
|
* Replace first variable of form ${var} with single value or array of values, recurse to replace all variables
|
projFromTemplate.applescript
|
* @method replaceVars
|
projFromTemplate.applescript
|
* @param {string} string - string to operate on
|
projFromTemplate.applescript
|
* @global {associative array} templateVars - Array of variable names => array of replacement strings
|
projFromTemplate.applescript
|
* @global {array of strings} newTasks - Array of task names with variables replaced
|
projFromTemplate.applescript
|
* @return null
|
projFromTemplate.applescript
|
function replaceVars(string) {
var stringVars = string.match(/\${[^}]*}/g); // Look for variables to replace
|
projFromTemplate.applescript
|
if (stringVars == null) {
// If no variables found, add to task list
newTasks.push(string);
} else {
|
projFromTemplate.applescript
|
// Replace first variable in the string and recurse
|
projFromTemplate.applescript
|
var cleanName = stringVars[0].replace(/[{}]/g,'');
|
projFromTemplate.applescript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.