Ask Reuben

User Action (Part 2)

Why does my User Action command not execute? 

Why does my execute front-call command not execute?

Both the Genero Studio User Action functionality and the execute front-call generate the same question.  It typically arises because you find you can enter a simple one word command and it will execute but then when you add more to the command such as redirection, setting of environment, the command will not execute as you think it should.

I did have an article on User Action previously but did not cover this point, hence the part 2 in the title.

The trick is to recognise that when you enter command such as > for redirection, && to execute the next command is that these commands need to be interpreted by a command/shell interpreter.  What you need to be executing is a command/shell interpreter and the commands you want to be interpreted.

So for example I have the following as a User Action on my Mac to launch the demo program …

/bin/zsh -c "cd $FGLDIR/demo && fglrun demo"

I have the following as a User Action associated with project files to do a Git commit on my project

/bin/zsh -c "cd $(ProjectDir) && git commit -m '$(message)'"

On Linux, you would most likely be using another shell, so bash, sh etc instead of zsh.

On Windows the tool is cmd /C.  The value for the command is what you can put into Start->Run.  So if you are unsure, experiment entering the command you want into Start->Run.  You will most likely find that something of the form …

cmd /C "command"

… is what is required.

Also remember that in the execute front-call case, it is the O/S where the GDC is executing.  So if GDC is on a Windows PC, it is cmd /C something.

So when you do get stuck with these commands, once you have checked the environment and the current directory, ask yourself, do I need to be executing this command in a command / shell interpreter and if so make that the command with what you want to run as a parameter.