actiona icon indicating copy to clipboard operation
actiona copied to clipboard

is it possible to pass arguments on the command line when launching a script?

Open nickpitlosh opened this issue 3 years ago • 9 comments

i have an endlessly long script that needs 4 variables to execute, i'd like to script its execution in bash. is it possible to do this? also, the english documentation is... lacking.

nickpitlosh avatar Nov 06 '21 17:11 nickpitlosh

i have an endlessly long script that needs 4 variables to execute, i'd like to script its execution in bash. is it possible to do this?

Not directly no. But you could use environment variables.

also, the english documentation is... lacking.

I know... Feel free to add more to it as you learn new stuff though. That's why it's a wiki. Almost no-one adds content there unfortunately. :)

Jmgr avatar Nov 24 '21 19:11 Jmgr

while I have you, the 'command' action expects what exactly? I'm trying to execute sed. at the moment I'm using /bin/bash with the parameters -c /usr/bin/sed -i '1d' /home/nick/facebookin

nickpitlosh avatar Nov 24 '21 20:11 nickpitlosh

so insert the myobject object into a variable action to read the env variable into the actiona variable?

nickpitlosh avatar Nov 24 '21 20:11 nickpitlosh

thanks for responding.

nickpitlosh avatar Nov 24 '21 20:11 nickpitlosh

while I have you, the 'command' action expects what exactly? I'm trying to execute sed. at the moment I'm using /bin/bash with the parameters -c /usr/bin/sed -i '1d' /home/nick/facebookin

The underlying Qt function that is run is QProcess::start. Actiona splits the parameter string into a list using the space character. That's quite bad and I consider this as a bug. That means that if you have a parameter containing a space you are a bit screwed. The best alternative is probably to use some code instead.

so insert the myobject object into a variable action to read the env variable into the actiona variable?

Yes.

Jmgr avatar Nov 24 '21 20:11 Jmgr

Can the spaces be escaped?

On Wed, Nov 24, 2021, 1:53 PM Jonathan Mercier-Ganady < @.***> wrote:

while I have you, the 'command' action expects what exactly? I'm trying to execute sed. at the moment I'm using /bin/bash with the parameters -c /usr/bin/sed -i '1d' /home/nick/facebookin

The underlying Qt function that is run is QProcess::start https://doc.qt.io/qt-5/qprocess.html#start. Actiona splits the parameter string into a list using the space character. That's quite bad and I consider this as a bug. That means that is you have a parameter containing a space you are a bit screwed. The best alternative is probably to use some code https://wiki.actiona.tools/doku.php?id=en:code:system:process&s%5B%5D=command#start instead.

so insert the myobject object into a variable action to read the env variable into the actiona variable?

Yes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Jmgr/actiona/issues/160#issuecomment-978212261, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZRATBCPMRINTYEOWK6GCLUNVGENANCNFSM5HPZ7KNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

nickpitlosh avatar Nov 24 '21 20:11 nickpitlosh

Looking at the code I don't think so unfortunately.

Jmgr avatar Nov 24 '21 20:11 Jmgr

Sad face.

On Wed, Nov 24, 2021, 1:59 PM Jonathan Mercier-Ganady < @.***> wrote:

Looking at the code I don't think so unfortunately.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Jmgr/actiona/issues/160#issuecomment-978215374, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZRATE3H6KEA6L7IZKY5ILUNVG3HANCNFSM5HPZ7KNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

nickpitlosh avatar Nov 24 '21 21:11 nickpitlosh

I will pass on a tip. I have found that Actiona can run custom script through the command object. Thus if a Python script is included with Actiona script it can simply be run through command object .. python3 MyScript.py arg1 arg2 arg3 arg4

To pass args we require to import argparse in Python.

https://docs.python.org/3/howto/argparse.html

datavectors avatar Jan 04 '22 12:01 datavectors