Hi @jaher.manrique1,
This is an interesting scenario, thanks for sharing with us. Unfortunately, we don’t have any official support to make this use case easy in Studio. However, here are a few solutions you can try:
Option 1: Pre-configure browser download location
- Chrome: Settings > Advanced > Downloads > Change location to your target folder
- This makes Ctrl+S default to your chosen directory
Option 2: Adjust the robot script (AI recommended, pls check for mistakes)
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_CONTROL);
Thread.sleep(1000); // Wait for dialog
// Generate unique file name
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss"));
String filePath = "C:\\Users\\YourName\\Documents\\file_" + timestamp + ".txt";
// Type file path
for (char c : filePath.toCharArray()) {
int keyCode = KeyEvent.getExtendedKeyCodeForChar(c);
if (KeyEvent.CHAR_UNDEFINED == keyCode) continue;
robot.keyPress(keyCode);
robot.keyRelease(keyCode);
Thread.sleep(50);
}
// Press Enter to save
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
Hope that this would help ![]()