Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment