What's the difference between LC 'shell' and OSX terminal?
bonnmike at gmail.com
Sat Oct 29 11:00:47 EDT 2011
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.
On Sat, Oct 29, 2011 at 8:48 AM, Mike Bonner <bonnmike at gmail.com> wrote:
> shell is a function, you have to actually do something with what is
> notice if you do the following from the message box:
> shell() with nothing, you get handler not found
> If you do this instead
> put shell() you get bad parameter because you didn't give the function
> anything to work with.
> So, if you do
> put shell("/opt/local/bin/convert --help") you will most likely get the
> help text for convert.
> If you are doing it correctly, (IE as in the above examnple) and are still
> getting a handler error, there is something else going on.
> On Sat, Oct 29, 2011 at 8:40 AM, Graham Samuel <livfoss at mac.com> wrote:
>> Thanks to all who replied.
>> Just a brief reminder that I found I could invoke ImageMagick from
>> Terminal on my Mac, but not via 'shell' within an LC program on the same
>> I really hoped that Andre's insight was right and that it was a path issue
>> - really because I understand what one of those is! Anyway on your advice,
>> Andre, I did:
>> which convert
>> in Terminal, and got:
>> 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:
>> and got:
>> Message execution error:
>> Error description: Handler: can't find handler
>> Hint: shell(/opt/local/bin/convert)
>> I then set the defaultFolder to /opt/local/bin/, and the Message Box
>> couldn't even recognise 'shell'!
>> So very sadly, that didn't work. Neither did it work when I put the whole
>> shell argument in quotes, nor could shell find other commands such as
>> 'which' or 'cd' with or without the path data.
>> Andre's solution seems so logical… any more suggestions? Incidentally, on
>> my machine shellCommand is set to:
>> which AFAIK is what it's supposed to be.
>> Thanks also to Mike Bonner for his advice on command lines (some of which
>> I understood, although I'd never heard of a profile in the sense Mike uses,
>> so I am a bit at sea there). Also, although currently I'm just
>> experimenting, I'm always looking for solutions which would work in a
>> complete cross-platform app built for people who just want to use the
>> computer as a tool. In that context any 'tinkering' with the environment
>> would have to be done via LS, and within that via shell, so as to protect my
>> user - I'm not sure if this is possible or not, but I'll keep trying to
>> understand it. In my encounters with ImageMagick the really interesting
>> thing I've learned so far is the philosophical difference between 'nix users
>> and Mac/PC users - it's geeks versus consumers really. I was once a geek
>> myself, in some pretty tough technical environments, but the reason I use LS
>> is because I stopped being one.
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
More information about the Use-livecode