Question

I have the following snippet in a larger script:

--I think this should work…
--make new Finder window with properties {target:theWallpaperPosixFile}
set theWindow to make new Finder window
set target of theWindow to theWallpaperPosixFile

Why does the commented out line not work when I believe it should be functionally identical to the bottom line?

EDIT: To be clear, the code works as is. I'm missing something about with properties. My understanding from this as well as many other sites and the Finder Dictionary is that the 2 liner should be equivalent to the one liner. But it's not. It just pops open a new Finder window with no target.

So my question is specifically how to use with properties, not 'how to make it work'.

Was it helpful?

Solution

Try:

set wallpaperPaths to {POSIX path of (path to documents folder)} -- Example

repeat with wallpaperPath in wallpaperPaths
    set theWallpaperPosixFile to POSIX file (contents of wallpaperPath) as alias
    tell application "Finder" to set theWindow to make new Finder window to theWallpaperPosixFile
end repeat

EDIT

Look in the dictionary for Make in the Standard Suite:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top