Created
October 16, 2017 05:49
-
-
Save 0xch4z/044d15ed4466a88150c9ba7d65affb05 to your computer and use it in GitHub Desktop.
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
| // | |
| // main.swift | |
| // Open Applications | |
| // | |
| // Created by Charles Kenney on 10/16/17. | |
| // Copyright © 2017 Charles Kenney. All rights reserved. | |
| // | |
| import Foundation | |
| import Cocoa | |
| func openApp(named name: String) -> Bool { | |
| return NSWorkspace.shared.launchApplication(name) | |
| } | |
| func main() { | |
| while true { | |
| print("\n") | |
| print("enter an application to open: ", terminator: "") | |
| let appName = readLine()! | |
| let result = openApp(named: appName) | |
| print("\(result ? "Successfully launched app:" : "Failed to launch app:") \(appName)") | |
| } | |
| } | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment