Correct syntax for Launch?

Deploying to Linux? Get penguinated here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
AndyP
Posts: 294
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Correct syntax for Launch?

Post by AndyP » Wed Aug 24, 2016 7:42 am

Hi I'm trying to get Launch to work for Linux for this http://livecodeshare.runrev.com/stack/807/LC-Launcher,

1. In Linux what is the correct syntax for launching an executable from a known directory from a LiveCode app?

As I understand, Launch cannot be used on Linux but one has to shell out.

2. Can a Linux app be launched via LiveCode without having the "Enter Password" prompt?

3. Are the rules the same for all (most) Linux flavours?

Looking forward to learning a little bit more about Linux....
Andy Piddock

http://2108.co.uk/tinyide/ - TinyIDE gives you more space to develop your ideas

http://2108.co.uk/script-editor-themer/ Script Editor Themer - Your code has never looked so good

My software never has bugs. It just develops random features

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

Re: Correct syntax for Launch?

Post by FourthWorld » Thu Aug 25, 2016 9:25 pm

AndyP wrote:Hi I'm trying to get Launch to work for Linux for this http://livecodeshare.runrev.com/stack/807/LC-Launcher,

1. In Linux what is the correct syntax for launching an executable from a known directory from a LiveCode app?
As I understand, Launch cannot be used on Linux but one has to shell out.
Both "launch" and "launch document" work well on Ubuntu and Lubuntu, likely others.
2. Can a Linux app be launched via LiveCode without having the "Enter Password" prompt?
You should see the prompt for admin permissions only when attempting to launch an app that requires it when double-clicking or running a command in Terminal to launch as well. If you're seeing that under other circumstances please describe and hopefully we can sort that out.
3. Are the rules the same for all (most) Linux flavours?
"All" is an unrealistic expectation when discussion Linux distros. :) There are just too many variants, and some a very slim and many not include the libraries to support the OpenDesktop standards. I use Ubuntu and Lubuntu here, and I would imagine any Gnome-based DE running on a Debian or Red Hat base should work well. But given the flexibility that characterizes Linux, I'm sure if you look far enough you'll come across configurations that don't.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

AndyP
Posts: 294
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: Correct syntax for Launch?

Post by AndyP » Fri Aug 26, 2016 6:59 am

Thank's Richard,

Still learning with Linux... but liking the experience. :wink:
Andy Piddock

http://2108.co.uk/tinyide/ - TinyIDE gives you more space to develop your ideas

http://2108.co.uk/script-editor-themer/ Script Editor Themer - Your code has never looked so good

My software never has bugs. It just develops random features

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

Re: Correct syntax for Launch?

Post by FourthWorld » Fri Aug 26, 2016 4:39 pm

AndyP wrote:Thank's Richard,

Still learning with Linux... but liking the experience. :wink:
Happy to help. I'm still a relative noob with Linux compared to many of my friends, having been using it daily but part-time since 2009, and having switched to using it a solid majority of the time only three years ago.

But oh what an adventure it's been. Like any new OS it took some getting used to, but the flexibility has made that very rewarding.

While I started with it for the security and flexibility (and of course learning more about working with servers), what's kept me around has been the people. Open source communities are among the most social groups I've seen in computing. No surprise when we consider how deeply collaboration is an inherent part of the process. But oh so nice to be able to make new friends both online and in the many local meetups for open source things, esp. my local Linux User Group.

If you have a LUG in your area I can't recommend attending strongly enough. I believe you'd have a very good time. Open source enthusiasts are a self-selected subset of the general gene pool that's very into sharing by nature. I've consistently met only good people through local LUG meetings, and some have become good friends I've seen socially outside the group.

What an eye-opening experience working with FOSS projects has been. Wonderfully social; that there's cool free software everywhere in such circles is almost a bonus. :)
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

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

Re: Correct syntax for Launch?

Post by wsamples » Sat Aug 27, 2016 5:07 pm

Andy, I have no problem using 'launch' to open Livecode here in openSUSE and I doubt it will be a problem for anyone running a more or less typical Linux desktop environment. You do have to provide the complete path to the executable. I can't promise you'll never come across a user who has moved LiveCode from the default locations but again this is not going to be common. There are two distinct default installation locations depending on whether the user installs for only his user or for all users. These would be:

single user: /home/USER/.runrev/components/[VERSION]/[executable] Livecode does not resolve the tilde abbreviation so you have to get the user's name. An example of one way to do it is:
launch "/home/" & $USER & "/.runrev/components/[VERSION]/[executable]"

installed for all users: /opt/livecode/[VERSION]/[executable]

Good luck!

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

Re: Correct syntax for Launch?

Post by wsamples » Wed Aug 31, 2016 6:16 pm

Andy, the code you first attempted, "lauch tLaunch" works fine here to open versions 8+ but fails to open LC in versions 6x or 7x, for reasons unknown to me. I get the same result in the message box.

A note about how you scan for versions; it's very possible users have installed different versions in both the /home/.runrev and the /opt locations. For the sake of completeness it might be beneficial to develop a routine which scans both.

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

Re: Correct syntax for Launch?

Post by wsamples » Wed Aug 31, 2016 10:37 pm

Further, using shell() will work for you but there are a couple of things to watch out for. First, shell() is blocking and the launcher will be unresponsive until the instance of LiveCode that it opened is closed. Secondly, you may need to escape the path to LC due to spaces and parentheses. For instance LC versions 6x and 7x on my system have a directory that ends with SPACE + (machine-type). Escaping is very simple, you just enclose the path with single quotes. The shell likes them but LiveCode ignores them. Thus: "'" & tLaunch & "'"

There is a forum post here that shows a way to make shell calls in a non-blocking way. Altogether your shell call might look like this:

Code: Select all

get shell("exec '" & tLaunch & "'   > /dev/null 2>/dev/null &")
There are several correct ways to write the redirect, you will find this works, too:

Code: Select all

get shell("exec '" & tLaunch & "'   >  /dev/null 2>&1 &")
It's working here. It opens the selected version of LiveCode and you can close the launcher or select and open another version or even another instance of an already open version.

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

Re: Correct syntax for Launch?

Post by wsamples » Thu Sep 01, 2016 1:54 am

So, your code block for Linux could be this:

Code: Select all

  
 if the systemVersion contains "Linux" then
      --Linux
      -- this does not address the possibility that a user may have installed some versions
      -- as "single user" and other versions for "all users"
      set the folder to tFolder & "/" & tVersionSelected & "/"
      put the files into tFiles
      filter lines of tFiles with regex pattern "LiveCode*.*\." 
      put the Folder & "/" & tFiles into tLaunch
      get shell("exec '" & tLaunch & "'   >  /dev/null 2>&1 &")
    end if

AndyP
Posts: 294
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: Correct syntax for Launch?

Post by AndyP » Tue Sep 06, 2016 8:09 am

Hi wsamples,

Thank you. I have amended LC Launcher with your Linux code and it works perfectly on Linux Mint.

Uploaded a new version. http://livecodeshare.runrev.com/stack/807/LC-Launcher

Learnt a little more today.... :D
Andy Piddock

http://2108.co.uk/tinyide/ - TinyIDE gives you more space to develop your ideas

http://2108.co.uk/script-editor-themer/ Script Editor Themer - Your code has never looked so good

My software never has bugs. It just develops random features

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

Re: Correct syntax for Launch?

Post by wsamples » Tue Sep 06, 2016 3:38 pm

Glad I could help :)

Post Reply

Return to “Linux”