What's the difference between LC 'shell' and OSX terminal?
Graham Samuel
livfoss at mac.com
Sat Oct 29 18:03:45 EDT 2011
Thanks to Roger Eller and Mike Bonner - shell is a function! Of course it is, it says so in the LS documentation, even though the examples don't show it embedded in a function-using script.
I got it wrong because I didn't read the docs closely enough - I imagined that it was a handler that acted exactly like a command line in Terminal - but of course it also returns a result!
Anyway that particular problem is solved along with the earlier one about paths (thanks Andre Garzia) and I can now run IM from shell.
Graham
On Sat, 29 Oct 2011 11:20:49 -0400, Roger Eller <roger.e.eller at sealedair.com> wrote:
> On Sat, Oct 29, 2011 at 10:40 AM, Graham Samuel wrote:
>
>> Thanks to all who replied.
>>
>> in Terminal, and got:
>>
>> /opt/local/bin/convert
>>
>> I don't exactly know what 'opt' is, but I can open /opt/local/bin/ in the
>> Mac Finder, so it exists OK, and it contains a file 'convert' as expected.
>> Anyway I tried doing this in the LS message box:
>>
>> shell(/opt/local/bin/convert)
>>
>> and got:
>>
>> Message execution error:
>> Error description: Handler: can't find handler
>> Hint: shell(/opt/local/bin/convert)
>
>
> You are so close. :-)
>
> "and got:" is the clue. You could not have "got" unless you first GET.
> Also, quotes around the path should help.
>
> Try this in the message box:
>
> get shell("/opt/local/bin/convert")
>
> ?Roger
And Mike Bonner <bonnmike at gmail.com> wrote (in part):
To: How to use LiveCode <use-livecode at lists.runrev.com>
Wasn't real clear there.. Yes shell is a function, but livecode uses subtle
clues to interpret what is what. So a function on a line by itself with no
way to handle the output is instead seen as a handler because the engine is
making its best guess. And since there is no handler named shell() you get
the error message you see.
As soon as you include some way of using what the function returns the
engine is back in happy land.
As mentioned by everyone though, spaces and strange chars in paths and
commands can cause funky results including a handler not found as above all
depending on how the engine guesses.
More information about the use-livecode
mailing list