0
フォルダ内の最新のファイルを見つけて(クリップボードに)コピーするにはどうしたらいいですか?ここで最新のファイルをフォルダにコピーする
は、フォルダへのパスです:
/Users/myuser/Desktop/Screenshots
フォルダ内の最新のファイルを見つけて(クリップボードに)コピーするにはどうしたらいいですか?ここで最新のファイルをフォルダにコピーする
は、フォルダへのパスです:
/Users/myuser/Desktop/Screenshots
このお試しください:純粋のAppleScriptでクリップボードに画像をコピーするには
tell application "Finder" to set theFiles to sort (get files of folder "Screenshots" of desktop) by creation date
set the clipboard to last item of theFiles as alias
を面倒です。 AppleScriptObjC:
use framework "Foundation"
tell application "Finder" to set theFiles to sort (get files of folder "Screenshots" of desktop) by creation date
set imageFile to last item of theFiles as text
set theData to current application's NSData's dataWithContentsOfFile:(POSIX path of imageFile)
set pasteBoard to current application's NSPasteboard's generalPasteboard()
pasteBoard's clearContents()
pasteBoard's setData:theData forType:(current application's NSPasteboardTypeTIFF)
私のクリップボードは何も消去されていないようです。しかし、画像はクリップボードのように設定されていません。 – unska
オススメして申し訳ありません! – unska
ファイルの**コンテンツ**ではなく、最新のファイル*を(クリップボードに)コピーしました。イメージをコピーするには、AppleScriptObjC(Cocoa)から少しの助けが必要です。私は答えを更新しました。 – vadian