首页 > 其他分享 >mac scripts

mac scripts

时间:2023-04-06 18:45:26浏览次数:31  
标签:bin SystemUIServer osascript down mac scripts tell bash

#!/bin/bash
osascript <<EOD
tell application "Finder"
   if (get count of windows) ≥ 2 then
      close (get every window whose index is not 1)
   end if
end tell
#!/bin/bash
osascript <<EOD
tell application "System Events" to keystroke "q" using {control down, command down}
#!/bin/bash
osascript <<EOD
tell application "Finder"
     if (get count of windows) ≥ 3 then
         activate
         set visible to true
         activate
     else
         make new Finder window to home
         activate
         set visible to true
         activate
     end if
end tell
#!/bin/bash
osascript <<EOD
tell application "iTerm"
     activate
     if (get count of windows) ≥ 1 then
         activate
            set visible to true
         activate
     else
         create window with default profile
         activate
         set visible to true
         activate
     end if
end tell
activate application "SystemUIServer"
tell application "System Events"
    tell process "SystemUIServer" to keystroke "q" using {command down, control down}
end tell


#!/bin/bash
osascript <<EOD
tell application "Visual Studio Code"
    set theWindows to windows

    repeat with aWindow in theWindows
        if (name of aWindow) contains "myTerminalWindow" then
            display dialog ("Will not close " & name of aWindow)
        else
            set theProcesses to processes of aWindow
            set clean commands of current settings of aWindow to theProcesses
            close aWindow without saving
        end if
    end repeat

end tell

标签:bin,SystemUIServer,osascript,down,mac,scripts,tell,bash
From: https://www.cnblogs.com/Searchor/p/17293765.html

相关文章

  • 去除mac系统更新角标
     macOS在关闭系统更新的情况下仍然会检测更新,并且出现烦人的角标。在不想更新的情况下,角标还不能轻易去除。和iPhone如出一辙,我只想说不愧是苹果。出于养老需求,不想对系统进行大版本的更新,当前系统停留在Monterey12.6.4。下文记录在不屏蔽更新检测的情况下,清除系统更新的标记......
  • macOS 13 Ventura (苹果最新系统)v13.3正式版
    Apple今日发布了macOS的下一个版本,称为macOSVentura,它具有多项新功能,包括StageManager、ContinuityCamera、新的安全更新等。macOS13Ventura正式版下载 macOS13安装教程下载完成后打开,双击.pkg安装包运行即可兼容电脑完整的兼容性列表如下:iMac(2017年及更高......
  • Mac应用程序无法打开提示不明开发者或文件损坏的处理方法
     在安装Mac电脑应用程序的时候,经常会遇到“xxx.app已损坏,打不开。您应该将它移到废纸篓“或”打不开的xxx.app,因为它来自身份不明的开发者”,如图:   遇到上述情况是不是真的要移动到废纸篓呢?下面小编就为您带来Mac应用程序无法打开提示不明开发者或文件损坏的处理方法,解......
  • 通过 Homebrew 在 Mac OS X 上安装和配置 Redis
    通过使用Homebrew,可以大大降低在MacOSX上设置和配置开发环境的成本。让我们安装Redis。$brewinstallredis安装后,我们将看到一些有关配置注意事项的通知。离开它并继续关注本文中的一些任务。开机自启动Redis$ln-sfv/usr/local/Cellar/redis/7.0.10/*.plist......
  • Mac | HomeBrew 安装 & 配置 MySQL
    这个是我最新并且一直推崇的方法:1、安装:brewinstallmysql2、开启mysql:mysql.serverstart3、使用mysql的配置脚本:/usr/local/opt/mysql/bin/mysql_secure_installation//mysql提供的配置向导启动这个脚本后,即可根据如下命令提示进行初始化设置14:14:49withkoshkaaaain......
  • glib gmacros.h
    /*GLIB-LibraryofusefulroutinesforCprogramming*Copyright(C)1995-1997PeterMattis,SpencerKimballandJoshMacDonald**Thislibraryisfreesoftware;youcanredistributeitand/or*modifyitunderthetermsoftheGNULesserGeneral......
  • Blender网格建模插件MESHmachine倒角和圆角:扁平 化
    推荐:将NSDT场景编辑器加入你的3D工具链编辑模式ye使用拼合工具,您可以拼合单个或多个多边形,并且可以在2种模式下展平:沿边或沿法线。选择展平可以采取2种选择。您可以选择 3个折点或多个多边形,其中一个处于活动状态。如果选择3个顶点,则连接多边形的所有顶点都将根据3个顶点......
  • C#各种语言HMAC SHA256实现
    语言包含:Javascript,PHP,Java,Groovy,C#,ObjectiveC,Go,Ruby,Python,Perl,Dart,Swift,Rust,Powershell。JavascriptHMACSHA256Runthecodeonlinewiththisjsfiddle.Dependentuponanopensourcejslibrarycalledhttp://code.google.com/p/crypto-js/.<sc......
  • FATE Machine Learning
    OFFICE280FATEMachineLearningCRISTIáNBRAVOOFFICE280Thisweek…FairnessDefinitionofFairnessConfoundingTransparencyandExplainabilityShapleyValuesLecturewillcover…FairMLBook,Chapters1,2and3.https://fairmlbook.org/pdf/fairmlbook.pdfShap......
  • mac-vlan配置步骤分析
    第一步:系统视图下交换机1:sysnamesw1交换机2:sysnamesw2第二步:创建vlan(sw1、sw2命令相同)vlan2 vlan3第三步:创建dhcpdhcpenable//启用dhcpippoolvlanif2gateway-list10.1.1.1network10.1.1.0mask255.255.255.0leaseday3hour0minute0dns-list8.8.8.8第四步:......