Use variable to creat path and save

I have a half code of i need. I will explain:

I need go to some web page, click to print as PDF, select the folder, type the archive name and press same.
Now, i have a half of this, my code is:

WebUI.navigateToUrl(‘https://www.google.com.br/’)

Robot robot = new Robot();

robot.keyPress(KeyEvent.VK_CONTROL)
robot.keyPress(KeyEvent.VK_P)
robot.keyRelease(KeyEvent.VK_P)
robot.keyRelease(KeyEvent.VK_CONTROL)

robot.delay(4000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);

robot.delay(2000);
robot.keyPress(KeyEvent.VK_X);
robot.keyRelease(KeyEvent.VK_X);

robot.delay(2000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);

With this code, i press “CTRL + P”, press “ENTER”, type “X” in name of archive and press “ENTER”.

But i don’t know how i can type a name for this archive and how to choice the custom path.

Now, i need save my archive with name “X”, because i tell the robot to press “X”, but i want to change this for one word. In Arduino, i use a code like this:

To press a key, i use: Keyboard.release(KEY_LEFT_CTRL);
To type a text, i use: Keyboard.println(“My text here”);

But i don’t know what i do in katalon to type a text and not only a single keyboard key.


My question is:

1 - How i can type a text with robot and not only one key per time?
2 - How i can choice the save path in the code, like a string, and not in the katalon config?

Because i need save each printed page in one path. Thanks.

hello,

check this page

Works great. Thank you!