Navigate To Top-Most Finder Window In Open/Save Dialog throwing error
Title
Navigate To Top-Most Finder Window In Open/Save Dialog throwing error
What do you expect to happen when you run the script/macro?
Supposed to navigate to top most finder window in open/save dialog box
Are you seeing an error?
10.02.2023 13:54:03.62 [Backend]: [SF_FIREBASE_WS]: Sending keep-alive
10.02.2023 13:54:04.23 [Backend]: #StreamDeck: KeyDown (2,1) -> Navigate to top-most Finder window in Save/Open dialog
10.02.2023 13:54:04.23 [Backend]: >> Command: Navigate to top-most Finder window in Save/Open dialog [user:ckp49i4j60000a2100yfwywgf:ckoo6ffbb000syj109x8rtbts]
10.02.2023 13:54:04.68 [Backend]: !! Command Error: Navigate to top-most Finder window in Save/Open dialog [user:ckp49i4j60000a2100yfwywgf:ckoo6ffbb000syj109x8rtbts]:
Couldn't locate AxElementArrayIndexedItem (Navigate to top-most Finder window in Save/Open dialog: Line 17)
10.02.2023 13:54:04.68 [Backend]: << Command: Navigate to top-most Finder window in Save/Open dialog [user:ckp49i4j60000a2100yfwywgf:ckoo6ffbb000syj109x8rtbts]
What happens when you run this script?
Stops at a popup attempting to navigate folders
How were you running this script?
I used a Stream Deck button
How important is this issue to you?
3
Details
{
"inputExpected": "Supposed to navigate to top most finder window in open/save dialog box",
"inputIsError": true,
"inputError": "\n10.02.2023 13:54:03.62 [Backend]: [SF_FIREBASE_WS]: Sending keep-alive\n\n10.02.2023 13:54:04.23 [Backend]: #StreamDeck: KeyDown (2,1) -> Navigate to top-most Finder window in Save/Open dialog\n\n10.02.2023 13:54:04.23 [Backend]: >> Command: Navigate to top-most Finder window in Save/Open dialog [user:ckp49i4j60000a2100yfwywgf:ckoo6ffbb000syj109x8rtbts]\n\n10.02.2023 13:54:04.68 [Backend]: !! Command Error: Navigate to top-most Finder window in Save/Open dialog [user:ckp49i4j60000a2100yfwywgf:ckoo6ffbb000syj109x8rtbts]:\nCouldn't locate AxElementArrayIndexedItem (Navigate to top-most Finder window in Save/Open dialog: Line 17)\n\n\n10.02.2023 13:54:04.68 [Backend]: << Command: Navigate to top-most Finder window in Save/Open dialog [user:ckp49i4j60000a2100yfwywgf:ckoo6ffbb000syj109x8rtbts]\n\n",
"inputWhatHappens": "Stops at a popup attempting to navigate folders",
"inputHowRun": {
"key": "-MpfwmPg-2Sb-HxHQAff",
"title": "I used a Stream Deck button"
},
"inputImportance": 3,
"inputTitle": "Navigate To Top-Most Finder Window In Open/Save Dialog throwing error"
}
Source
function navigateTo(path) {
//Get a reference to the focused window in the frontmost app:
var win = sf.ui.frontmostApp.focusedWindow;
//Sanity check - make sure window is either Save or Open dialog
if (!(win.title.value.indexOf('Save') >= 0 || win.title.value.indexOf('Open') >= 0))
throw 'Focused window is not an Open or Save dialog. Title: ' + win.title.value;
//Open the Go to... sheet
sf.keyboard.type({ text: '/' });
//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"');
//Wait for sheet to close
win.sheets.first.elementWaitFor({ waitForNoElement: true, timeout: 500 }, '"Go to" sheet didn\'t close in time');
}
var folderPath;
try {
folderPath = decodeURIComponent(sf.appleScript.finder.selection.getItem(0).asItem.path);
} catch(err) {
folderPath = decodeURIComponent(sf.appleScript.finder.firstWindow.targetPath);
}
navigateTo(folderPath);
Links
User UID: bFjAgiBx9vf9EF9QDxr5s2xSx3E3
Feedback Key: sffeedback:bFjAgiBx9vf9EF9QDxr5s2xSx3E3:-NNwfs5sS1nL67PW1kEu
Ian Bodzasi @Ian_BodzasiHi @chrscheuer, you'd mentioned to tag you as I report a couple errors I've been getting. Will start separate threads for other similar scripts I'm having issues with. Thanks!