Embed command line tool

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

Post Reply
matgarage
Posts: 73
Joined: Sat Apr 20, 2013 11:39 am

Embed command line tool

Post by matgarage » Fri Jan 08, 2016 5:13 pm

Hi

I've coded an app that use a command line tool to execute color measure.
I would want to deploy and share this app with my colleague.
Is it possible to embed the command line tool inside the standalone and use it without installing it on the /bin folder(for example) on each machine ?

Thanks
Last edited by matgarage on Fri Jan 08, 2016 6:02 pm, edited 1 time in total.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Embed line command tool

Post by Klaus » Fri Jan 08, 2016 5:35 pm

Hi Mat,

embed yes, use without saving no!
You have to to save it somewhere on the users harddisk before being able to execute it!
Maybe only temporarily in the TEMP folder? Check:
-> specialfolderpath("temporary")
and
-> the tempname
in the dictionary, maybe that helps.

Embedding:
I always put binary stuff (apps or whatever) im a custom property of my stack(s)
and "spit them out" as necessary like this:
...
answer file "Where is the tool?"
set the cCommandLineTool of this stack to url("binfile:" & it)
## Save the stack and that was it!
...

Spit out and execute immediatley:
...
put specialfolderpath("temporary") & "/an_unsuspicious_filename" into tTargetFile
put the cCommandLineTool of this stack to url("binfile:" & tTargetFile)
launch tTargetFile
...
You get the picture :D


Best

Klaus

matgarage
Posts: 73
Joined: Sat Apr 20, 2013 11:39 am

Re: Embed line command tool

Post by matgarage » Fri Jan 08, 2016 6:01 pm

The wooow effect !

I would like to clone your brain to get your coding skills if it was not so funny to learn step by step. :-))

Thank you Klaus.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Embed command line tool

Post by Klaus » Fri Jan 08, 2016 10:16 pm

Sorry, Mat, I'm un-clonable! :D

matgarage
Posts: 73
Joined: Sat Apr 20, 2013 11:39 am

Re: Embed command line tool

Post by matgarage » Sat Jan 09, 2016 12:08 pm

Hi Klaus !
I need to correct your code (I can't realize I'm saying that...)

I've to put (into) :

Code: Select all

put the cCommandLineTool of this stack into url("binfile:" & tTargetFile)
instead of (to):

Code: Select all

put the cCommandLineTool of this stack to url("binfile:" & tTargetFile)
Just to help those who will read and use this after.

Ok, I understand that your are un-clonable Klaus, but, can I do a little 'brain backup' ?
Security first :-)

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Embed command line tool

Post by Klaus » Sat Jan 09, 2016 1:30 pm

Hi Mat,
I need to correct your code (I can't realize I'm saying that...)
Haha, don't worry, see it just as a prove that I'm human! :D

Yes, sorry, of course it has to be:
... put ... INTO...


Best

Klaus

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Embed command line tool

Post by SparkOut » Sat Jan 09, 2016 4:30 pm

put "klausimausi/braindump.iso" into tBrainfile
set the uKlausbrain of this stack to URL("binfile:" & tBrainfile)
save this stack

Then you can write out the file and mount the iso to have your very own portable Klaus

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Embed command line tool

Post by Klaus » Sat Jan 09, 2016 4:33 pm

SparkOut wrote:put "klausimausi/braindump.iso" into tBrainfile
set the uKlausbrain of this stack to URL("binfile:" & tBrainfile)
save this stack

Then you can write out the file and mount the iso to have your very own portable Klaus
:D :D :D

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

Re: Embed command line tool

Post by FourthWorld » Sat Jan 09, 2016 7:54 pm

SparkOut wrote:put "klausimausi/braindump.iso" into tBrainfile
set the uKlausbrain of this stack to URL("binfile:" & tBrainfile)
save this stack

Then you can write out the file and mount the iso to have your very own portable Klaus
I tried that but got a permissions error noting that I wasn't the owner of that resource.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Embed command line tool

Post by Klaus » Sat Jan 09, 2016 7:59 pm

Well, MY mother taught me to ask first before dealing with someone elses property (resource)! 8)

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Embed command line tool

Post by SparkOut » Sat Jan 09, 2016 8:00 pm

Did you chown the file first?

matgarage
Posts: 73
Joined: Sat Apr 20, 2013 11:39 am

Re: Embed command line tool

Post by matgarage » Sun Jan 10, 2016 12:14 pm

Put :D into myDay

Post Reply