Skip to content

Instantly share code, notes, and snippets.

@griotspeak
Created November 3, 2014 16:04
Show Gist options
  • Save griotspeak/61f50e6466c5f0434676 to your computer and use it in GitHub Desktop.
Save griotspeak/61f50e6466c5f0434676 to your computer and use it in GitHub Desktop.
Applescript to switch to first open tab ending with ".swift"
set current_document_path to ""
tell application "Xcode"
set last_word_in_main_window to ".swift"
if (last_word_in_main_window is "Edited") then
display notification "Please save the current document and try again"
-- eventually we could automatically save the document when this becomes annoying
else
set current_document to document 1 whose name ends with last_word_in_main_window
set current_document_path to path of current_document
end if
end tell
if (current_document_path is not "") then
tell application "Xcode"
open current_document_path
end tell
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment