« [HTML]クリップボードにコピーボタン生成 | トップページ | ウニ »

[types]テキスト系の受け取り方

【スクリプトエディタで開く】|

#!/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 refMe : a reference to current application

##########################
###ペーストボード
##########################
set ocidPasteboard to refMe's NSPasteboard's generalPasteboard()
set ocidPastBoardTypeArray to ocidPasteboard's types
log ocidPastBoardTypeArray as list
######必要に応じて受け取る

if (ocidPastBoardTypeArray's containsObject:"public.html") is true then
  set ocidPublicHTML to ocidPasteboard's stringForType:"public.html"
end if

if (ocidPastBoardTypeArray's containsObject:"public.rtf") is true then
  set ocidPublicRTF to ocidPasteboard's stringForType:"public.rtf"
end if

if (ocidPastBoardTypeArray's containsObject:"public.utf8-plain-text") is true then
  set ocidPublicText to ocidPasteboard's stringForType:"public.utf8-plain-text"
end if

if (ocidPastBoardTypeArray's containsObject:"NSStringPboardType") is true then
  set ocidReadPasteboardTypeString to ocidPasteboard's stringForType:(refMe's NSPasteboardTypeString)
end if
##########################
###プレインテキストで
##########################
if (ocidPastBoardTypeArray's containsObject:"public.utf8-plain-text") is true then
  set ocidPublicText to ocidPasteboard's stringForType:"public.utf8-plain-text"
  set strPublicText to ocidPublicText as text
end if






|

« [HTML]クリップボードにコピーボタン生成 | トップページ | ウニ »

AppleScript NSPasteboard」カテゴリの記事