text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
" is not a valid time!" buttons {"Cancel", "Try Again"} default button 2 with icon 2 | create-itunes-tone.scpt |
end setToneDuration | create-itunes-tone.scpt |
log convertToDecimal("FF", 16) -- Hexadecimal | convertToDecimal.applescript |
on convertToDecimal(aValue, baseOfValue) | convertToDecimal.applescript |
set valueComponents to characters of (aValue as string) | convertToDecimal.applescript |
set valueComponents to reverse of valueComponents | convertToDecimal.applescript |
set decimalValue to 0 | convertToDecimal.applescript |
repeat with i from 1 to count of valueComponents | convertToDecimal.applescript |
set char to item i of valueComponents | convertToDecimal.applescript |
set charNumber to ASCII number char | convertToDecimal.applescript |
if charNumber ≥ 65 and charNumber ≤ 90 then | convertToDecimal.applescript |
set v to charNumber - 55 | convertToDecimal.applescript |
set v to char as integer | convertToDecimal.applescript |
repeat i - 1 times | convertToDecimal.applescript |
set v to v * baseOfValue | convertToDecimal.applescript |
set decimalValue to decimalValue + v | convertToDecimal.applescript |
return decimalValue | convertToDecimal.applescript |
end convertToDecimal | convertToDecimal.applescript |
on mergeSort(theList, l, r) -- Sort items l thru r of theList. | mergesort.applescript |
property auxList : missing value | mergesort.applescript |
on msrt(l, r) | mergesort.applescript |
set leftR to (l + r) div 2 -- Left half end index. | mergesort.applescript |
set rx to leftR + 1 -- Right half start/tracking index. | mergesort.applescript |
if (leftR - l > 1) then | mergesort.applescript |
msrt(l, leftR) | mergesort.applescript |
else if (leftR > l) then | mergesort.applescript |
set lv to item l of my lst | mergesort.applescript |
set rv to item leftR of my lst | mergesort.applescript |
if (rv < lv) then | mergesort.applescript |
set item l of my lst to rv | mergesort.applescript |
set item leftR of my lst to lv | mergesort.applescript |
if (r - rx > 1) then | mergesort.applescript |
msrt(rx, r) | mergesort.applescript |
else if (r > rx) then | mergesort.applescript |
set lv to item rx of my lst | mergesort.applescript |
set rv to item r of my lst | mergesort.applescript |
set item rx of my lst to rv | mergesort.applescript |
set item r of my lst to lv | mergesort.applescript |
set auxList to items l thru leftR of my lst | mergesort.applescript |
set lx to 1 | mergesort.applescript |
set leftR to rx - l | mergesort.applescript |
set lv to beginning of my auxList | mergesort.applescript |
set rv to item rx of my lst | mergesort.applescript |
repeat with dx from l to r | mergesort.applescript |
set item dx of my lst to rv | mergesort.applescript |
if (rx is r) then | mergesort.applescript |
repeat with dx from (dx + 1) to r | mergesort.applescript |
set item dx of my lst to item lx of my auxList | mergesort.applescript |
set lx to lx + 1 | mergesort.applescript |
set rx to rx + 1 | mergesort.applescript |
set item dx of my lst to lv | mergesort.applescript |
if (lx is leftR) then exit repeat | mergesort.applescript |
set lv to item lx of my auxList | mergesort.applescript |
end msrt | mergesort.applescript |
o's msrt(l, r) | mergesort.applescript |
return -- nothing | mergesort.applescript |
end mergeSort | mergesort.applescript |
property sort : mergeSort | mergesort.applescript |
tell (load script POSIX file "/Users/matt/code/chrome-window-management-scripts/Raise in Chrome Library.scpt") | Restore Windows in Chrome.scpt |
restoreChromeWindow("https://mail.google.com/mail/u/0/", " - Gmail", "Gmail", {0, 23}, {1111, 873}, "ui=") | Restore Windows in Chrome.scpt |
restoreChromeWindow("https://drive.google.com/drive/(?!u/[1-9]/)", " - Google Drive", "Personal Docs", {-1526, -481}, {1190, 1080}, "ui=") | Restore Windows in Chrome.scpt |
set thisCaseId to "keyboard-maestro-macro-spotCheck" | keyboard-maestro-macro.applescript |
Manual: New Instance (Missing, Present) | keyboard-maestro-macro.applescript |
Manual: Enable Macro, get state | keyboard-maestro-macro.applescript |
Manual: Disable Macro, get state | keyboard-maestro-macro.applescript |
set sut to new("POC") | keyboard-maestro-macro.applescript |
set sut to new("POCx") | keyboard-maestro-macro.applescript |
sut's enable() | keyboard-maestro-macro.applescript |
logger's infof("Enabled: {}", sut's isEnabled()) | keyboard-maestro-macro.applescript |
assertThat of std given condition:sut's isEnabled() is true, messageOnFail:"Failed spot check" | keyboard-maestro-macro.applescript |
sut's disable() | keyboard-maestro-macro.applescript |
assertThat of std given condition:sut's isEnabled() is false, messageOnFail:"Failed spot check" | keyboard-maestro-macro.applescript |
on new(pMacroName) | keyboard-maestro-macro.applescript |
set matchedMacro to missing value | keyboard-maestro-macro.applescript |
set matchedMacro to first macro whose name is equal to pMacroName | keyboard-maestro-macro.applescript |
if matchedMacro is missing value then error "The macro with the name: " & pMacroName & " was not found" | keyboard-maestro-macro.applescript |
script KeyboardMaestroMacroInstance | keyboard-maestro-macro.applescript |
property macroName : pMacroName | keyboard-maestro-macro.applescript |
property _macro : matchedMacro | keyboard-maestro-macro.applescript |
set enabled of _macro to false | keyboard-maestro-macro.applescript |
set enabled of _macro to true | keyboard-maestro-macro.applescript |
on isEnabled() | keyboard-maestro-macro.applescript |
enabled of _macro | keyboard-maestro-macro.applescript |
end isEnabled | keyboard-maestro-macro.applescript |
set logger to std's import("logger")'s new("keyboard-maestro-macro") | keyboard-maestro-macro.applescript |
property my_username : "domain\\username" | add computers to MRDC.applescript |
property computer_list : {"123", "124", "125"} | add computers to MRDC.applescript |
property host_prefix : "abc-" | add computers to MRDC.applescript |
property host_sufix : "domain.com" | add computers to MRDC.applescript |
display dialog "Domain Username" default answer my_username buttons {"OK", "Cancel"} default button 1 | add computers to MRDC.applescript |
set my_username to text returned of result | add computers to MRDC.applescript |
display dialog "Password for " & my_username default answer "" buttons {"OK", "Cancel"} default button 1 | add computers to MRDC.applescript |
set my_password to text returned of result | add computers to MRDC.applescript |
display dialog "Local Username" default answer "" buttons {"OK", "Cancel"} default button 1 | add computers to MRDC.applescript |
set local_username to text returned of result | add computers to MRDC.applescript |
display dialog "Password for " & local_username default answer "" buttons {"OK", "Cancel"} default button 1 | add computers to MRDC.applescript |
set local_password to text returned of result | add computers to MRDC.applescript |
repeat with an_computer in computer_list | add computers to MRDC.applescript |
add_computer("Dom", host_prefix & an_computer & host_sufix, my_username, my_password) | add computers to MRDC.applescript |
add_computer("Loc", host_prefix & an_computer & host_sufix, local_username, local_password) | add computers to MRDC.applescript |
Subsets and Splits