-
-
Save littlebusters/e880bb92d7f45d7c9c63 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
var openDialog = NSOpenPanel.openPanel(); | |
openDialog.setCanChooseFiles(true); | |
openDialog.setCanChooseDirectories(false); | |
openDialog.setAllowsMultipleSelection(false); | |
openDialog.setCanCreateDirectories(false); | |
openDialog.setTitle('Choose File'); | |
if( openDialog.runModal() == NSOKButton ) { | |
var fileURL = openDialog.URLs().firstObject(); | |
} else { | |
return false; | |
} | |
var regexp = new RegExp( 'file://', 'ig' ); | |
var fileURL = fileURL.replace( regexp, '' ); | |
var option = 'mogrify "' + fileURL + '" -background white -alpha remove'; | |
var task = NSTask.new(); | |
task.setLaunchPath( '/bin/bash' ); | |
task.setArguments(['-c', option]); | |
task.launch(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment