mac and windows command line standalone how?

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

Post Reply
josemv
Posts: 11
Joined: Mon Jan 05, 2009 4:51 pm

mac and windows command line standalone how?

Post by josemv » Sun Feb 19, 2012 2:30 am

Hello,

am trying to get a simple program run as a standalone from the command line accepting parameters and displaying results on the screen.

I got accepting parameters in both Windows and Mac, but there is no way to get output to the screen on Windows. I read everything on forums and list about this issue and seems it is an obscure feature or simply doesn't works.

Currently am running LC 4.6.4

This is stack code am trying:

Code: Select all



on startup
      hide this stack
      local tCommandLine  
      
   
      --put "using put hello2 plus cr" & CR into stdout
      --put "using put hello2 plus return" & return into stdout
      
      --write "using write hello2 plus return" & return to stdout
      write "using write hello2 plus cr" & CR to stdout   
      
      -- handle command line arguments here
      put word 1 to -1 of lower($1) into tCommandLine
      
      switch char 2 of tCommandLine
            case "t"
                  put "with -t param" & return after URL "file:debug.txt"
                  quit
                  break
                  
            default
                 put "any other case " & tCommandLine & return after URL "file:debug.txt"
                 quit
                 break
      end switch
end startup


This is the only way I found to get output on the screen on Mac OSX

Code: Select all

write "using write hello2 plus cr" & CR to stdout
Any body could give an example to get the same on Windows?

Thanks
Jose

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: mac and windows command line standalone how?

Post by sturgis » Sun Feb 19, 2012 2:38 am

If I recall correctly, if you run from the command line with -ui switch, then you can also use "put whatever" with no target and it will show.

The way the windows console works is.. different. As mentioned recently on the use-list you can redirect the output to a file

mycommandlineapp > output.txt

and it will work. YOu can also pipe the output to another command.

mycommandlineapp | more

and it should work but of course then you have to worry about whether the output text is long enough to force pagination.

If its just for personal use you could download some unix utilities so that you have access to cat which you can use as a straight pass-through

mycommandlineapp |cat

No matter how you cut it, windows is kinda a pain in the tookus. If you have livecode server you can use it instead. It works very well.

josemv
Posts: 11
Joined: Mon Jan 05, 2009 4:51 pm

Re: mac and windows command line standalone how?

Post by josemv » Sun Feb 19, 2012 2:49 am

Hi,

thanks for your help.

Need a solution as simple as possible to run an .exe file getting arguments and outputting results to the screen. Server is not an option, I will try with -ui and piping, but doesn't looks the simpler solution for that kind of users.

Jose

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

Re: mac and windows command line standalone how?

Post by mwieder » Mon Feb 20, 2012 1:53 am

Sounds like piping the output to a temporary file (see the "tempname" entry in the dictionary) would be your answer here. After piping the output to a temp file, load it into a variable for further work or into a field for display.

josemv
Posts: 11
Joined: Mon Jan 05, 2009 4:51 pm

Re: mac and windows command line standalone how?

Post by josemv » Mon Feb 20, 2012 8:18 am

Hi

thanks all for your help. Got working with -ui and | more allow to output to the screen in Windows. Mac version works ok too.

Jose

Post Reply