text
stringlengths
0
15.7k
source
stringlengths
6
112
do shell script "cd " & TempDirPath & ";rm -f " & ItemName & ".zip && curl -o " & ItemName & ".zip " & RepositoryURL & ItemName & "/download/" & ItemName & "-" & OnlineVersion & ".zip"
sm4.scpt
do shell script "head -n1 " & TempDirPath & ItemName & ".zip"
sm4.scpt
if items 1 thru 2 of result as string is "PK" then
sm4.scpt
do shell script "cd " & TempDirPath & " && unzip " & ItemName & ".zip && rm " & ItemName & ".zip && rm -Rf __MACOSX"
sm4.scpt
do shell script "cd " & QExternalScriptsPath & "; mv -f " & TempDirPath & ItemName & ".scpt ./"
sm4.scpt
if CurrentAction is "updated" then
sm4.scpt
set Report to Report & Echo & " ✓ " & ItemName & " was updated successfully from " & InstalledVersion & " to " & OnlineVersion & "." & NewLine
sm4.scpt
else if CurrentAction is "installed" then
sm4.scpt
set Report to Report & Echo & " ✓ " & ItemName & " was installed successfully. (Version: " & OnlineVersion & ")" & NewLine
sm4.scpt
set ScriptsInstalled to ScriptsInstalled + 1
sm4.scpt
do shell script "cd " & TempDirPath & "; rm -rf " & ItemName & ".zip"
sm4.scpt
set Report to Report & Echo & " ✕ " & ItemName & " not installed (doesn't exist)" & NewLine
sm4.scpt
else if OnlineVersion = InstalledVersion then
sm4.scpt
set Report to Report & Echo & " - There is not any update available for " & ItemName & "." & NewLine
sm4.scpt
else if OnlineVersion < InstalledVersion then
sm4.scpt
set Report to Report & Echo & " - The installed version of " & ItemName & " (" & InstalledVersion & ") is newer than the online version. (" & OnlineVersion & ")" & NewLine
sm4.scpt
if cmd contains "remove" then
sm4.scpt
set AllInstalledScripts to the paragraphs of (do shell script "ls " & QExternalScriptsPath & "*.scpt")
sm4.scpt
set InstalledScripts to {}
sm4.scpt
repeat with i from 1 to the count of AllInstalledScripts
sm4.scpt
set currentItem to get item i of AllInstalledScripts as string
sm4.scpt
if currentItem contains "/sd.scpt" then
sm4.scpt
set the InstalledScripts's end to the AllInstalledScripts's item i
sm4.scpt
repeat with i from 1 to the count of InstalledScripts
sm4.scpt
set currentItem to get item i of InstalledScripts as string -- REPETICAO SE FOREM MUITOS
sm4.scpt
do shell script "rm '" & currentItem & "'"
sm4.scpt
set ScriptsRemoved to ScriptsRemoved + 1
sm4.scpt
set Report to Report & Echo & " ✓ The Script " & currentItem & " was removed sucessfully." & NewLine
sm4.scpt
set Report to Report & Echo & " ✕ The Script " & currentItem & " was not removed because of an error." & NewLine
sm4.scpt
else if ChosenScript is "sm" then
sm4.scpt
return "/echo No no no no.. there's no removing SM from itself. No trolling! Leave that for Parth!"
sm4.scpt
set CurrentItemPath to ExternalScriptsPath & ChosenScript & ".scpt"
sm4.scpt
set IsScriptInstalled to FileExists(CurrentItemPath)
sm4.scpt
if IsScriptInstalled is false then
sm4.scpt
set Report to Report & Echo & " ✕ The script " & ChosenScript & " was not removed because it's not installed." & NewLine
sm4.scpt
return Report
sm4.scpt
do shell script "rm '" & ExternalScriptsPath & ChosenScript & ".scpt'"
sm4.scpt
set Report to Report & Echo & " ✓ The script " & ChosenScript & " was removed sucessfully." & NewLine
sm4.scpt
set Report to Report & Echo & " ✕ The script " & ChosenScript & " was not removed because of an error." & NewLine
sm4.scpt
set NrOfScripts to 0
sm4.scpt
set actiondone to ""
sm4.scpt
set actiondone to " installed"
sm4.scpt
if ScriptsInstalled is greater than 1 or ScriptsInstalled is 0 then
sm4.scpt
set NrOfScripts to ScriptsInstalled
sm4.scpt
else if cmd contains "remove" then
sm4.scpt
set actiondone to " removed"
sm4.scpt
if ScriptsRemoved is greater than 1 or ScriptsRemoved is 0 then
sm4.scpt
set NrOfScripts to ScriptsRemoved
sm4.scpt
if actiondone is "" then
sm4.scpt
set Report to "/echo Error: Please provide a valid command… (about, help, install, remove, list)"
sm4.scpt
set Report to Report & Echo & "➤ " & NrOfScripts & " script" & plural & actiondone & " successfully." & NewLine
sm4.scpt
on growlnotify(title, desc)
growlnotify.applescript
do shell script "/usr/local/bin/growlnotify -n 'Time Out Free' -a 'Time Out Free' -t '" & title & "' -m '" & desc & "'"
growlnotify.applescript
do shell script "/usr/local/bin/growlnotify -n 'Time Out Free' -a 'Time Out Free' -t '" & title & "'"
growlnotify.applescript
physical memory of (get system info)
physical memory of (get system info).applescript
set s to selection as list
Tracks with no lyrics.applescript
set n to {}
Tracks with no lyrics.applescript
repeat with f in s
Tracks with no lyrics.applescript
if lyrics of f is "" then set n to n & {location of f}
Tracks with no lyrics.applescript
if n is {} then return n
Tracks with no lyrics.applescript
set p to make new playlist
Tracks with no lyrics.applescript
set name of p to "NO LYRICS"
Tracks with no lyrics.applescript
add n to p
Tracks with no lyrics.applescript
keystroke "PROJECT-"
f6.applescript
do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -suspend"
lockSession.scpt
global destinationLanguage, pythonInterpreterPath, voiceOverOutput, retriesForError
VoiceOverTranslator.applescript
set destinationLanguage to "es"
VoiceOverTranslator.applescript
set pythonInterpreterPath to "/usr/local/bin/python3"
VoiceOverTranslator.applescript
set voiceOverOutput to true
VoiceOverTranslator.applescript
set retriesForError to 5
VoiceOverTranslator.applescript
do shell script "afplay /System/Library/Sounds/Morse.aiff"
VoiceOverTranslator.applescript
setup()
VoiceOverTranslator.applescript
set sourceText to getSourceText()
VoiceOverTranslator.applescript
set translationFound to false
VoiceOverTranslator.applescript
set retries to 0
VoiceOverTranslator.applescript
repeat while translationFound = false
VoiceOverTranslator.applescript
set translation to getTranslatedText(sourceText, destinationLanguage, pythonInterpreterPath)
VoiceOverTranslator.applescript
if translation = "%error%" then
VoiceOverTranslator.applescript
delay (2)
VoiceOverTranslator.applescript
set translationFound to true
VoiceOverTranslator.applescript
set retries to retries + 1
VoiceOverTranslator.applescript
if retries ≥ retriesForError then
VoiceOverTranslator.applescript
do shell script "afplay /System/Library/Sounds/Basso.aiff"
VoiceOverTranslator.applescript
set translation to "Se produjo un error accediendo al servicio de traducción."
VoiceOverTranslator.applescript
sayWithVoiceOver(translation)
VoiceOverTranslator.applescript
on sayWithVoiceOver(textToSay)
VoiceOverTranslator.applescript
if voiceOverOutput then
VoiceOverTranslator.applescript
output textToSay
VoiceOverTranslator.applescript
say textToSay
VoiceOverTranslator.applescript
end sayWithVoiceOver
VoiceOverTranslator.applescript
on getSpokenTextByVoiceOver()
VoiceOverTranslator.applescript
set textLine to ""
VoiceOverTranslator.applescript
set textLine to content of last phrase
VoiceOverTranslator.applescript
return textLine
VoiceOverTranslator.applescript
end getSpokenTextByVoiceOver
VoiceOverTranslator.applescript
on getTranslatedText(textToTranslate, destinationLanguage, pythonPath)
VoiceOverTranslator.applescript
set code to "from googletrans import Translator; translator = Translator();print(translator.translate('" & textToTranslate & "',dest='" & destinationLanguage & "').text)"
VoiceOverTranslator.applescript
set translationResult to do shell script pythonPath & " -c \"" & code & "\""
VoiceOverTranslator.applescript
do shell script "afplay /System/Library/Sounds/Pop.aiff"
VoiceOverTranslator.applescript
return translationResult
VoiceOverTranslator.applescript