The Computer Oracle

AppleScript: Open a new window in current space without switching to active window in another space

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Book End

--

Chapters
00:00 Applescript: Open A New Window In Current Space Without Switching To Active Window In Another Space
00:40 Accepted Answer Score 29
01:10 Thank you

--

Full question
https://superuser.com/questions/550312/a...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #mac #osxmountainlion #window #applescript

#avk47



ACCEPTED ANSWER

Score 29


Some applications have an action for opening a new window in their Dock context menu.

Other options for different applications:

tell application "TextEdit"
    make new document
    activate
end tell

tell application "Safari"
    make new document at end of documents with properties {URL:"http://g.co"}
    activate
end tell

tell application "Terminal"
    do script ""
    activate
end tell

tell application "System Events" to tell process "iTerm"
    click menu item "New Window" of menu "Shell" of menu bar 1
    set frontmost to true
end tell

tell application "Google Chrome"
    make new window
    activate
end tell