11/*
22 * CSVRubyProcessor
3- * Version 1.0
3+ * Version 1.1
44 *
55 * (c) 2022 uco
66 *
1111//DESCRIPTION:CSVファイルでルビを一括設定
1212
1313#target indesign
14+ #targetengine 'utsutsunogare'
1415
1516var NAME = 'CSVRubyProcessor' ;
1617
@@ -199,6 +200,10 @@ var NameValueList = function () {
199200 this . value = this . values [ this . list . selection . index ] ;
200201 } ;
201202
203+ _proto . getIndex = function getIndex ( ) {
204+ return this . list . selection . index ;
205+ } ;
206+
202207 return NameValueList ;
203208} ( ) ;
204209
@@ -287,6 +292,18 @@ var RubySetting = function () {
287292 } ;
288293 } ;
289294
295+ _proto . getSettings = function getSettings ( ) {
296+ return {
297+ alignments : this . alignList . getIndex ( ) ,
298+ position : this . positionList . getIndex ( ) ,
299+ overhang : this . overhangList . getIndex ( ) ,
300+ parentspacing : this . parentSpacingList . getIndex ( ) ,
301+ xOffset : this . xOffset ,
302+ yOffset : this . yOffset ,
303+ skipmode : this . isSkip ( )
304+ } ;
305+ } ;
306+
290307 _proto . isSkip = function isSkip ( ) {
291308 return this . inputSkipmode . value ;
292309 } ;
@@ -352,13 +369,29 @@ var DEFAULT = loadconfig(NAME, {
352369 parentspacing : 2 ,
353370 xOffset : 0 ,
354371 yOffset : 0 ,
355- skipmode : false
372+ skipmode : false ,
373+ keepParameter : true
356374} ) ;
357375app . doScript ( main , ScriptLanguage . JAVASCRIPT , [ ] , UndoModes . FAST_ENTIRE_SCRIPT ) ;
358376
359377function main ( ) {
378+ var _this = this ;
379+
360380 var dialog = new Window ( 'dialog' , 'ルビ設定' ) ;
361- var rubySettings = new RubySetting ( dialog , DEFAULT , true ) ;
381+
382+ var settings = function ( ) {
383+ if ( DEFAULT . keepParameter ) {
384+ if ( typeof CSVRubyProcessor !== 'undefined' ) {
385+ return CSVRubyProcessor ;
386+ } else {
387+ _this . CSVRubyProcessor = null ;
388+ }
389+ }
390+
391+ return DEFAULT ;
392+ } ( ) ;
393+
394+ var rubySettings = new RubySetting ( dialog , settings , true ) ;
362395 new ActionButtons ( dialog , {
363396 width : 96 ,
364397 height : 24
@@ -371,6 +404,11 @@ function main() {
371404
372405 var rubyOption = rubySettings . getValues ( ) ;
373406 var skipmode = rubySettings . isSkip ( ) ;
407+
408+ if ( DEFAULT . keepParameter ) {
409+ CSVRubyProcessor = rubySettings . getSettings ( ) ;
410+ }
411+
374412 var fileObj = File . openDialog ( '' , function ( ) {
375413 if ( / ^ w i n d o w s / i. test ( $ . os ) ) {
376414 return '*.csv' ;
0 commit comments