parameter with quote mark

Post here if you need help using Actiona
Post Reply
dandan
Posts: 6
Joined: 12 Dec 2017, 11:05

parameter with quote mark

Post by dandan »

Hi,

I try to start a program and I need to use a parameter containing quote mark (because there is a space in the path)
for example

program.exe -path-to-config="c:\project\project 1\project.prj"

Unfortunately, I saw that the quotes are not parsed when using them in the parameters field and therefore my program loads without the config.
Anyone knows how to force Actiona to parse the quotes when used in the parameters?

Thanks,
Dan
eureka
Posts: 204
Joined: 08 Mar 2016, 22:18

Re: parameter with quote mark

Post by eureka »

Sometimes I just call from Actiona command a python wrapper script which uses subprocess
to allow long commands, with multiple args, to be invoked.

Have you tried single quotes?
dandan
Posts: 6
Joined: 12 Dec 2017, 11:05

Re: parameter with quote mark

Post by dandan »

Yes, I have tried single quotes. It doesn't work... I also tried to escape using \, also no success
eureka
Posts: 204
Joined: 08 Mar 2016, 22:18

Re: parameter with quote mark

Post by eureka »

This is an example of what I have in mind.

Write python wrapper script .. command.py .. and save in same directory as your *.ascr script.

[command.py]

Code: Select all

#!/usr/bin/env python

import subprocess

def runcmd():
    p = subprocess.Popen(["program.exe", "-path-to-config='c:\project\project 1\project.prj' "], stdout=subprocess.PIPE)
    print p.communicate()[0]    

if __name__ == "__main__":
    runcmd()
Test that the python script works on its own.

Code: Select all

python command.py
Then inside Actiona you can simply write path to the python script ..

Code: Select all

Command: python
Parameters: command.py
Other than this idea does the Actiona command work if you use “project_1” instead of “project 1” .. i.e. drop spaces in path?
dandan
Posts: 6
Joined: 12 Dec 2017, 11:05

Re: parameter with quote mark

Post by dandan »

thanks eureka for answering.
some thoughts:
1. usually the parameter is in a variable - would the python wrapper work also in this case?
2. transforming a path to have it without space is not an option. And yes, when there are no spaces, the Actiona script works.
I have tested also with the fart.exe ( Find and Replace Text) program and it also doesn't work, for example when using:
program: fart.exe
parameters: -C text_to_replace "replacement text"
eureka
Posts: 204
Joined: 08 Mar 2016, 22:18

Re: parameter with quote mark

Post by eureka »

Windows is not my main OS (I have dual boot Ubuntu+Windows) so I'm a bit rusty on escaping paths in Windows.

Reading further, would this work ..

Code: Select all

program.exe -path-to-config="c:\project\'project 1'\project.prj"
or this ..

Code: Select all

program.exe -path-to-config="c:\project\projec~1\project.prj"
dandan
Posts: 6
Joined: 12 Dec 2017, 11:05

Re: parameter with quote mark

Post by dandan »

Hi eureka,

many thanks for the hint - it worked with projec~1. On the other hand, putting the path with space between the single quotes did not work.
However, since I will (later) also need to find and replace some text (using fart.exe) or any other similar utility, I would definitely need to use the double quotes, so I still need some solution for using them in the parameter field.
Anyway, at least I have managed to start the program with the help of your hint.
Post Reply