Skip to content

Instantly share code, notes, and snippets.

-- Important Note: This script will delete all files in the target folder including CloudRecordings.db, CloudRecordings.db-wal and CloudRecordings.db-shm. I assume those 3 files are about iCloud so if you use iCloud for Voice Memos, don't use this script. If you don't use iCloud for Voice Memos, what you should do is create multiple recordings for testing this script then test it. In the future, something may change this script might not work. You should prepare for that.
if application "VoiceMemos" is running then
tell application "VoiceMemos" to quit
end if
set info to system info
set userName to short user name of info
set upath to "/Users/" & userName & "/Library/Group Containers/group.com.apple.VoiceMemos.shared/Recordings"
set tar_path to quoted form of POSIX path of upath
@OKsign
OKsign / Script 60.txt
Last active August 18, 2024 10:28
Close all windows of Finder but the active one on macOS
-- Stage Manager must be turned off
tell application "System Events"
tell application "Finder"
activate
delay 0.5
set activewinname to get name of front window
set winc to count of windows
end tell
end tell
-- user options
set KillWindows_User to {"app1", "app2"}
set KillWindows_with_window to {"BCompare", "gimp", "soffice", "sublime_text"}
set output_volume_before_shutdown_and_restart to "off" -- "on" or "off"
set output_volume to 0 -- you can set from 0 - 100
-- end of user options
-- option 'KillWindows_User' is desinged for killing apps that sit in the menubar. If the name of app is not correct (case sensitive), that app won't be killed. To check a name of menubar app, use this code -- tell application "System Events" to set frontapps to get the name of every process whose background only is true -- copy from 'tell' to 'true' then paste in Script Editor, click menu 'Script', click 'Run', check the name in tab 'Result' at the bottom.
-- option 'KillWindows_with_window' is for the situation when script is interrupted by dialog "Choose Application" with message "Where is (app name)?", put the app name in the list "KillWindows_with_window"
-----------------------------------------------
set input_list_choose to
-- user options
set KillWindows_User to {"app1", "app2"}
set KillWindows_with_window to {"BCompare", "gimp", "soffice", "sublime_text"}
set output_volume_before_shutdown_and_restart to "off" -- "on" or "off"
set output_volume to 0 -- you can set from 0 - 100
-- end of user options
-- option 'KillWindows_User' is desinged for killing apps that sit in the menubar. If the name of app is not correct (case sensitive), that app won't be killed. To check a name of menubar app, use this code -- tell application "System Events" to set frontapps to get the name of every process whose background only is true -- copy from 'tell' to 'true' then paste in Script Editor, click menu 'Script', click 'Run', check the name in tab 'Result' at the bottom.
-- option 'KillWindows_with_window' is for the situation when script is interrupted by dialog "Choose Application" with message "Where is (app name)?", put the app name in the list "KillWindows_with_window"
-----------------------------------------------
set input_list_choose to
tell application "System Events"
key code 8 using command down
end tell
delay 1
set the clipboard to (get the clipboard as text)
#MaxHotkeysPerInterval 200
#IfWinActive, ahk_exe WINWORD.EXE
*Wheeldown::
*Wheelup::
*Wheelleft::
*Wheelright::
return
;The Combination of 3 scripts (links below) and a small change by me in order to work with apps on Windows 11.
;https://superuser.com/questions/13763/horizontal-scrolling-shortcut-in-windows/596097#596097
;https://superuser.com/questions/13763/horizontal-scrolling-shortcut-in-windows/1633691#1633691
;https://superuser.com/questions/13763/horizontal-scrolling-shortcut-in-windows/825291#825291
; Scroll speed parameter
ScrollSpeed=4
{ "title": "Rules for Karabiner-Elements | Scroll horizontally - Hold Button 4",
"rules": [
{ "description": "Rules for Karabiner-Elements | Scroll horizontally - Hold Button 4",
"manipulators":
[
{
"type": "basic",
"from": {
{ "title": "Mouse Chording - Karabiner-Elements Rule",
"rules": [
{
"description": "Mouse Chording - Karabiner-Elements Rule",
"manipulators": [
{
"type": "basic",
"conditions": [{ "type": "frontmost_application_if",
"bundle_identifiers": [
tell application "Flux" to launch
delay 2
tell application "System Events"
set inviApps to (get name of every application process whose visible is false)
end tell
repeat until "Flux" is in inviApps
delay 1
tell application "System Events"
set inviApps to (get name of every application process whose visible is false)
end tell