论坛帮助 |
社区圈子 |
日历事件 |
2017-12-17, 17:43 | #1 | ||
|
|||
正式会员
等级: 小兄弟
|
#targetengine com.adobe.illustrator.demo.flashplayer //增加最大化和最小化快捷键 q //properties:{ closeOnKey:'OSCmnd+W', closeButton:true, maximizeButton:true, minimizeButton:true, resizeable:false},\ res ="palette { orientation: 'column', text : 'Design By KING',\}"; var panelHeight; win = new Window (res); win.margins=0; win.spacing=8; //win.helpTip="http://tangyahai.taobao.com" resize=win.add('group'); resize.alignment='right'; ButtonMaxResize = resize.add('button',{x:win.maximumSize.width-25,y:0,width:25,height:13},'MAX'); ButtonMaxResize .shortcutKey = "q"; ButtonMaxResize.graphics.font = ScriptUI.newFont ('Tahoma', 'BOLD', 8); ButtonMaxResize.visible = false; ButtonMinResize = resize.add('button',{x:win.maximumSize.width-25,y:15,width:25,height:13},'MIN'); ButtonMinResize .shortcutKey = "q"; ButtonMinResize.graphics.font = ScriptUI.newFont ('Tahoma', 'BOLD', 8); win.ykPnl= win.add('panel',undefined,'设置咬口值'); win.ykPnl.spacing=0; win.ykPnl.margins=[4,10,4,4]; win.ykPnl.ykzhi= win.add('edittext', undefined, '50'); win.ykPnl.ykzhi.size=[120,20]; win.yaokouPnl=win.add('panel',undefined,'咬口设置'); win.yaokouPnl.spacing=0; win.yaokouPnl.margins=[4,10,4,4]; win.yaokouPnl.leftyaokou = win.yaokouPnl.add('button', undefined, '左咬口'); win.yaokouPnl.leftyaokou.size=[120,20]; win.yaokouPnl.rightyaokou = win.yaokouPnl.add('button', undefined, '右咬口'); win.yaokouPnl.rightyaokou.size=[120,20]; win.yaokouPnl.zhengyaokou = win.yaokouPnl.add('button', undefined, '正咬口'); win.yaokouPnl.zhengyaokou.size=[120,20]; win.yaokouPnl.fanyaokou = win.yaokouPnl.add('button', undefined, '上咬口'); win.yaokouPnl.fanyaokou.size=[120,20]; win.yaokouPnl.leftyaokou.onClick = function(){ var yk =win.ykPnl.ykzhi.text; alert(yk); var myDoc = app.activeDocument; //var inputSize=prompt ("输入咬口尺寸,单位mm", "50", "更改咬口位,Design by KING"); //var inputSize= (inputSize + "*790*1030").split("*"); //var yk= UnitValue(Number(inputSize[0]), "mm").as("pt"); //var yw= UnitValue(Number(inputSize[1]), "mm").as("pt"); //var w= UnitValue(Number(inputSize[1]), "mm").as("pt"); //var h= UnitValue(Number(inputSize[2]), "mm").as("pt"); //var myDoc = activeDocument; alert(yk); var yw=myDoc.artboards[0].artboardRect[2]-myDoc.artboards[0].artboardRect[0] for (i=0; i<myDoc.artboards.length; i++) { var abBounds = myDoc.artboards[i].artboardRect; var x =(abBounds[2]-abBounds[0])/2+abBounds[0]; var y = (abBounds[3]-abBounds[1])/2+abBounds[1]; myDoc.artboards[i].artboardRect = [x-yw/2-yk, y+h/2, x+w-yw/2-yk, y-h/2]; } } function fMsg(a) { var b = new BridgeTalk; b.target = "illustrator"; b.body = a; b.send() } ButtonMinResize.onClick = function() { panelHeight=win.bounds.height; win.bounds.height =14; ButtonMaxResize.visible = true; ButtonMinResize.visible = false; } ButtonMaxResize.onClick = function() { //if (version == "16.0") { win.bounds.height = 586} win.bounds.height=panelHeight; //win.bounds.height = 530;////win.maximumSize.height; // 30*12+13=373 ButtonMaxResize.visible = false; ButtonMinResize.visible = true; } win.show(); 请教下,我这么写。为什么运行后点按钮不会运行? |
||
2017-12-18, 15:52 | 只看该作者 #5 | |||
|
||||
VIP会员
等级: 七袋长老
|
可到Adobe网站下载"JavaScriptToolsGuideCC" 参阅里面的BridgeTalk章节 并且查找网路上BridgeTalk相关讨论, 这非本人三言两语便可在这说分明, 还是得靠自己摸索, 加油!兄弟 以下是一段基本编程,供参考 ////////////////////////////////////// //New Bridgetalk var bt = new BridgeTalk(); //Target application bt.target = "bridge"; //Script to execute on target application bt.body = /*script to execute*/; //Results if anything is to be returned bt.onResult = function( inBT ) { result = eval( inBT.body ); } //If anything goes wrong, error message bt.onError = function( inBT ) {alert(inBT.body); } //Send the command with a timeout in seconds bt.send(8); ////////////////////////////////////// |
|||
2017-12-19, 09:46 | 只看该作者 #6 | ||
|
|||
正式会员
等级: 小兄弟
|
引用:
可否在我原有的代码上修改一个?真的看不懂要怎么处理这个内容,。单独的命令做一个脚本是可行的,加到一起就不行了。有会的帮忙修改一下吗?不胜感谢。 |
||