Executing Swift Script

General discussions about LaunchBar
skonesam
Posts: 1
Joined: Tue Nov 29, 2016 5:26 pm

Executing Swift Script

Postby skonesam » Tue Nov 29, 2016 5:30 pm

Have a pretty simple Swift 3 script I'd like to execute from LaunchBar, but it treats it as any other file. Option-return simply opens it in Xcode.

I have the shebang, script is executable, and runs normally from terminal. Workaround for the moment is an applescript with one line:

Code: Select all

do shell script "/path/to/script/SearchKickoff.swift"


Any ideas on what I might be missing?

DocterD
Posts: 3
Joined: Sat Jun 21, 2014 11:01 am

Re: Executing Swift Script

Postby DocterD » Mon Dec 26, 2016 4:31 pm

Swift is no scripting language.

m267
Posts: 16
Joined: Fri Mar 14, 2014 4:57 pm
Location: DE or CH

Re: Executing Swift Script

Postby m267 » Sun Jan 01, 2017 4:35 pm

skonesam wrote:Have a pretty simple Swift 3 script I'd like to execute from LaunchBar, but it treats it as any other file. Option-return simply opens it in Xcode.

Any ideas on what I might be missing?


I’m seeing the same behavior. However, when I change the script extension from .swift to .command it gets executed.

(BTW, the same happens with Bash scripts: I have to change .sh to .command. Right now I’m not sure if this was always the case?)

DocterD wrote:Swift is no scripting language.


Of course you can use Swift as interpreted scripting language. Just make sure you have the correct shebang, for example #!/usr/bin/env swift


Return to “LaunchBar General”

Who is online

Users browsing this forum: No registered users and 3 guests