« [Image Events]FileとAliasによる挙動 | トップページ | [COPIC]スウォッチ »

[プレビュー]ファイル名順にして開き直す

うーん他に何かいい方法ないんか…

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSMutableArray : a reference to objMe's NSMutableArray


(*
tell application "Preview"
set listEveryDoc to every document
log "listEveryDoc"
log listEveryDoc
end tell



tell application "Preview"
set listEveryDocName to name of every document
log "name"
log listEveryDocName
end tell

tell application "Preview"
set listEveryDocPath to path of every document
log "path"
log listEveryDocPath
end tell

log listEveryDocPath
*)
######
tell application "Preview"
set listEveryDocPath to path of every document
log "path"
log listEveryDocPath
activate
end tell

if listEveryDocPath is {} then
return "ドキュメントを開いていません"
end if


###可変リストに変更
set ocidNSArrayM to (objNSMutableArray's arrayWithArray:listEveryDocPath)
###並び替え
set ocidSortedArray to (ocidNSArrayM's sortedArrayUsingSelector:"compare:")
###ocidアレイ を リストに変換
set listSortedArray to ocidSortedArray as list

#tell application "Preview"
#activate
#tell application "System Events"
#keystroke "W" using {command down}
#end tell
#end tell
#return

tell application "Preview"
close every document
end tell

tell application "Preview"
tell window 1
####同じウィンドウで
####ファイル名順に開き直す
open listSortedArray
end tell
end tell

|

« [Image Events]FileとAliasによる挙動 | トップページ | [COPIC]スウォッチ »

AppleScript Preview」カテゴリの記事

AppleScript Sort」カテゴリの記事