[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(DTPtechNote:645) paste text



¤Ì¤ë¤¤´¶¤¸¤À¤±¤É¡¢OSA Menu¤È¤«¤ËÆþ¤ì¤Æ»È¤¦¤ÈÊØÍø¤«¤â

(*
¥³¥Ô¡¼¤·¤¿Ê¸»úÎó¤Ë¥¹¥¿¥¤¥ë¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¤È¤­¡¢Ê¸»úÎó¤À¤±¤ò¥Ú¡¼¥¹¥È¤·¤Þ¤¹¡£

2003.12.18 seuzo- ym3s-ickw@asahi-net.or.jp
*)
tell application "QuarkXPress¾¤4.10r2J"
	activate
	
	--¡¦¥Ã¡¦ô§¥Æ¡¦¥é¡¦¥ï¡£¥·¡¦¥Î¡¢¥Û¥¦¥Û¥Ì¥¡¡¢¥Í¥·ð¦ô»
	if (clipboard info for string) is not {} then --¥¯¥ê¥Ã¥×¥Ü¡¼¥É¤Î¥Æ¥­¥¹¥È¤¬¶õ¤Ç¤Ê¤«¤Ã¤¿¤é
		set clip_str to (the clipboard) as Unicode text --ÊÑ¿ô¤Ë¥»¥Ã¥È¤·¤Á¤ã¤¦
		
	else
		my my_error("¥¯¥ê¥Ã¥×¥Ü¡¼¥É¤¬¶õ¤Ç¤¹", true) --¥¯¥ê¥Ã¥×¥Ü¡¼¥É¤¬¶õ¤Ê¤éÃæ»ß
	end if
	
	
	--³Îǧ
	if (not (exists selection)) or class of selection is not text then
		my my_error("¥«¡¼¥½¥ë¤¬ÁÞÆþ°ÌÃ֤ˤ¢¤ê¤Þ¤»¤ó", true) --¥»¥ë°Ê³°¤òÁªÂò¤·¤Æ¤¤¤ë¤Ê¤éÃæ»ß
	end if
	
	--¼Â¹Ô
	try
		set contents of selection to clip_str
	on error errMsg number errNum
		my my_error(errMsg & return & errNum, true) --¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¤éÃæ»ß
	end try
	
end tell



----------------------------------¡ü¥¨¥é¡¼½èÍý
on my_error(err_str, my_stop)
	if my_stop then
		set my_stop to {"̾ȧ"}
	else
		set my_stop to {"Ãæ»ß", "³¹Ô"}
	end if
	tell application "QuarkXPress¾¤4.10r2J"
		activate
		set ans to button returned of (display dialog err_str buttons my_stop with icon stop) --¥­¥ë¥±'¥¿¡¦¡¢¡¦¡Ö¡¦ú§¡¼¥¹¥ß¡¢¥­¡¢¥Ë¡¦¥±¡¦¥Í¡¦¥Æ¡¦¥é
		if ans is "¥Æ콡¬" then error number -128
	end tell
end my_error