Passing parameters through shell question

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mtalluto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 128
Joined: Tue Apr 11, 2006 7:02 pm
Contact:

Passing parameters through shell question

Post by mtalluto » Tue May 07, 2013 10:10 pm

Below are two ways I have been testing starting up a binary executable on Mac X. Both methods work to some degree. I really need to be able to pass a parameter. Does anyone know how to pass a param using the "open method"?

--DIRECT METHOD
--BLOCKING
--TERMINAL NOT VISIBLE
--CAN PASS A PARAM
put shell(tPath & "/appName paramWorks")

--OPEN METHOD
--NON BLOCKING
--TERMINIAL VISIBLE
--CAN NOT PASS A PARAM
put shell("open appName --args -paramNotWorking")
Mark Talluto
--
Canela
design - develop - deploy: https://appli.io
Database and Cloud for LiveCode Developers: https://livecloud.io
Company: https://canelasoftware.com

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: Passing parameters through shell question

Post by wsamples » Wed May 08, 2013 1:13 am

Mark, try the "shell without wait" here:

http://www.howsoft.com/runrev/extensions/

The concept is working under Snow Leopard. I just tried it with Safari, passing a URL as a parameter.

Good luck!

mtalluto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 128
Joined: Tue Apr 11, 2006 7:02 pm
Contact:

Re: Passing parameters through shell question

Post by mtalluto » Wed May 08, 2013 1:38 am

I figured out a solution to the problem. Hope this helps someone else down the road.

Code: Select all

get shell("open -n -a" && tAppPath & "/appName" && "--args helloWorld")
FYI: The order of the -n -a is important. It does not work the other way around.
The benefits are it is non blocking, does not open the terminal, and you can pass parameters.
This has been tested on Macs. I believe you can make this work on windows by exchanging the 'open' with 'start'.
Last edited by mtalluto on Wed May 08, 2013 1:41 am, edited 5 times in total.
Mark Talluto
--
Canela
design - develop - deploy: https://appli.io
Database and Cloud for LiveCode Developers: https://livecloud.io
Company: https://canelasoftware.com

mtalluto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 128
Joined: Tue Apr 11, 2006 7:02 pm
Contact:

Re: Passing parameters through shell question

Post by mtalluto » Wed May 08, 2013 1:39 am

wsamples wrote:Mark, try the "shell without wait" here:

http://www.howsoft.com/runrev/extensions/

The concept is working under Snow Leopard. I just tried it with Safari, passing a URL as a parameter.

Good luck!

Thanks Warren for your suggestion. I ended up figuring it out using the solution I posted earlier.
Mark Talluto
--
Canela
design - develop - deploy: https://appli.io
Database and Cloud for LiveCode Developers: https://livecloud.io
Company: https://canelasoftware.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Passing parameters through shell question

Post by FourthWorld » Tue Sep 17, 2013 9:55 pm

mtalluto wrote:I figured out a solution to the problem. Hope this helps someone else down the road.

Code: Select all

get shell("open -n -a" && tAppPath & "/appName" && "--args helloWorld")
FYI: The order of the -n -a is important. It does not work the other way around.
The benefits are it is non blocking, does not open the terminal, and you can pass parameters.
This has been tested on Macs. I believe you can make this work on windows by exchanging the 'open' with 'start'.
With the same args on Win?

Anyone here know if the Mac flags also work similarly on Linux?

Faceless and asyc across platforms would be cool.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply