-
-
Save oblitum/16a63468535ef1f1f6a7965d77e93b56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Google Chrome" | |
repeat with windowId from 1 to counts windows | |
if title of window windowId contains "[email protected] - Gmail" then | |
activate window windowId | |
end if | |
end repeat | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
set theProcesses to application processes | |
repeat with theProcess from 1 to count theProcesses | |
set theName to (name of process theProcess) | |
if theName contains "Chrom" then | |
tell process theProcess | |
try | |
repeat with x from 1 to (count windows) | |
if name of window x contains "[email protected] - Gmail" then | |
click menu item (name of window x) of menu of menu bar item "Window" of menu bar 1 | |
end if | |
end repeat | |
end try | |
end tell | |
end if | |
end repeat | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
set theProcesses to application processes | |
repeat with theProcess from 1 to count theProcesses | |
set theName to (name of process theProcess) | |
if theName contains "Chrom" then | |
tell process theProcess | |
try | |
repeat with x from 1 to (count windows) | |
if name of window x contains "[email protected] - Gmail" then | |
click menu item (name of window x) of menu of menu bar item "Window" of menu bar 1 | |
if theName contains "Chromium" then | |
log "found you! Cromium" | |
tell application "Chromium" to activate | |
else | |
log "found you! Chrome" | |
tell application "Google Chrome" to activate | |
end if | |
tell me to quit | |
end if | |
end repeat | |
end try | |
end tell | |
end if | |
end repeat | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property NSWorkspace : class "NSWorkspace" | |
set workspace to NSWorkspace's sharedWorkspace() | |
tell application "System Events" | |
set theProcesses to application processes | |
repeat with theProcess from 1 to count theProcesses | |
set theName to (name of process theProcess) | |
if theName contains "Chrom" then | |
tell process theProcess | |
try | |
repeat with x from 1 to (count windows) | |
if name of window x contains "[email protected] - Gmail" then | |
click menu item (name of window x) of menu of menu bar item "Window" of menu bar 1 | |
if theName contains "Chromium" then | |
log "found you! Cromium" | |
workspace's launchApplication_("Chromium") | |
else | |
log "found you! Chrome" | |
workspace's launchApplication_("Google Chrome") | |
end if | |
tell me to quit | |
end if | |
end repeat | |
end try | |
end tell | |
end if | |
end repeat | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property NSWorkspace : class "NSWorkspace" | |
on raiseWindow() | |
set workspace to NSWorkspace's sharedWorkspace() | |
tell application "System Events" | |
set theProcesses to application processes | |
repeat with theProcess from 1 to count theProcesses | |
set theName to (name of process theProcess) | |
if theName contains "Chrom" or theName contains "Safari" then | |
tell process theProcess | |
try | |
repeat with x from 1 to (count windows) | |
if name of window x contains "[email protected] - Gmail" then | |
try | |
click menu item (name of window x) of menu of menu bar item "Window" of menu bar 1 | |
end try | |
workspace's launchApplication:theName | |
return 0 | |
end if | |
end repeat | |
end try | |
end tell | |
end if | |
end repeat | |
end tell | |
end raiseWindow | |
raiseWindow() | |
tell me to quit |
@vinipsmaker interessante, mas provavelmente nem chegaria a avaliar pro caso de uma tarefa simples ou outra, iria de applescript msm (apesar de não relar em mac há anos).
apesar de não relar em mac há anos
🤔... entendi
btw, ainda estou lhe devendo algum bom álcool pela indicação da ferramenta hugo. Algum ano precisamos ver isso ainda.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@oblitum
pepper_chico
, dá uma olhada nisso: http://www.hammerspoon.org/O que tu acha?