0
그래서 나는 이에 대한 해답을 찾고 있으며 운이 없었습니다. Mac Automation의 JXA를 사용하여 파일을 휴지통으로 보낼 수 있습니까?Mac OS X에서 JXA로 휴지통으로 보내기
// set startup applications that this script will use
var app = Application.currentApplication()
var finder = Application("Finder");
app.includeStandardAdditions = true
function openDocuments(droppedItems)
{
// Variables
var AllFiles = [] // array to store all files in.
for (var item of droppedItems)
{
AllFiles.push(item) // load each file into array
}
// go through each file in the list
for (var i = 0; i < AllFiles.length; i ++)
{
// move to the trash
finder.move(Path(AllFiles[i]), {
to: Path("/Users/usr/.trash"),
replacing: true
})
}
}
이 나는 그게 내가 휴지통으로에 드롭 어떤 파일 전송해야 건물입니다 단지 테스트이지만, 유효한 폴더 위치로 .trash 인식하지 않습니다 내 간단한 테스트 코드는 다음과 같습니다. 나는 다른 폴더와 그것을 테스트하고 그 작동하지 않습니다. 그래서 .trash가 잠겨 있다고 가정입니다.
그래서 이것을 시도했지만 "형식을 변환 할 수 없습니다"라는 오류가 발생합니다. 나는 또한 그것의 숨겨진 폴더 때문에 .trash로 그것을 시도했다. pathTo가 답이 될 수 있습니다. 적절한 파일 경로를 반환 할 수 있는지 알 수 있습니다. –
맞습니다. 코드를 업데이트했습니다. – unlocked2412