Have reached out to Jon at St. Clair Software but does anyone have any ideas on this?
The volume is WebDAV mounted.
What I am trying to achieve. Users access this WebDAV volume. When saving a Preview file need to jump to the correct folder on mounted drive.
I have created a work around by using AS script to access Default Folder X Favourites but this relies on correct ordering of the folders and is not exportable without having to recreate Favourites on each individual Mac.
tell application "Finder"
set diskList to disks
repeat with theDisk in diskList
set contents of theDisk to (contents of theDisk) as alias
end repeat
diskList
end tell
You didn't actually use the path in your script -- you set it in KM, "imported" it into the AppleScript, but used a different value for SwitchToFolder.
I don't have Default Folder X, but the examples on their website separate setting the path from calling SwitchToFolder. It shouldn't make a difference, but you could try setting an explicit file object by changing the AppleScript in your last macro to:
set inst to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
set goToPath to get variable "Local__GoToPath" -- I'm assuming 2 underscores in there?
end tell
set theFolder to POSIX file goToPath
tell application "Default Folder X"
SwitchToFolder theFolder
end tell
And, unless this is part of something bigger and you earlier got (or later need) the full path, the Parent Path Filter action is unnecessary -- just use /Volumes/77.103.226.111 when you set your variable.
As with Chris's tests, make sure you're connected to the WebDav volume, but have no Finder windows open, and then try:
tell application "Finder"
open POSIX file "/Volumes/77.103.226.111"
end tell
...in Script Editor/Script Debugger. That should pop a Finder window showing the root directory of the share, which will prove things are properly mounted/accessible.
This works great when switching folders from the Default Fold X interface so big thanks.
set webDavDiskAlias to alias "77.103.226.111:VW Files 2023:HT H Tiddy"
tell application "Default Folder X"
SwitchToFolder webDavDiskAlias
end tell
It does not work when the DFX dialog is not in use. The DFX Favourites menu is available but I would like to be able to switch folders using AS script in similar fashion to above solution. My original solution was to use script below to access DFX Favourites menu and then change the repeat to select correct folder. But is there a simpler way? (Folders are living on webdav mounted volume but is there a way to script so does not matter if local or mounted volume?
repeat x times
key code 124
end repeat
tell application "System Events"
tell application process "Default Folder X"
tell menu bar 2
tell menu bar item 1
try
with timeout of 0.01 seconds
perform action "AXPress"
end timeout
end try
end tell
end tell
end tell
end tell
do shell script "killall 'System Events'"
tell application "System Events"
repeat 6 times
key code 125
end repeat
key code 124
end tell
By the way Chris - thank you for your patience! Worked out how to paste AS script. Easy peasey
In Finder, or Forklift I just want to be able to switch folders without using the DFX Favorites menu as other users are switch folders constantly.
Also, slight off topic. The original AS was part of a macro that saves email attachments to specified folders and then goes on to a Job Entry Macro.
In testing command Save does not open DFX dialog box. Tried Save as… and macros work fine but then Preview becomes completely unresponsive to mouse clicks, couldn't close the open file, and could not even quit from menu. Had to use Activity monitor which showed Preview cpu use jacking up to 99%. However, if I used Export as pdf macro runs fine and Preview works fine.
Bit weird - just mention as who knows might crop up for someone sometime in the future.
# Path-To based alias form:
set targetFolderAlias to alias ((path to downloads folder as text) & "Test Folder in Downloads:")
tell application "Finder"
activate
open targetFolderAlias
end tell
--------------------------------------------------------
use AppleScript version "2.4" --» Yosemite or later
use framework "Foundation"
use scripting additions
--------------------------------------------------------
# Posix Path or Home-Based (Tilde) Posix Path:
set targetFolderPath to "~/Downloads/Test Folder in Downloads/"
set targetFolderPath to ((current application's NSString's stringWithString:targetFolderPath)'s stringByExpandingTildeInPath) as text
set targetFolderAlias to alias POSIX file targetFolderPath
tell application "Finder"
activate
open targetFolderAlias
end tell
--------------------------------------------------------
Forklift's AppleScript dictionary is brain-dead but not entirely useless.
This script will operate on the currently selected pane.
--------------------------------------------------------
use AppleScript version "2.4" --» Yosemite or later
use framework "Foundation"
use scripting additions
--------------------------------------------------------
# Posix Path or Home-Based (Tilde) Posix Path:
set targetFolderPath to "~/Downloads/Test Folder in Downloads/"
set targetFolderPath to ((current application's NSString's stringWithString:targetFolderPath)'s stringByExpandingTildeInPath) as text
set targetFolderAlias to alias POSIX file targetFolderPath
tell application "ForkLift"
reveal path targetFolderAlias
end tell
--------------------------------------------------------