public
Last active

  • Download Gist
gistfile1.scpt
AppleScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
set text item delimiters to " "
set scriptName to text item 1 of parameter
set paramCount to count parameter's text items
try
set scriptParameters to text items 2 thru paramCount of parameter
on error
set scriptParameters to ""
end try
set text item delimiters to ""
if scriptName contains "/" then
set pathName to ""
else
set a to path to application support from user domain
set p to POSIX path of a
set pathName to p & "Linkinus 2/Scripts/External/"
end if
try
if scriptName ends with ".rb" then
set scriptType to "ruby "
else if scriptName ends with ".php" then
set scriptType to "php -f "
else if scriptName ends with ".py" then
set scriptType to "python "
else if scriptName ends with ".pl" then
set scriptType to "perl "
else if scriptName ends with ".sh" then
set scriptType to "bash "
end if
set text item delimiters to " "
set output to do shell script "/usr/bin/env " & scriptType & quoted form of (pathName & scriptName) & " " & scriptParameters
set text item delimiters to ""
return output
on error
return "The script you entered does not exist or was typed incorrectly. If you are trying to use a script not in ~/Library/Application Support/Linkinus 2/Scripts/External/ then you need to supply the full path to the script. Filename entered: " & scriptName
end try

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.