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

path/クリッピングパスのコピペ


--まずクリッピング画像ありのフォルダを選択し
--次にクリッピング画像なしのフォルダを選択
--クリッピング画像ありフォルダ内のファイルを開き
--同名のクリッピング画像なしファイルにパスをコピペして保存して閉じます。


set myFol01 to choose folder with prompt "クリッピング画像ありのフォルダを選択"
set myFol01 to myFol01 as string
set myFol02 to choose folder with prompt "クリッピング画像なしのフォルダを選択"
set myFol02 to myFol02 as string

repeat with myFile in list folder myFol01 without invisibles
	set this_item01 to (myFol01 & myFile) as alias
	set Fname01 to name of (info for this_item01)
	try
		--下の行で元ファイルがepsでペーストするファイルがpsdにできる。(ファイル名の検索置換)
		--set Fname01 to my replaceAll(Fname01, ".eps", ".psd")
		set this_item02 to (myFol02 & Fname01) as alias
		set Fname02 to name of (info for this_item02)
		my pathCopy(this_item01, this_item02)
	end try
end repeat

on pathCopy(this_item01, this_item02)
	tell application "Adobe Photoshop CS2"
		open this_item01
		set myPath to entire path of path item 1 in document 1
		close document 1
		open this_item02
		make new path item in document 1 with properties {entire path:myPath, name:"パス1", kind:clipping}
		close document 1 saving yes
	end tell
end pathCopy

on replaceAll(motoStr, FindStr, repStr)
	set OriginalDelimiters to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {FindStr}
	set motoStr to text items of motoStr
	set AppleScript's text item delimiters to {repStr}
	set motoStr to motoStr as string
	set AppleScript's text item delimiters to OriginalDelimiters
	return motoStr
end replaceAll


TOPへ


サンプル/デジタル検版


--ドロップされた2枚の画像を比較し
--違う部分のみ表示します。

on open theList
	if the number of theList is not 2 then
		display dialog "画像は2つドロップしてください。"
	else
		tell application "Adobe Photoshop CS2"
			open item 1 of theList
			open item 2 of theList
			set x2 to width of document 1 as pixels
			set y2 to height of document 1 as pixels
			select current document region {{0, 0}, {x2, 0}, {x2, y2}, {0, y2}}
			activate
			copy selection of current document
			close document 2 saving no
			paste
			--duplicate layer 1 to layer 3
			tell document 1
				set blend mode of layer 1 to difference
				merge visible layers
				adjust layers using inversion
				paste
				
				make new art layer with properties {opacity:80}
				select region {{0, 0}, {x2, 0}, {x2, y2}, {0, y2}}
				fill selection with contents {class:RGB color, red:255, green:255, blue:255}
				set properties of layer 3 to {background layer:false, blend mode:multiply}
				move layer 3 to beginning
				--set  of layer 1 to multiply
			end tell
		end tell
	end if
end open


TOPへ


レイヤー/レイヤーをバラバラにしてgif保存


tell application "Adobe Photoshop CS2"
	tell document 1
		set Fpath to file path as string
		set Fpath to my del_psd(Fpath)
		set LayNum to count layers
		repeat with N2 from 1 to LayNum
			set visible of layer N2 to false --true
		end repeat
		repeat with N1 from 1 to LayNum
			set visible of layer N1 to true
			save in Fpath & N1 as CompuServe GIF with copying -- with options 
			set visible of layer N1 to false
		end repeat
	end tell
end tell


on del_psd(TexData)
	set OriginalDelimiters to AppleScript's text item delimiters
	set KEN to ".psd" --検索文字
	set AppleScript's text item delimiters to {KEN}
	set TexData to text items of TexData
	set TexData to item 1 of TexData as string
	set AppleScript's text item delimiters to OriginalDelimiters
	return TexData
end del_psd


TOPへ