Navigate To Folder of Current Session Monterey Bug
This script which is now part of SF (Navigate to Folder of Current Session) is broken in Monterey Open/Save dialogs.
Monterey has a different navigator than previous OS's when you type a /
slash in any Open/Save dialog.

The following code does not work in Monterey
//Wait for the sheet to appear
var sheet = win.sheets.first.elementWaitFor({ timeout: 500 }, 'Could not find "Go to" sheet in the Save/Open dialog').element;
//Set the value of the combo box
sheet.comboBoxes.first.value.value = path;
//Press OK
sheet.buttons.whoseTitle.is('Go').first.elementClick({}, 'Could not click "Go"');
It could be rewritten like this, but if you guys have a better understanding of the new dialog in Monterey, please show us the way!
//Wait for the sheet to appear
var sheet = win.sheets.first.elementWaitFor({ timeout: 500 }, 'Could not find "Go to" sheet in the Save/Open dialog').element;
//Set the value of the combo box
if (sheet.comboBoxes.first.exists) {
// For OS prior to Monterey
sheet.comboBoxes.first.value.value = path;
sheet.buttons.whoseTitle.is('Go').first.elementClick({}, 'Could not click "Go"');
} else {
// For Monterey or later
sheet.textFields.whoseValue.is("/").first.value.value = path;
sf.keyboard.press({keys: "numpad enter"});
}
Linked from:
- Andrew Scheps @Andrew_Scheps
That's the right way to do it. In Monterey they changed the combo box to a text field. The only other thing I would do is change the pre-Monterey code to also type Enter instead of clicking the "Go" button. This will ensure it will work on non-English operating systems where that button isn't labelled "Go"
- MMatt Friedman @Matt_Friedman
Thanks for the reply Andrew!
So updated my code would look more like:
//Wait for the sheet to appear var sheet = win.sheets.first.elementWaitFor({ timeout: 500 }, 'Could not find "Go to" sheet in the Save/Open dialog').element; //Set the value of the combo box if (sheet.comboBoxes.first.exists) { //For OS prior to Monterey sheet.comboBoxes.first.value.value = path; } else { //For Monterey or later sheet.textFields.whoseValue.is("/").first.value.value = path; } //Press OK sf.keyboard.press({keys: "numpad enter"});
Andrew Scheps @Andrew_Scheps
That should work