注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

老胤祥 YOU CAN, DO IT!

Illustrator CS6/CC 插件 脚本 动作 笔刷 符号 教程

 
 
 

日志

 
 

Ruby脚本for Illustrator  

2015-05-25 22:19:23|  分类: AI 脚本 Scripts |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

#!/usr/bin/ruby


# Illustrator CS4 script by Ian Haigh (http://ianhaigh.com/)
# Mon Jun 29 11:08:57 EST 2009

# requires rb-appscript:
# http://appscript.sourceforge.net/rb-appscript/index.html

# Renumber artboards from left to right, top to bottom.
# Handy when you're creating a storyboard and need to
# add or delete frames.


require 'appscript'

ai = Appscript.app('Adobe Illustrator.app')
doc = ai.current_document

original_artboards = doc.artboards.get

# borrowed from the Ruby Cookbook
rects_hash = Hash.new { |hash, key| hash[key] = [] }

original_artboards.reverse.each do |a|
# grab the existing bounds so we can recreate them
rect = a.artboard_rectangle.get

# create a hash of arrays
# use the first y offset as the key
# (each array represents a row of artboards)
y1 = rect[1]
rects_hash[y1] << rect

# can't delete the last artboard, do that later
a.delete unless a.index.get == 1
end

rects_hash.keys.sort.reverse.each do |row|
rects_hash[row].sort.each do |a|
ai.make(:new => :artboard, :at => doc, :with_properties => { :artboard_rectangle => a })
end
end

# finally get rid of the first, original, artboard
original_artboards[0].delete

上面这是一个用Ruby语言的Renumber artboards画板排序脚本。有Ruby语言基础的可以一看。

#!/usr/bin/ruby

# Often, when opening a PDF in Illustrator, the text is split into a whole
# bunch of discrete chunks. This will (hopefully) speed up merging them back
# together. Just select the text and run the script. Bingo!

require 'appscript'

ai = Appscript.app('Adobe Illustrator.app')

sel = ai.selection.get.reverse
joined = sel.collect { |o| o.contents.get }.join
sel[0].contents.set(joined)
ai.delete(sel[1,sel.length-1])

合并文字脚本。

#!/usr/bin/ruby

# rb-appscript code by Ian Haigh : http://ianhaigh.com/
# Fri Dec 4 11:19:34 EST 2009

require "rubygems"
require 'appscript'

ai = Appscript.app('Adobe Illustrator.app')
doc = ai.current_document

artwork_bounds = doc.geometric_bounds.get
doc.artboards[1].artboard_rectangle.set(artwork_bounds)

适合画板到对象。

Ruby脚本打包下载

更多请看这里:https://appscript.wordpress.com/category/illustrator/
  评论这张
 
阅读(108)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017