Levure how to include shell scripts/executeables

Collaborate on tools, libraries, and applications beyond the IDE

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Locked
mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 76
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Levure how to include shell scripts/executeables

Post by mimu » Wed Jul 24, 2019 9:38 am

Hello,
i would like to include some shell scripts / executables in my levure based application.

a couple of questions:

1. which one is the correct / intended folder to put these scripts in ?

2. which entries are needed in app.yaml?

3. which is the correct path to the intended folder?
put shell("intendedfolderpath/xlsx2csv.py -d 'tab' '"& tFilePath &"'") into tFile

this works: put shell("/usr/local/bin/xlsx2csv.py -d 'tab' '"& tFilePath &"'") into tFile

i tried to put my xlsx2csv.py into assets on mac and call it like
shell("assets/xlsx2csv.py -d 'tab' '"& tFilePath &"'") into tFile
but this way the script is not found.

if i would like to call the script on windows what else then slash to backslash has to be changed in the shell call ?

Thank you very much in advance for any advise / sample

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Levure how to include shell scripts/executeables

Post by trevordevore » Wed Jul 24, 2019 3:54 pm

Hi @mimu. Levure doesn't define any specific folder for shell scripts or executables. But you can definitely define your own folder using names that make sense to you. The only thing you need to do is make sure that the folder you define is copied to your packaged application for delivery to the end user.

For the sake of this example, let's say that you put the executable in an ./app/scripts folder.

Getting path to script

put levureAppFolder() & "/scripts/xlsx2csv.py" into tShellPath

https://github.com/trevordevore/levure/ ... eAppFolder

Make sure that `scripts` folder is copied when app is packaged

See instructions for adding files and folders to the `copy files` section of app.yml: https://github.com/trevordevore/levure/ ... -builds%3F

Platform considerations

Off the top of my head I don't know what issues (other than changing slashes in file paths) you might run into when running your script on mac/win.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 76
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Re: Levure how to include shell scripts/executeables

Post by mimu » Wed Jul 24, 2019 9:08 pm

Hi Trevor,
you are perfect.
The most missing part for me was
put levureAppFolder() & "/scripts/xlsx2csv.py" into tShellPath

In my script i added (because of possible spaces in tShellPath)
replace " " with "\ " in tShellPath
to make the shell happy :-)

Thank you very much for your help.


Ps. nice pythonscript to translate Excel files to tab delimited Text or csv i found here:
https://github.com/dilshod/xlsx2csv

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Levure how to include shell scripts/executeables

Post by trevordevore » Wed Jul 24, 2019 10:08 pm

You're welcome. I'm glad it is working now.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Locked

Return to “Community Projects”