●メニューへ ●単福へ ●自動車の維持費をシミュレーション ●InDesign JavaScript ノート

action/実行


on run {act1, act2}
	set act1 to act1 as text
	set act2 to act2 as text
	tell application "Adobe Photoshop 7.0"
		tell document 1
			do action act2 from act1
		end tell
	end tell
	return "true"
end run
	


TOPへ


channel/削除


on run {}
	tell application "Adobe Photoshop 7.0"
		tell document 1
			set countNum to count channel
			repeat with N from 0 to countNum - 4
				set num to countNum - N
				if kind of channel num is not component channel then
					delete channel num
				end if
			end repeat
		end tell
	end tell
	return "true"
end run
	


TOPへ


document/open


tell application "Adobe Photoshop 7.0"
	open "Macintosh HD:1.eps" --showing dialogs never
end tell
	


TOPへ


document/カラーモード


on run {myMode}
	set myMode to myMode as text
	tell application "Adobe Photoshop 7.0"
		tell document 1
			if myMode is not "0" then
				if myMode is "grayscale" then --///////
					change mode to grayscale
				else if myMode is "RGB" then
					change mode to RGB
				else if myMode is "CMYK" then
					change mode to CMYK
				else if myMode is "Lab" then
					change mode to Lab
				else if myMode is "bitmap" then
					change mode to bitmap
				else if myMode is "indexed color" then
					change mode to indexed color
				else if myMode is "multichannel" then
					change mode to multichannel
				else if myMode is "duotone" then
					change mode to duotone
				end if
			end if
		end tell
	end tell
	return "true"
end run
	


TOPへ


document/リサイズ


on run {H1, W1, RES, MHD}
	set H1 to H1 as real
	set W1 to W1 as real
	set RES to RES as real
	set MHD to MHD as text
	tell application "Adobe Photoshop 7.0"
		if MHD is "closest neighbor" then --closest neighborニアレスドライバー
			set MHD2 to closest neighbor
		else if MHD = "bilinear" then --bilinearバイリニア
			set MHD2 to bilinear
		else if MHD = "bicubic" then --bicubic]バイキュービック
			set MHD2 to bicubic
		else if MHD = "none" then --bicubic]バイキュービック
			set MHD2 to none
		end if
		tell document 1
			if W1 is not 0 then --幅のリサイズ
				if RES is not 0 then
					resize image 1 width W1 resolution RES resample method MHD2
				else
					resize image 1 width W1 resample method MHD2
				end if
			else if H1 is not 0 then --高さのリサイズ
				if RES is not 0 then
					resize image 1 height H1 resolution RES resample method MHD2
				else
					resize image 1 height H1 resample method MHD2
				end if
			else
				resize image 1 resolution RES resample method MHD2
			end if
			--noneなし/closest neighborニアレスドライバー/bilinearバイリニア/bicubic]バイキュービック
		end tell
	end tell
	return "true"
end run
	


TOPへ


document/リサイズmillimeters


on run {H1, W1, RES, MHD}
	set H1 to H1 as real
	set W1 to W1 as real
	set RES to RES as real
	set MHD to MHD as text
	tell application "Adobe Photoshop 7.0"
		if MHD is "closest neighbor" then --closest neighborニアレスドライバー
			set MHD2 to closest neighbor
		else if MHD = "bilinear" then --bilinearバイリニア
			set MHD2 to bilinear
		else if MHD = "bicubic" then --bicubic]バイキュービック
			set MHD2 to bicubic
		else if MHD = "none" then --bicubic]バイキュービック
			set MHD2 to none
		end if
		tell document 1
			if W1 is not 0 then --幅のリサイズ
				if RES is not 0 then
					resize image 1 width millimeters W1 resolution RES resample method MHD2
				else
					resize image 1 width millimeters W1 resample method MHD2
				end if
			else if H1 is not 0 then --高さのリサイズ
				if RES is not 0 then
					resize image 1 height millimeters H1 resolution RES resample method MHD2
				else
					resize image 1 height millimeters H1 resample method MHD2
				end if
			else
				resize image 1 resolution RES resample method MHD2
			end if
			--noneなし/closest neighborニアレスドライバー/bilinearバイリニア/bicubic]バイキュービック
		end tell
	end tell
	return "true"
end run
	


TOPへ


document/情報を調べる


tell application "Adobe Photoshop 7.0"
		tell document 1
			--get properties
			set myMode to mode --画像モードを調べる
			set num to number of art layer --でレイヤーの数を調べることもできる
			--flatten --レイヤーを統合
			set RSL to resolution --で解像度を調べる。dpiで返ってくる
			set H1 to height
			set W1 to width
			set H1mm to height as millimeters
			set W1mm to width as millimeters
			set Fname to name
		end tell
	end tell
	


TOPへ


save/DCS1


on run {saveF, EMB, DCSs, ENC, HAL, IMA, PRE, TRA, VEC}
	set saveF to saveF as text
	set EMB to EMB as number
	set DCSs to DCSs as text
	set ENC to ENC as text
	set HAL to HAL as number
	set IMA to IMA as number
	set PRE to PRE as text
	set TRA to TRA as number
	set VEC to VEC as number
	tell application "Adobe Photoshop 7.0"
		set OPTrec to {class:Photoshop DCS 1.0 save options} as record
		if EMB is 1 then
			set REC to {embed color profile:true} as record
			set OPTrec to OPTrec & REC
		else if EMB is 0 then
			set REC to {embed color profile:false} as record
			set OPTrec to OPTrec & REC
		end if
		--DCS  no composite PostScript/grayscale composite/color composite
		if DCSs is "no composite PostScript" then
			set REC to {DCS:no composite PostScript} as record
		else if DCSs is "grayscale composite" then
			set REC to {DCS:grayscale composite} as record
		else if DCSs is "color composite" then
			set REC to {DCS:color composite} as record
		end if
		set OPTrec to OPTrec & REC
		--encoding  ASCII/binary/low quality JPEG/medium quality JPEG/high quality JPEG/maximum quality JPEG  -- type of encoding to use for document
		if ENC is "ASCII" then
			set REC to {encoding:ASCII} as record
		else if ENC is "binary" then
			set REC to {encoding:binary} as record
		else if ENC is "low quality JPEG" then
			set REC to {encoding:low quality JPEG} as record
		else if ENC is "medium quality JPEG" then
			set REC to {encoding:medium quality JPEG} as record
		else if ENC is "high quality JPEG" then
			set REC to {encoding:high quality JPEG} as record
		else if ENC is "maximum quality JPEG" then
			set REC to {encoding:maximum quality JPEG} as record
		end if
		set OPTrec to OPTrec & REC
		--halftone screen  boolean  -- include halftone screen
		if HAL is 1 then
			set REC to {halftone screen:true} as record
		else if HAL is 0 then
			set REC to {halftone screen:false} as record
		end if
		set OPTrec to OPTrec & REC
		--image interpolation  boolean  -- use image interpolation
		if IMA is 1 then
			set REC to {image interpolation:true} as record
		else if IMA is 0 then
			set REC to {image interpolation:false} as record
		end if
		set OPTrec to OPTrec & REC
		--preview type  none/monochrome TIFF/eight bit TIFF/monochrome Mac OS/eight bit Mac OS/JPEG Mac OS  -- type of preview
		if PRE is "none" then
			set REC to {preview type:none} as record
		else if PRE is "monochrome TIFF" then
			set REC to {preview type:monochrome TIFF} as record
		else if PRE is "eight bit TIFF" then
			set REC to {preview type:eight bit TIFF} as record
		else if PRE is "monochrome Mac OS" then
			set REC to {preview type:monochrome Mac OS} as record
		else if PRE is "eight bit Mac OS" then
			set REC to {preview type:eight bit Mac OS} as record
		else if PRE is "JPEG Mac OS" then
			set REC to {preview type:JPEG Mac OS} as record
		end if
		set OPTrec to OPTrec & REC
		--transfer function  boolean  -- include transfer functions in document
		if TRA is 1 then
			set REC to {transfer function:true} as record
		else if TRA is 0 then
			set REC to {transfer function:false} as record
		end if
		set OPTrec to OPTrec & REC
		--vector data  boolean  -- include vector data
		if VEC is 1 then
			set REC to {vector data:true} as record
		else if VEC is 0 then
			set REC to {vector data:false} as record
		end if
		set OPTrec to OPTrec & REC
		save document 1 in saveF as Photoshop DCS 1.0 with options OPTrec
	end tell
end run
(*

	DCS  no composite PostScript/grayscale composite/color composite
	embed color profile  boolean  -- embed color profile in document
	encoding  ASCII/binary/low quality JPEG/medium quality JPEG/high quality JPEG/maximum quality JPEG  -- type of encoding to use for document
	halftone screen  boolean  -- include halftone screen
	image interpolation  boolean  -- use image interpolation
	preview type  none/monochrome TIFF/eight bit TIFF/monochrome Mac OS/eight bit Mac OS/JPEG Mac OS  -- type of preview	transfer function  boolean  -- include transfer functions in document
	vector data  boolean  -- include vector data
*)
	


TOPへ


save/DCS2


on run {saveF, EMB, DCSs, ENC, HAL, IMA, MUL, PRE, SAV, TRA, VEC}
	set saveF to saveF as text
	set EMB to EMB as number
	set DCSs to DCSs as text
	set ENC to ENC as text
	set HAL to HAL as number
	set IMA to IMA as number
	set MUL to MUL as number
	set PRE to PRE as text
	set SAV to SAV as number
	set TRA to TRA as number
	set VEC to VEC as number
	tell application "Adobe Photoshop 7.0"
		set OPTrec to {class:Photoshop DCS 2.0 save options} as record
		if EMB is 1 then
			set REC to {embed color profile:true} as record
			set OPTrec to OPTrec & REC
		else if EMB is 0 then
			set REC to {embed color profile:false} as record
			set OPTrec to OPTrec & REC
		end if
		--DCS  no composite PostScript/grayscale composite/color composite
		if DCSs is "no composite PostScript" then
			set REC to {DCS:no composite PostScript} as record
		else if DCSs is "grayscale composite" then
			set REC to {DCS:grayscale composite} as record
		else if DCSs is "color composite" then
			set REC to {DCS:color composite} as record
		end if
		set OPTrec to OPTrec & REC
		--encoding  ASCII/binary/low quality JPEG/medium quality JPEG/high quality JPEG/maximum quality JPEG  -- type of encoding to use for document
		if ENC is "ASCII" then
			set REC to {encoding:ASCII} as record
		else if ENC is "binary" then
			set REC to {encoding:binary} as record
		else if ENC is "low quality JPEG" then
			set REC to {encoding:low quality JPEG} as record
		else if ENC is "medium quality JPEG" then
			set REC to {encoding:medium quality JPEG} as record
		else if ENC is "high quality JPEG" then
			set REC to {encoding:high quality JPEG} as record
		else if ENC is "maximum quality JPEG" then
			set REC to {encoding:maximum quality JPEG} as record
		end if
		set OPTrec to OPTrec & REC
		--halftone screen  boolean  -- include halftone screen
		if HAL is 1 then
			set REC to {halftone screen:true} as record
		else if HAL is 0 then
			set REC to {halftone screen:false} as record
		end if
		set OPTrec to OPTrec & REC
		--image interpolation  boolean  -- use image interpolation
		if IMA is 1 then
			set REC to {image interpolation:true} as record
		else if IMA is 0 then
			set REC to {image interpolation:false} as record
		end if
		set OPTrec to OPTrec & REC
		--multifile DCS  boolean
		if MUL is 1 then
			set REC to {multifile DCS:true} as record
		else if MUL is 0 then
			set REC to {multifile DCS:false} as record
		end if
		set OPTrec to OPTrec & REC
		--preview type  none/monochrome TIFF/eight bit TIFF/monochrome Mac OS/eight bit Mac OS/JPEG Mac OS  -- type of preview
		if PRE is "none" then
			set REC to {preview type:none} as record
		else if PRE is "monochrome TIFF" then
			set REC to {preview type:monochrome TIFF} as record
		else if PRE is "eight bit TIFF" then
			set REC to {preview type:eight bit TIFF} as record		else if PRE is "monochrome Mac OS" then
			set REC to {preview type:monochrome Mac OS} as record
		else if PRE is "eight bit Mac OS" then
			set REC to {preview type:eight bit Mac OS} as record
		else if PRE is "JPEG Mac OS" then
			set REC to {preview type:JPEG Mac OS} as record
		end if
		set OPTrec to OPTrec & REC
		
		--transfer function  boolean  -- include transfer functions in document
		if TRA is 1 then
			set REC to {transfer function:true} as record
		else if TRA is 0 then
			set REC to {transfer function:false} as record
		end if
		set OPTrec to OPTrec & REC
		--vector data  boolean  -- include vector data
		if VEC is 1 then
			set REC to {vector data:true} as record
		else if VEC is 0 then
			set REC to {vector data:false} as record
		end if
		set OPTrec to OPTrec & REC
		save document 1 in saveF as Photoshop DCS 2.0 with options OPTrec
	end tell
end run
(*

	DCS  no composite PostScript/grayscale composite/color composite
	embed color profile  boolean  -- embed color profile in document
	encoding  ASCII/binary/low quality JPEG/medium quality JPEG/high quality JPEG/maximum quality JPEG  -- type of encoding to use for document
	halftone screen  boolean  -- include halftone screen
	image interpolation  boolean  -- use image interpolation
	multifile DCS  boolean
	preview type  none/monochrome TIFF/eight bit TIFF/monochrome Mac OS/eight bit Mac OS/JPEG Mac OS  -- type of preview
	save spot colors  boolean  -- save spot colors
	transfer function  boolean  -- include transfer functions in document
	vector data  boolean  -- include vector data


*)
	


TOPへ


save/EPS


on run {saveF, EMB, ENC, HRF, iiP, PSC, PRV, TRV, TRW, VD}
	--EMBカラープロファイル
	--ENCエンコーディング
	--HRFハーフトーンスクリーン
	--iiP use image interpolationイメージ書き入れ?画像補完形式か
	--PSCポストスクリプトカラーマネジメント
	--PRVプレヴュー
	--TRV--トランスファ関数
	--TRW --白を透明に only valid when saving BitMap documents
	--VD--ベクトルデータを含める
	(*set saveF to "Macintosh HD:1.eps" as text
set EMB to 0
set ENC to "binary"
set HRF to 0
set iiP to 0
set PSC to 0
set PRV to "JPEG Mac OS"
set TRV to 1
set TRW to 0
set VD to 0*)
	(*set saveF to "Macintosh HD:Desktop Folder:test:101131A"
set EMB to 0
set ENC to "medium quality JPEG"
set HRF to 0
set iiP to 0
set PSC to 0
set PRV to "eight bit Mac OS"
set TRV to 0
set TRW to 0
set VD to 0*)
	
	set saveF to saveF as text
	set EMB to EMB as number
	set ENC to ENC as text
	set HRF to HRF as number
	set iiP to iiP as number
	set PSC to PSC as number
	set PRV to PRV as text
	set TRV to TRV as number
	set TRW to TRW as number
	set VD to VD as number
	
	tell application "Adobe Photoshop 7.0"
		set OPTrec to {class:EPS save options} as record
		if EMB is 1 then
			set REC to {embed color profile:true} as record
		else if EMB is 0 then
			set REC to {embed color profile:false} as record
		end if
		set OPTrec to OPTrec & REC
		
		--encoding  ASCII/binary/low quality JPEG/medium quality JPEG/high quality JPEG/maximum quality JPEG 
		if ENC is "ASCII" then
			set REC to {encoding:ASCII} as record
		else if ENC is "binary" then
			set REC to {encoding:binary} as record
		else if ENC is "low quality JPEG" then
			set REC to {encoding:low quality JPEG} as record
		else if ENC is "medium quality JPEG" then
			set REC to {encoding:medium quality JPEG} as record
		else if ENC is "high quality JPEG" then
			set REC to {encoding:high quality JPEG} as record
		else if ENC is "maximum quality JPEG " then
			set REC to {encoding:maximum quality JPEG} as record
		end if
		set OPTrec to OPTrec & REC
		
		--halftone screen  boolean  -- include halftone screen
		if HRF is 1 then
			set REC to {halftone screen:true} as record
		else if HRF is 0 then
			set REC to {halftone screen:false} as record
		end if
		set OPTrec to OPTrec & REC
		
		--image interpolation  boolean  -- use image interpolationイメージ書き入れ?
		if iiP is 1 then
			set REC to {image interpolation:true} as record
		else if iiP is 0 then
			set REC to {image interpolation:false} as record
		end if
		set OPTrec to OPTrec & REC
		--PostScript color management  boolean  -- use Postscript color management
		if PSC is 1 then
			set REC to {PostScript color management:true} as record
		else if PSC is 0 then
			set REC to {PostScript color management:false} as record
		end if
		set OPTrec to OPTrec & REC
		
		--preview type  none/monochrome TIFF/eight bit TIFF/monochrome Mac OS/eight bit Mac OS/JPEG Mac OS  -- type of preview
		if PRV is "none" then
			set REC to {preview type:none} as record
		else if PRV is "monochrome TIFF" then
			set REC to {preview type:monochrome TIFF} as record
		else if PRV is "eight bit TIFF" then
			set REC to {preview type:eight bit TIFF} as record
		else if PRV is "monochrome Mac OS" then
			set REC to {preview type:monochrome Mac OS} as record
		else if PRV is "eight bit Mac OS" then
			set REC to {preview type:eight bit Mac OS} as record
		else if PRV is "JPEG Mac OS" then
			set REC to {preview type:JPEG Mac OS} as record
		end if
		set OPTrec to OPTrec & REC
		--transfer function  boolean  -- include transfer functions in document
		if TRV is 1 then
			set REC to {transfer function:true} as record
		else if TRV is 0 then
			set REC to {transfer function:false} as record
		end if
		set OPTrec to OPTrec & REC
		--transparent whites  boolean  -- only valid when saving BitMap documents
		if TRW is 1 then
			set REC to {transparent whites:true} as record
		else if TRW is 0 then
			set REC to {transparent whites:false} as record
		end if
		set OPTrec to OPTrec & REC
		--vector data  boolean  -- include vector data
		if VD is 1 then
			set REC to {vector data:true} as record
		else if VD is 0 then
			set REC to {vector data:false} as record
		end if
		set OPTrec to OPTrec & REC
		
		--get EPSOPTrec
		save document 1 in saveF as Photoshop EPS with options OPTrec
		--save document 1 in saveF as Photoshop EPS with options {class:EPS save options, encoding:binary, preview type:JPEG Mac OS}
	end tell
	
	return "true"
end run
	


TOPへ


save/JPG


on run {saveF, EMB, FMT, MAT, Qnum, Snum}
	
	set saveF to saveF as text
	set EMB to EMB as number
	set MAT to MAT as text
	set FMT to FMT as text
	set Qnum to Qnum as number
	set Snum to Snum as number
	tell application "Adobe Photoshop 7.0"
		set OPTrec to {class:JPEG save options} as record
		if EMB is 1 then
			set REC to {embed color profile:true} as record
			set OPTrec to OPTrec & REC
		else if EMB is 0 then
			set REC to {embed color profile:false} as record
			set OPTrec to OPTrec & REC
		end if
		
		--format options  standard/optimized/progressive
		if FMT is "ベースライン(標準)" then
			set REC to {format options:standard} as record
		else if FMT is "ベースライン(最適化)" then
			set REC to {format options:optimized} as record
		else if FMT is "プログレッシブ " then
			set REC to {format options:progressive} as record
		end if
		set OPTrec to OPTrec & REC
		
		--matte  none/foreground color matte/background color matte/white matte/black matte/semi gray/Netscape gray
		if MAT is "なし" then
			set REC to {matte:none} as record
		else if MAT is "描画色" then
			set REC to {matte:foreground color matte} as record
		else if MAT is "背景色" then
			set REC to {matte:background color matte} as record
		else if MAT is "ホワイト" then
			set REC to {matte:white matte} as record
		else if MAT is "ブラック" then
			set REC to {matte:black matte} as record
		else if MAT is "50% グレー" then
			set REC to {matte:semi gray} as record
		else if MAT is "Netscape グレー" then
			set REC to {matte:Netscape gray} as record
		end if
		set OPTrec to OPTrec & REC
		
		--quality  integer  -- quality of produced image (0-12)
		set REC to {quality:Qnum} as record
		set OPTrec to OPTrec & REC
		
		--scans  integer  -- number of scans. Only valid for progressive type JPEG files (value should be: 3, 4 or 5)
		if Snum > 2 then
			set scans to {quality:Snum} as record
			set OPTrec to OPTrec & REC
		end if
		
		save document 1 in saveF as JPEG with options OPTrec
		--save document 1 in saveF as Photoshop format-- with options {class:EPS save options, encoding:binary, preview type:JPEG Mac OS}
	end tell
end run


(*
	embed color profile  boolean  -- embed color profile in document
	format options  standard/optimized/progressive
	matte  none/foreground color matte/background color matte/white matte/black matte/semi gray/Netscape gray
	quality  integer  -- quality of produced image (0-12)
	scans  integer  -- number of scans. Only valid for progressive type JPEG files (value should be: 3, 4 or 5)
*)
	


TOPへ


save/PDF


on run {saveF, EMB, Qnum, TRN, IMG, DWN, VCT, FNT, OUT}
    
    set saveF to saveF as text
    set EMB to EMB as number
    set Qnum to Qnum as number
    set TRN to TRN as number
    set IMG to IMG as number
    set DWN to DWN as number
    set VCT to VCT as number
    set FNT to FNT as number
    set OUT to OUT as number
    
    
    tell application "Adobe Photoshop 7.0"
        set OPTrec to {class:PDF save options} as record
        if EMB is 1 then
            set REC to {embed color profile:true} as record
            set OPTrec to OPTrec & REC
        else if EMB is 0 then
            set REC to {embed color profile:false} as record
            set OPTrec to OPTrec & REC
        end if
        
        --    encoding  ZIP/JPEG
        --    JPEG quality  integer  -- quality of produced image (Only valid for JPEG encoded PDF documents). Range: 0 to 12
        if Qnum is 1 then --ZIPだった
            set REC to {encoding:ZIP} as record
            set OPTrec to OPTrec & REC
        else --JPEGエンコーディングだった
            set REC to {encoding:JPEG} as record
            set OPTrec to OPTrec & REC
            set REC to {JPEG quality:Qnum - 2} as record
            set OPTrec to OPTrec & REC
        end if
        --transparency  boolean透明部分を保持
        if TRN is 1 then
            set REC to {transparency:true} as record
        else if TRN is 0 then
            set REC to {transparency:false} as record
        end if
        set OPTrec to OPTrec & REC
        --image interpolation  boolean  -- use image interpolation?画像の補間
        if IMG is 1 then
            set REC to {image interpolation:true} as record
        else if IMG is 0 then
            set REC to {image interpolation:false} as record
        end if
        set OPTrec to OPTrec & REC
        --downgrade color profile  boolean  -- should the embedded color profile be downgraded to version 2
        --カラープロファイルのダウングレード
        if DWN is 1 then
            set REC to {downgrade color profile:true} as record
        else if DWN is 0 then
            set REC to {downgrade color profile:false} as record
        end if
        set OPTrec to OPTrec & REC
        --vector data  boolean  -- include vector data
        if VCT is 1 then
            set REC to {vector data:true} as record
        else if VCT is 0 then
            set REC to {vector data:false} as record
        end if
        set OPTrec to OPTrec & REC
        --フォントの埋め込み
        --embed fonts  boolean  -- embed fonts? (only valid if vector data is included)
        if FNT is 1 then
            set REC to {embed fonts:true} as record
        else if FNT is 0 then
            set REC to {embed fonts:false} as record
        end if
        set OPTrec to OPTrec & REC
        
        --アウトラインデータ使用
        --use outlines for text  boolean  -- use outlines for text? (only valid if vector data is included)
        if OUT is 1 then
            set REC to {use outlines for text:true} as record
        else if OUT is 0 then
            set REC to {use outlines for text:false} as record
        end if
        set OPTrec to OPTrec & REC
        
        save document 1 in saveF as Photoshop PDF with options OPTrec
        --save document 1 in saveF as Photoshop format-- with options {class:EPS save options, encoding:binary, preview type:JPEG Mac OS}
    end tell
end run


(*
    downgrade color profile  boolean  -- should the embedded color profile be downgraded to version 2
    embed color profile  boolean  -- embed color profile in document
    embed fonts  boolean  -- embed fonts? (only valid if vector data is included)
    encoding  ZIP/JPEG
    image interpolation  boolean  -- use image interpolation?
    JPEG quality  integer  -- quality of produced image (Only valid for JPEG encoded PDF documents). Range: 0 to 12
    +save alpha channels  boolean  -- save alpha channels
    +save annotations  boolean  -- save annotations
    +save layers  boolean  -- save layers
    +save spot colors  boolean  -- save spot colors
    transparency  boolean
    use outlines for text  boolean  -- use outlines for text? (only valid if vector data is included)
    vector data  boolean  -- include vector data
*)
	


TOPへ


save/PSD


on run {saveF, EMB}
    
    set saveF to saveF as text
    set EMB to EMB as number
    tell application "Adobe Photoshop 7.0"
        set OPTrec to {class:Photoshop save options} as record
        if EMB is 1 then
            set REC to {embed color profile:true} as record
            set OPTrec to OPTrec & REC
        else if EMB is 0 then
            set REC to {embed color profile:false} as record
            set OPTrec to OPTrec & REC
        end if
        save document 1 in saveF as Photoshop format with options OPTrec
        --save document 1 in saveF as Photoshop format-- with options {class:EPS save options, encoding:binary, preview type:JPEG Mac OS}
    end tell
end run
	


TOPへ


save/TIFF


on run {saveF, EMB, Qnum, BTO, IMG, TRN, LAY}
    
    set saveF to saveF as text
    set EMB to EMB as number
    set Qnum to Qnum as number
    set BTO to BTO as text
    set IMG to IMG as number
    set TRN to TRN as number
    set LAY to LAY as text
    
    tell application "Adobe Photoshop 7.0"
        set OPTrec to {class:PDF save options} as record
        if EMB is 1 then
            set REC to {embed color profile:true} as record
            set OPTrec to OPTrec & REC
        else if EMB is 0 then
            set REC to {embed color profile:false} as record
            set OPTrec to OPTrec & REC
        end if
        
        
        --image compression  none/LZW/JPEG/ZIP  -- compression type
        --JPEG quality  integer  -- quality of produced image (0-12). Only valid for JPEG compressed TIFF documents
        if Qnum is 1 then --noneだった
            set REC to {encoding:none} as record
            set OPTrec to OPTrec & REC
        else if Qnum is 2 then --LZWだった
            set REC to {image compression:LZW} as record
            set OPTrec to OPTrec & REC
        else if Qnum is 3 then --ZIPだった
            set REC to {image compression:ZIP} as record
            set OPTrec to OPTrec & REC
        else --JPEGだった
            set REC to {image compression:JPEG} as record
            set OPTrec to OPTrec & REC
            --JPEGエンコーディングだった
            set REC to {JPEG quality:Qnum - 3} as record
            set OPTrec to OPTrec & REC
        end if
        --byte order  IBM PC/Mac OS
        if BTO is "IBM PC" then
            set REC to {byte order:IBM PC} as record
        else if BTO is "Macintosh" then
            set REC to {byte order:Mac OS} as record
        end if
        set OPTrec to OPTrec & REC
        --save image pyramid  boolean
        if IMG is 1 then
            set REC to {save image pyramid:true} as record
        else if IMG is 0 then
            set REC to {save image pyramid:false} as record
        end if
        set OPTrec to OPTrec & REC
        --transparency  boolean
        if TRN is 1 then
            set REC to {transparency:true} as record
        else if TRN is 0 then
            set REC to {transparency:false} as record
        end if
        set OPTrec to OPTrec & REC
        --save layers  boolean  -- save layers]
        --layer compression  RLE/ZIP  -- should only be used when you are saving layers
        if LAY is "RLE" then
            set REC to {save layers:true} as record
            set OPTrec to OPTrec & REC
            set REC to {layer compression:RLE} as record
            set OPTrec to OPTrec & REC
        else if LAY is "ZIP" then
            set REC to {save layers:true} as record
            set OPTrec to OPTrec & REC
            set REC to {layer compression:ZIP} as record
            set OPTrec to OPTrec & REC
        else if LAY is "NON" then
            set REC to {save layers:false} as record
            set OPTrec to OPTrec & REC
        end if
        
        save document 1 in saveF as TIFF with options OPTrec
        --save document 1 in saveF as Photoshop format-- with options {class:EPS save options, encoding:binary, preview type:JPEG Mac OS}
    end tell
end run


(*
    byte order  IBM PC/Mac OS
    embed color profile  boolean  -- embed color profile in document
    layer compression  RLE/ZIP  -- should only be used when you are saving layers
    +save alpha channels  boolean  -- save alpha channels
    +save annotations  boolean  -- save annotations
    save image pyramid  boolean
    save layers  boolean  -- save layers
    +save spot colors  boolean  -- save spot colors
    transparency  boolean
*)
	


TOPへ


settings/単位


on run {}
	tell application "Adobe Photoshop 7.0"
		tell settings -- object
			set typeName to type units --pixel units/mm units/point units
		end tell
	end tell
	return typeName
end run
	


TOPへ


settings/単位をセット


on run {typeName}
	set typeName to typeName as text
	tell application "Adobe Photoshop 7.0"
		tell settings -- object
			if typeName is "pixel units" then
				set type units to pixel units
			else if typeName is "mm units" then
				set type units to mm units
			else if typeName is "point units" then
				set type units to point units
			end if
			--pixel units/mm units/point units
		end tell
	end tell
	return "true"
end run
	


TOPへ


レイヤー/統合


on run {}
	set num to num as number
	tell application "Adobe Photoshop 7.0"
		tell document 1
				flatten --レイヤーを統合
		end tell
	end tell
	return "true"
end run
	


TOPへ


動作環境/プラグインをダウンロード


PhotoShop7.0をAppleScript対応にする。
インストールするにはプラグインのインストーラををAdobeのサイトからダウンロードしないといけません。
http://www.adobe.com/support/downloads/main.html
からPhotoShopのMac用をクリックしPhotoshop 7.0 Scripting plug-in v.1.0.2aをダウンロードします。ダウンロードしたらインストーラを起動してインストールします。これでPhotoShopがAppleScript対応になります。

ややバグありです。

と言ったもののCSが出たせいか
現在は消えていますね。
	


TOPへ