mac scripts

#!/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

tell application "System Events" to tell process "Finder"
    activate
    delay 0.4
    tell menu bar item "Window" of menu bar 1
        click

        click menu item "Bring All to Front" of menu 1
    end tell
end tell

display notification "HK" with title "Action performed" subtitle "Show Finder." sound name "Purr"
#!/bin/bash
osascript <<EOD

tell application "System Events" to tell process "iTerm2"
    activate
    delay 0.4
    tell menu bar item "Window" of menu bar 1
        click
        click menu item "Bring All To Front" of menu 1
    end tell
end tell

display notification "HK" with title "Action performed" subtitle "Show iTerm." sound name "Morse"
#!/bin/bash
osascript <<EOD

tell application "System Events" to tell process "Code"
    activate
    delay 0.4
    tell menu bar item "Window" of menu bar 1
        click
        click menu item "Bring All to Front" of menu 1
    end tell
end tell

display notification "HK" with title "Action performed" subtitle "Show vs Code." sound name "Blow"
tell application "System Events" to tell process "Code"
	tell window 1
		set size to {1024, 768}
		set position to {100, 100}
	end tell
end tell

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
posted @ 2023-04-06 18:32  fndefbwefsowpvqfx  阅读(12)  评论(0编辑  收藏  举报