how to make up Key Sequence with Data Driven?

Ranorex Spy, Recorder, and Studio.
dontbeshy
Posts: 9
Joined: Sun Sep 11, 2016 5:39 am

how to make up Key Sequence with Data Driven?

Post by dontbeshy » Sun Sep 11, 2016 7:13 am

Hi all,

I know I can type a command in putty using the action - Key Sequence.
But this action doesn't seem to accept a command string with "{}" parameters such as awk command

For example, I want to type this command in putty.

utility_name MM_DD_YYYY 0 0 | awk '{print $11;}'

Manual type in Key Sequence and a variable, none of them accept a string containing "{}" characters.


How to send the command with these characters?


I found a workaround. For example, create text files and each file has one command line.
Thru recording, open one notepad with text file, and copy and paste it on Putty window.
It works but I don't think it's a good way since I have to maintain text files manually.

Any ideas?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: how to make up Key Sequence with Data Driven?

Post by krstcs » Mon Sep 12, 2016 5:09 pm

Have you tried escaping the {} characters using a backslash?
\{\}
Shortcuts usually aren't...

dontbeshy
Posts: 9
Joined: Sun Sep 11, 2016 5:39 am

Re: how to make up Key Sequence with Data Driven?

Post by dontbeshy » Mon Sep 12, 2016 5:43 pm

It doesn't save a string either.

I tried like this:

utility_name 03_09_2016 | awk '\{ print $11; \}'

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: how to make up Key Sequence with Data Driven?

Post by asdf » Wed Sep 14, 2016 3:35 pm

Hi dontbeshy,

You could use the following line in a keysequence in order to achieve your intention.

Code: Select all

utility_name MM_DD_YYYY 0 0 | awk '{{print $11;}'
I hope this helps.

Sincerely,
asdf

dontbeshy
Posts: 9
Joined: Sun Sep 11, 2016 5:39 am

Re: how to make up Key Sequence with Data Driven?

Post by dontbeshy » Thu Sep 15, 2016 5:19 am

I found this link by chance.

http://www.ranorex.com/Documentation/Ra ... ress_8.htm

{ needs another { but } doesn't need another one.

Also I found out that " needs \ if we want to call this in code module.
For example,

In User Code,

Keyboard.Press(" my_utility 14_09_2016 0 0 | awk '{print "total: "$5;}' ");

Because of {, it should be like this

Keyboard.Press(" my_utility 14_09_2016 0 0 | awk '{{print "total: "$5;}' ");

But still build error because of " in the string. So it needs \ for "

Keyboard.Press(" my_utility 14_09_2016 0 0 | awk '{{print \"total: \"$5;}' ");

Then should be okay to build and run.



Thanks everyone.