Console app, output to console?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Console app, output to console?

Post by trenatos » Thu Aug 08, 2013 8:50 am

I'm trying to make a console app, it'll run on linux but I'm testing on linux and windows.
In the Dictionary it says that write "Stuff here" to stdout should output the text on the console, but it doesn't work (On Windows nor Linux)
Tried running with -ui, and chmodded to 755 on linux.

On Linux it freezes, I get a new blank line and then nothing, on Windows I get a blank line and the it quits back to prompt.

What am I missing here?
Marcus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9834
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Console app, output to console?

Post by FourthWorld » Thu Aug 08, 2013 3:04 pm

I'm surprised stdOut isn't working, but you may try simply "put" without a destination to do that as well, e.g.:

Code: Select all

put "Hello Console"
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Re: Console app, output to console?

Post by trenatos » Thu Aug 08, 2013 7:03 pm

That doesn't work either.
I tried putting it in the card script, and the stack script, but nothing outputs.

I've tried with the last version as well as the latest version.
Marcus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9834
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Console app, output to console?

Post by FourthWorld » Thu Aug 08, 2013 7:06 pm

Do you know if the app is even running? Perhaps you could try writing some output to a file to check that.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Re: Console app, output to console?

Post by trenatos » Thu Aug 08, 2013 7:10 pm

Could I ask for a favor?
Can you make a .livecode file that compiles and works with outputting to the console/CLI on your computer, that I can download and look at?

Maybe I'm missing something subtle or silly, it would also let me confirm that it's me and not the LC compiler.
Marcus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9834
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Console app, output to console?

Post by FourthWorld » Thu Aug 08, 2013 7:11 pm

This should work - just put this into the stack script of a standalone and build for Linux:

Code: Select all

on startup
  put "Hello Console"
end startup
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Re: Console app, output to console?

Post by trenatos » Thu Aug 08, 2013 7:27 pm

I opened a new stack, put that in and compiled, didn't work on Windows but worked on Linux...
I swear I tried that before and it didn't work..

Thank you, FourthWorld! (Sorry, I can't remember your name, I'm horrible with names..)
Marcus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9834
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Console app, output to console?

Post by FourthWorld » Thu Aug 08, 2013 7:40 pm

trenatos wrote:I opened a new stack, put that in and compiled, didn't work on Windows but worked on Linux...
I swear I tried that before and it didn't work.
Windows is finicky; best left behind to hasten its declining market share. :) (Pardon my Linux fanboyism)

More seriously, sometimes on Win the trick is to set the value of LC's shellCommand global property to the full path of the shell you're using. Let me know if that doesn't do it for you.
Thank you, FourthWorld! (Sorry, I can't remember your name, I'm horrible with names..)
I put it in my sigline to help others as bad with names as I am. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Re: Console app, output to console?

Post by trenatos » Thu Aug 08, 2013 7:45 pm

Haha that's what I get for not paying attention, thank you Richard!

Yeah I like Linux better than Windows too, but I also like lots of games on Windows, and most of my clients use it, so there's no escaping it. lol
Marcus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9834
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Console app, output to console?

Post by FourthWorld » Thu Aug 08, 2013 7:54 pm

trenatos wrote:Yeah I like Linux better than Windows too, but I also like lots of games on Windows, and most of my clients use it, so there's no escaping it. lol
Just install KDE on their systems and tell 'em it's Windows 9 - all they'll know is it's faster, leaner on resources, more usable, and has as much app compatibility as Win RT. ;)

Keep me posted on how the shellCommand thing works out.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Re: Console app, output to console?

Post by trenatos » Thu Aug 08, 2013 9:54 pm

Heh, tempted to do that. lol

So now stdout works on Linux, but it still doesn't work on Windows.

That's not an issue for me, this application is for Linux only, but the Dictionary does say that it should work with Windows, so I may have stumbled on a bug in the latest rc2 release?
Marcus

trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Re: Console app, output to console?

Post by trenatos » Fri Aug 09, 2013 12:55 am

Hey Richard, since you're a Linux guy and programmer, maybe you could help me out on this one too:
The program I'm making, I'd like it to be able to run in the background, both when run manually and on server boot, any pointers on that?
Marcus

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Console app, output to console?

Post by mwieder » Fri Aug 09, 2013 3:04 am

stdout on Windows is weird - the console doesn't count. You can, however, send stderr to the console, IIRC.
Try launching the app from a commandline and redirect the output to a text file.

At any rate, writing to stdout works on linux. Put does not go to stdout.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9834
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Console app, output to console?

Post by FourthWorld » Fri Aug 09, 2013 4:00 am

mwieder wrote:Put does not go to stdout.
Where does it go?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Console app, output to console?

Post by mwieder » Fri Aug 09, 2013 6:15 am

stdout goes to a different pipe on Windows. The console is connected to stderr, but not to stdout. If you redirect the stdout output you can catch it in a file.

Ah. I see I answered a different question from the one you asked.
I'm not sure where put goes. In the IDE it goes to the message box unless it's redirected.
I don't know what happens in a standalone... maybe it's one of those uncaught messages that are trapped by a frontscript in the IDE.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”