Skip to content

Commit

Permalink
Updated version of Open in Favorite Editor now includes support for "…
Browse files Browse the repository at this point in the history
…video" file types.

Default is MPEG Streamclip.
  • Loading branch information
Andreas Zeitler committed Jun 13, 2013
1 parent acf5217 commit 7f10993
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Open in Favorite Editor.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
-- It takes the whole selection and considers their extensions for opening in an
-- editor.
--
-- Version: 1.3
-- Version: 1.5
-- 1.0: Initial release
-- 1.1: Multiple file type support
-- 1.2: Added suggestions for improvements
-- 1.3: Documentation
-- 1.4: Fix for permission error in Acorn
-- 1.5: Added video extensions (MPEG Streamclip)
--

set fileList to {}
Expand All @@ -41,6 +42,11 @@ set textTypes to {"txt", "md"}
set textFileList to {}
set favTextEditor to "MacVim"

-- video
set videoTypes to {"mp4", "mov", "m4v"}
set videoFileList to {}
set favVideoEditor to "MPEG Streamclip"

-- get all selected Finder items and put them on a list of POSIX paths
tell application "Finder"
repeat with i in (selection as list)
Expand Down Expand Up @@ -70,19 +76,32 @@ repeat with currentFile in fileList
end if
end repeat

repeat with videoType in videoTypes
if currentFile contains videoType then
set the end of videoFileList to currentFile
end if
end repeat

end ignoring
end repeat

-- open in favorite editor
repeat with currentFile in imageFileList
tell application favImageEditor to open (currentFile as POSIX file)
tell application favImageEditor to activate
end repeat

repeat with currentFile in textFileList
tell application favTextEditor to open (currentFile as POSIX file)
-- you might want to put an additional "tell application "foo" to open currentFile" line
-- here in case you want to open, e.g. open a Markdown file in an editor
-- here in case you want to open, e.g. a Markdown file, in an editor
-- *and* a live preview app (like Marked).
tell application favTextEditor to activate
end repeat

repeat with currentFile in videoFileList
tell application favVideoEditor to open (currentFile as POSIX file)
tell application favVideoEditor to activate
end repeat


Expand Down

0 comments on commit 7f10993

Please sign in to comment.