Created
January 31, 2017 13:57
-
-
Save andriitishchenko/f3c36e72985b6ca53114c3a3d28fa1ef to your computer and use it in GitHub Desktop.
AppleScript for running opendiff tool with selected files in Finder
This file contains hidden or 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
on run {input, parameters} | |
set selected_items to {} | |
tell application "Finder" | |
set selected_items to selection as alias list | |
if (count of selected_items) is not 2 then return | |
set file1 to POSIX path of (item 1 of selected_items) | |
set file2 to POSIX path of (item 2 of selected_items) | |
end tell | |
try | |
tell application "System Events" | |
click UI element "FileMerge" of list 1 of application process "Dock" | |
end tell | |
end try | |
tell application "FileMerge" to activate | |
tell application "System Events" | |
tell process "FileMerge" | |
set frontmost to true | |
click menu item 1 of menu 1 of menu bar item "File" of menu bar 1 | |
set value of attribute "AXFocused" of text field 1 of front window to true | |
set value of text field 1 of window "Compare Files" to text item 1 of file1 | |
set value of attribute "AXFocused" of text field 2 of front window to true | |
set value of text field 2 of window "Compare Files" to text item 1 of file2 | |
click UI element "Compare" of window "Compare Files" | |
end tell | |
end tell | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment