trouble with actioncommand

Post here if you need help using Actiona
Post Reply
Posts: 1
Joined: 05 Jun 2019, 15:04

trouble with actioncommand

Post by lindajeanne » 05 Jun 2019, 15:16

So, what is actioncommand trying to do with the command before sending it to the shell?

The following command works fine pasted into the shell, but throws a parse error as an Actiona actioncommand:

Code: Select all

grep "@" /path/to/jabref.bib | sed "s/@.*{\(.*\),/\1/" | grep -v "@Comment"
Thinking it didn't like the pipes, I also tried

Code: Select all

grep "@" /path/to/jabref.bib
When that didn't work, I tried moving the

Code: Select all

"@" /path/to/jabref.bib
down to the "parameters" line. Still got a parse error.

So, I'm having a hard time figuring out what is and is not allowed in actioncommand in terms of shell commands? (Or am I misunderstanding its purpose entirely, and its not supposed to be running a shell command at all?) I'm using linux and bash. Thanks!

Edited to add:

When I treid it as:
  • Command: grep
  • Parameters: "@" jabref.bib | sed "s/@.*{\(.*\),/\1/" | grep -v "@Comment"[/code]
  • Working Directory: /path/to/
The error was "can't find variable grep"

So I chanted it to:
  • Command: /bin/grep
Which gave me the error: "invalid regular expression flag"

I reduced it back down to:
  • Command: /bin/grep
  • Parameters: "@" jabref.bib
  • Working Directory: /path/to/
but it still complained about "invalid regular expression flag".

Posts: 80
Joined: 08 Mar 2016, 22:18

Re: trouble with actioncommand

Post by eureka » 05 Jun 2019, 20:39

I get more predictable results by using single operators in command.

Code: Select all

is not a command in actiona.

Code: Select all

is a command.

e.g. the command string example you give

Code: Select all

grep "@" /path/to/jabref.bib | sed "s/@.*{\(.*\),/\1/" | grep -v "@Comment"
might be written in python script using subprocess to break up the command string. Or as bash script.

Then your command in Command action is simply "python" and the parameter is the path to your python script.

Another approach I now use is to launch a shell terminal using in Ubuntu the simple command "gnome-terminal" or "pwsh" for PowerShell.
Bring the newly launched terminal window into focus.
Create an actiona variable containing the full blown command string.
Read this variable into clipboard.
Paste clipboard into gnome-terminal window. (Key Ctrl+Shift+V)
Key Return to execute the command string..

And this emulates the process I go through in using gnome-terminal.

Admittedly this is a much longer process requiring a sequence of actions although I place the actions in common procedures. That is you can write your own custom modules/procedures such as "gnomeTerminal"

You can also run a command "actexec" to run a sibling Actiona script (as plugins). That is using nested scripts.

To summarise I have learned through trial and error to use "macros" of several Actiona actions (QtObjects) in a higher level API. I am still learning.

Post Reply