« [Acrobat]ユーザー情報を設定していない人に設定を促す | トップページ | [VK]VKビデオダウンロード »

[NSColor]カラーピッカーからのデータ 基本

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.5"
use framework "Foundation"
use framework "AppKit"
use scripting additions

global rgbValues


######ログ表示
doLogView()

property refMe : a reference to current application
property refNSString : a reference to refMe's NSString
property refNSColor : a reference to refMe's NSColor

property refNSNotFound : a reference to 9.22337203685477E+18 + 5807


-------RGB16bitColor16bitRGB値を格納
tell application "Finder"
set the listRGB16bitColor to (choose color default color {0, 0, 0, 1}) as list
end tell

##########Color Picker Value 16Bit
set numRcolor16Bit to item 1 of listRGB16bitColor as number
set numGcolor16Bit to item 2 of listRGB16bitColor as number
set numBcolor16Bit to item 3 of listRGB16bitColor as number
set numAcolor16Bit to 65535 as number

log numRcolor16Bit
log numGcolor16Bit
log numBcolor16Bit
log numAcolor16Bit

##########Standard RGB Value 8Bit
set numRcolor8Bit to numRcolor16Bit / 256 div 1 as number
set numGcolor8Bit to numGcolor16Bit / 256 div 1 as number
set numBcolor8Bit to numBcolor16Bit / 256 div 1 as number
set numAcolor8Bit to numAcolor16Bit / 256 div 1 as number

log numRcolor8Bit
log numGcolor8Bit
log numBcolor8Bit
log numAcolor8Bit

##########NSColorValue Float
set numRcolorFloat to numRcolor8Bit / 255 as number
set numGcolorFloat to numGcolor8Bit / 255 as number
set numBcolorFloat to numBcolor8Bit / 255 as number
set numAcolorFloat to numAcolor8Bit / 255 as number

log numRcolorFloat
log numGcolorFloat
log numBcolorFloat
log numAcolorFloat


set ocidColor to refNSColor's colorWithRed:numRcolorFloat green:numGcolorFloat blue:numBcolorFloat alpha:numAcolorFloat
log ocidColor
log className() of ocidColor as text
log ocidColor's redComponent()
log ocidColor's greenComponent()
log ocidColor's blueComponent()
log ocidColor's alphaComponent()

set ocidDeviceColor to refNSColor's colorWithDeviceRed:numRcolorFloat green:numGcolorFloat blue:numBcolorFloat alpha:numAcolorFloat
log ocidDeviceColor
log className() of ocidDeviceColor as text
log ocidDeviceColor's redComponent()
log ocidDeviceColor's greenComponent()
log ocidDeviceColor's blueComponent()
log ocidDeviceColor's alphaComponent()

set ocidSRGBColor to refNSColor's colorWithSRGBRed:numRcolorFloat green:numGcolorFloat blue:numBcolorFloat alpha:numAcolorFloat
log ocidSRGBColor
log className() of ocidSRGBColor as text
log ocidSRGBColor's redComponent()
log ocidSRGBColor's greenComponent()
log ocidSRGBColor's blueComponent()
log ocidSRGBColor's alphaComponent()

set ocidDisplayP3Color to refNSColor's colorWithDisplayP3Red:numRcolorFloat green:numGcolorFloat blue:numBcolorFloat alpha:numAcolorFloat
log ocidDisplayP3Color
log className() of ocidDisplayP3Color as text
log ocidDisplayP3Color's redComponent()
log ocidDisplayP3Color's greenComponent()
log ocidDisplayP3Color's blueComponent()
log ocidDisplayP3Color's alphaComponent()






#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
tell application "Script Editor"
tell application "System Events"
tell process "Script Editor"
tell window 1
tell splitter group 1
tell splitter group 1
tell group 1
tell checkbox "返された値"
set boolValue to value as boolean
end tell
if boolValue is false then
click checkbox "返された値"
end if
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end if
end repeat

end doLogView
#########################

|

« [Acrobat]ユーザー情報を設定していない人に設定を促す | トップページ | [VK]VKビデオダウンロード »

AppleScript Color」カテゴリの記事