オートメーション用のJavaScriptで遊んでいると、AppleScriptでは非常に単純なことはできません。 (ショッカーは、私が知っている。)オートメーション用のJavaScriptを使用してFinderですべてを選択解除
これはAppleScript:
tell application "Finder" to set selection to {}
は、Finderで選択をクリアします。
JXAで同じことをする方法がわかりません。ここで
は、私が試したものです:
var finder = Application("Finder")
finder.includeStandardAdditions = true
//this selects files in the front window...
finder.select([...array of file paths...])
//so you'd think this might work to deselect all...
finder.select([])
//...but it doesn't do anything
//then I tried each of these in turn...
finder.select(null)
//Error -10010: Handler can't handle objects of this class.
finder.selection = null
//Error -10010: Handler can't handle objects of this class.
finder.selection = []
//Script Editor crashes
//...but none were successful
任意の提案ですか?
(MacOSのシエラ、スクリプトエディタ2.9)
ええ、あなたの2番目の解決策は、私が行ったことです。そのようなハイブリッドは、最もエレガントではないかもしれませんが、ウィンドウを閉じて再オープンするよりも優れています。ありがとう! –