Using launch command with LiveCode Server

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

aetaylorBUSBnWt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Thu Sep 20, 2012 5:11 pm

Using launch command with LiveCode Server

Post by aetaylorBUSBnWt » Tue Jan 31, 2023 8:21 am

Hello,

I want to launch a LiveCode standalone app (built on MacOS) for MacOS from a .lc file.
Or from a .livecodeScript stack file that is started from a .lc file.

The app itself is not based on LiveCode Server, it is just a plain old standalone app.
The application is in the Applications folder. It is NOT a distributed application, nor will it ever be, so it has not been "signed". I have tried putting the application in other places, same result.

What happens is nothing unless the application is already running. Then the application becomes frontmost.

Code: Select all

<?lc

launch "/Applications/myLiveCode.app"

?>
I also tried launch documentPath with applicationPath
same result - nothing.

So what do I do?

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 133
Joined: Tue Feb 23, 2010 10:53 pm
Location: Saint Louis, Missouri USA

Re: Using launch command with LiveCode Server

Post by bobcole » Tue Jan 31, 2023 5:01 pm

Here is a thought, try

Code: Select all

/System/Applications/myLiveCode.app
Bob

aetaylorBUSBnWt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Thu Sep 20, 2012 5:11 pm

Re: Using launch command with LiveCode Server

Post by aetaylorBUSBnWt » Wed Feb 01, 2023 12:14 am

I have since restarted my Macintosh, now I get:

"no such program" as a result of the launch command, no matter the application.

Nope, adding "System" does not help.

I just switched to trying the launch command from the Livecode IDE MessageBox.

and launching the Preview.app

just the simple:

Code: Select all

launch "/Applications/Preview.app"
put the result
I get "no such program" as a result.

I also went to the trouble of the complete path as shown in the Finder:
"/Macintosh HD/Applications/Preview.app"

So it has gone from bad to worse.

My .lc file works otherwise in both the /WebServer/Documents and userName/Scripts too.

"launch" has just ceased working altogether, no matter where it is called from.

Help!

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

Re: Using launch command with LiveCode Server

Post by FourthWorld » Wed Feb 01, 2023 12:52 am

Does launch work on the bundle folder, or does it need the path to the executable within the bundle?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

aetaylorBUSBnWt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Thu Sep 20, 2012 5:11 pm

Re: Using launch command with LiveCode Server

Post by aetaylorBUSBnWt » Wed Feb 01, 2023 4:17 am

FourthWorld wrote:
Wed Feb 01, 2023 12:52 am
Does launch work on the bundle folder, or does it need the path to the executable within the bundle?
I have no idea what RunRev did when building the launch command, but I really hope that they do not expect users to dig inside a macOS application bundle to find the executable for this command.

The Dictionary just says "application path".

But in the interests of completeness, I just dug out the path all the way down to the executable and that does not work.

Now, if one digs down there, you are now looking at a UNIX executable and the Dictionary explicits excludes UNIX executables from "launch".

So if this is the case, then "launch" should be explicitly targeted to Windows only!

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

Re: Using launch command with LiveCode Server

Post by FourthWorld » Wed Feb 01, 2023 6:54 am

Same error code?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

aetaylorBUSBnWt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Thu Sep 20, 2012 5:11 pm

Re: Using launch command with LiveCode Server

Post by aetaylorBUSBnWt » Thu Feb 02, 2023 12:38 am

FourthWorld wrote:
Wed Feb 01, 2023 6:54 am
Same error code?
At this point I don't remember.
Many times nothing happens.
If not that, then the next most likely response is "no such program".
Which suggests that what Livecode is expecting for an application path is nothing I have thought to supply.

To avoid issues with an unsigned application generated by Livecode running on my machine I have switched to trying Apple distributed applications or ones that are distributed and are known to have an official signature.
Preview, BBEdit, PDFPen.
So since those are in the central Applications folder the path is:

Code: Select all

launch "/Applications/Preview.app"
I have tried it with and without the ".app"

I also tried adding the name of the disk drive, so:

Code: Select all

launch "/Macintosh HD/Applications/Preview.app"
I have also tried not including the leading '/'.

What I have found so far is that the application must already be running in order for this command to do anything.

Ultimately I don't need my target application to be frontmost since it is going to be a socket based communicator with a database that is accessed by the .lc scripts. My target application just needs to be running. I will probably launch my application via the logged in user at startup, but would like a means of re-launching it if it quits for some reason.

(and this command is supposed to work, independent of my interest in it.)

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: Using launch command with LiveCode Server

Post by mwieder » Thu Feb 02, 2023 1:12 am

Eh?
the Dictionary explicits excludes UNIX executables from "launch".
Er... the dictionary footnote refers to linux *processes*, not applications.
And the dictionary says the launch command is supported on all desktop server platforms.

At any event, the launch command works for me on both linux and OSX without problems, both from a script and from the message box.

aetaylorBUSBnWt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Thu Sep 20, 2012 5:11 pm

Re: Using launch command with LiveCode Server

Post by aetaylorBUSBnWt » Thu Feb 02, 2023 2:19 am

mwieder wrote:
Thu Feb 02, 2023 1:12 am
Eh?
the Dictionary explicits excludes UNIX executables from "launch".
Er... the dictionary footnote refers to linux *processes*, not applications.
And the dictionary says the launch command is supported on all desktop server platforms.

At any event, the launch command works for me on both linux and OSX without problems, both from a script and from the message box.
ACK!
Well, I guess I will go about rebooting, redownloading and try again.

And just to be overly clear you would use:

Code: Select all

launch "/Applications/Preview.app"
To launch that program.

And you can launch a standalone application from LiveCode, without a signature?

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: Using launch command with LiveCode Server

Post by mwieder » Thu Feb 02, 2023 2:30 am

Not exactly.
On OSX if you control-click an app in the finder and Get Info you can see where it lives.
I launched "/Applications/LibreOffice.app" with no problem.
The Preview application lives in the System folder, so you launch it with "/System/Applications/Preview.app".

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 133
Joined: Tue Feb 23, 2010 10:53 pm
Location: Saint Louis, Missouri USA

Re: Using launch command with LiveCode Server

Post by bobcole » Thu Feb 02, 2023 2:48 am

I'll try again.
If you enter this
launch "/Applications/TextEdit.app"
it won't work. You will get "no such program" returned.
However, if you enter this

Code: Select all

launch "/System/Applications/TextEdit.app"
it will start the app.
I think this work with Apple's programs.
When I try to open BBEdit.app this works

Code: Select all

launch "/Applications/BBEdit.app"
There must be some difference between Apple programs and others.
Bob

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 133
Joined: Tue Feb 23, 2010 10:53 pm
Location: Saint Louis, Missouri USA

Re: Using launch command with LiveCode Server

Post by bobcole » Thu Feb 02, 2023 2:52 am

mwieder beat me.
He types faster.

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: Using launch command with LiveCode Server

Post by mwieder » Thu Feb 02, 2023 3:10 am

Heh. I typed less.

aetaylorBUSBnWt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Thu Sep 20, 2012 5:11 pm

Re: Using launch command with LiveCode Server

Post by aetaylorBUSBnWt » Thu Feb 02, 2023 3:34 am

OK, this is really annoying.

I sometimes run my machine for days without restarting.

I restarted last night, have not done any development work yet today. Just launched LiveCode and tried launch again with the /System/Applications for Apple programs and only /Applications/ for others.

Now it works!

Apparently "stuff" accumulates and causes problems.
What that "stuff" is, I have no idea, because I executed commands that were stored in the Messagebox - so it was not different typing happening.
Well moving on to next steps.
Thanks for verifying launch really does work.

urf!

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

Re: Using launch command with LiveCode Server

Post by FourthWorld » Thu Feb 02, 2023 3:53 am

aetaylorBUSBnWt wrote:
Thu Feb 02, 2023 12:38 am
FourthWorld wrote:
Wed Feb 01, 2023 6:54 am
Same error code?
At this point I don't remember.
Many times nothing happens.
Try adding a call to the sysError() function with "the result" to get the specific error code the OS is reporting.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”