text
stringlengths
0
15.7k
source
stringlengths
6
112
set sut to path of document of theWindow
script-editor.applescript
set scriptName to name of document of theWindow
script-editor.applescript
set scriptNameLength to count of scriptName
script-editor.applescript
set reducedLength to (sut's length) - scriptNameLength
script-editor.applescript
set location to text 1 thru reducedLength of sut
script-editor.applescript
(POSIX file location) as text
script-editor.applescript
end getScriptLocation
script-editor.applescript
on mergeAllWindows()
script-editor.applescript
end mergeAllWindows
script-editor.applescript
tell application "Script Editor" to set theWindow of ScriptEditorInstance to window id windowId
script-editor.applescript
ScriptEditorInstance
script-editor.applescript
set logger to std's import("logger")'s new("script-editor")
script-editor.applescript
if (count of argv) = 0 then
revealHiddenExtensions.applescript
set theFolder to choose folder
revealHiddenExtensions.applescript
else if (count of argv) = 1 then
revealHiddenExtensions.applescript
set theFolder to convertPathToAlias(item 1 of argv)
revealHiddenExtensions.applescript
else if (count of argv) > 1 then
revealHiddenExtensions.applescript
return "too many inputs. maybe put your argument in quotes."
revealHiddenExtensions.applescript
setHiddenExtensions(theFolder, false)
revealHiddenExtensions.applescript
on setHiddenExtensions(theFolder, booleanValue)
revealHiddenExtensions.applescript
set theFiles to items of theFolder
revealHiddenExtensions.applescript
set fileCount to count of theFiles
revealHiddenExtensions.applescript
repeat with x from 1 to fileCount
revealHiddenExtensions.applescript
set theFile to (item x of theFiles)
revealHiddenExtensions.applescript
if name of theFile contains "." then
revealHiddenExtensions.applescript
set extension hidden of theFile to booleanValue
revealHiddenExtensions.applescript
end setHiddenExtensions
revealHiddenExtensions.applescript
on convertPathToAlias(thePath)
revealHiddenExtensions.applescript
return (path of disk item (thePath as string)) as alias
revealHiddenExtensions.applescript
return (path of disk item (path of thePath) as string) as alias
revealHiddenExtensions.applescript
end convertPathToAlias
revealHiddenExtensions.applescript
use framework "SoundAnalysis"
ClassifySoundFile.scpt
set confidenceThreshold to 0.6 -- Level of confidence necessary for classification to appear in result
ClassifySoundFile.scpt
set theResult to "" -- Sequence of sound classification labels throughout the sound file's duration
ClassifySoundFile.scpt
on analyzeSound(filePath)
ClassifySoundFile.scpt
set theURL to current application's NSURL's fileURLWithPath:filePath
ClassifySoundFile.scpt
set theAnalyzer to current application's SNAudioFileAnalyzer's alloc()'s initWithURL:theURL |error|:(missing value)
ClassifySoundFile.scpt
set theRequest to current application's SNClassifySoundRequest's alloc()'s initWithClassifierIdentifier:(current application's SNClassifierIdentifierVersion1) |error|:(missing value)
ClassifySoundFile.scpt
theAnalyzer's addRequest:(theRequest) withObserver:(me) |error|:(missing value)
ClassifySoundFile.scpt
theAnalyzer's analyze()
ClassifySoundFile.scpt
repeat while theResult is ""
ClassifySoundFile.scpt
end analyzeSound
ClassifySoundFile.scpt
on request:request didProduceResult:|result|
ClassifySoundFile.scpt
global confidenceThreshold
ClassifySoundFile.scpt
repeat with classification in |result|'s classifications()
ClassifySoundFile.scpt
if classification's confidence() > confidenceThreshold then
ClassifySoundFile.scpt
set theResult to theResult & (classification's identifier() as text) & " "
ClassifySoundFile.scpt
end request:didProduceResult:
ClassifySoundFile.scpt
on request:request didFailWithError:|error|
ClassifySoundFile.scpt
set theResult to " "
ClassifySoundFile.scpt
end request:didFailWithError:
ClassifySoundFile.scpt
on requestDidComplete:request
ClassifySoundFile.scpt
end requestDidComplete:
ClassifySoundFile.scpt
return analyzeSound("/Users/exampleUser/Documents/sound.wav")
ClassifySoundFile.scpt
fmGUI_ModeEnsure_Find()
fmGUI_ModeEnsure_Find.applescript
on fmGUI_ModeEnsure_Find()
fmGUI_ModeEnsure_Find.applescript
fmGUI_ModeSelect("Find")
fmGUI_ModeEnsure_Find.applescript
end fmGUI_ModeEnsure_Find
fmGUI_ModeEnsure_Find.applescript
set userDefaultSearchString to ""
ArmDisarm through dialog.applescript
global dialogTitle
ArmDisarm through dialog.applescript
set dialogTitle to "Batch Arm/Disarm"
ArmDisarm through dialog.applescript
set {theText, theButton} to {text returned, button returned} of (display dialog "Arm/disarm cues whose name contains (return an empty string to cancel):" with title dialogTitle with icon 1 default answer userDefaultSearchString buttons {"Toggle", "Arm", "Disarm"} default button "Disarm")
ArmDisarm through dialog.applescript
if theText is "" then
ArmDisarm through dialog.applescript
set foundCues to every cue whose q name contains theText
ArmDisarm through dialog.applescript
repeat with eachCue in reverse of foundCues
ArmDisarm through dialog.applescript
if theButton is "Arm" then
ArmDisarm through dialog.applescript
else if theButton is "Disarm" then
ArmDisarm through dialog.applescript
set thePath to POSIX path of theAlias
Copy File Paths.applescript
on getProcessName(appPath)
appctrl.applescript
set filename to text item -1 of appPath
appctrl.applescript
set processName to text item -2 of filename
appctrl.applescript
log "processName:" & processName
appctrl.applescript
return processName
appctrl.applescript
end getProcessName
appctrl.applescript
on getappPath()
appctrl.applescript
set appPath to (system attribute "APP_HOME")
appctrl.applescript
if appPath is equal to ""
appctrl.applescript
set appPath to POSIX path of (choose file with prompt "----------Please choose YourAppName.app-------------" of type {"app"})
appctrl.applescript
log "appPath: " & appPath
appctrl.applescript
return appPath
appctrl.applescript
end getappPath
appctrl.applescript
on dostart(appPath)
appctrl.applescript
set addArgs to (system attribute "APP_ARGS")
appctrl.applescript
log "args: " & addArgs
appctrl.applescript
do shell script "open -n -a '" & appPath & "' --args " & addArgs
appctrl.applescript
set {0, 0, dtw, dth} to bounds of window of desktop
appctrl.applescript
if application "Terminal" is running then
appctrl.applescript
click (button 1 where subrole is "AXMinimizeButton") of window "YourAppName"
appctrl.applescript
if (window "Video Window" exists) and (windows "View host's screen sharing" exists) then
appctrl.applescript
set position of windows "Video Window" to {0, 0}
appctrl.applescript
set size of windows "Video Window" to {dtw/2, dth}
appctrl.applescript
set position of windows "View host's screen sharing" to {dtw/2, 0}
appctrl.applescript
set size of windows "View host's screen sharing" to {dtw/2, dth}
appctrl.applescript
else if (window "Video Window" exists) then
appctrl.applescript
set size of windows "Video Window" to {dtw, dth}
appctrl.applescript
else if (windows "View host's screen sharing" exists) then
appctrl.applescript
set position of windows "View host's screen sharing" to {0, 0}
appctrl.applescript
set size of windows "View host's screen sharing" to {dtw, dth}
appctrl.applescript
end dostart
appctrl.applescript
on dostop(appPath)
appctrl.applescript