[ID CC-CC2021] Скрипт для подписи масштаба

mike215

Топикстартер
15 лет на форуме
Сообщения
200
Реакции
6
Добрый день.
Столкнулся с ситуацией, когда нужно подписать процент масштабирования иллюстрации.
В палитре links (связи), Panel options, если установить галку Scale, видно процент масштабирования связи.
inddScale.png

Возможно, ли эту информацию вытащить из палитры и поставить подписью под иллюстрациями???
 

К.Т.

Участник
Сообщения
323
Реакции
337
Вытащить можно через Captions:
2020-10-13 12-37-03 Caption Setup.png
Осталось найти или сделать скрипт, расставляющий подписи.
 
  • Спасибо
Реакции: RIKITIKI

bossrus

шибка умный, аднака
12 лет на форуме
Сообщения
447
Реакции
74
вот у меня на работе давно валяется скрипт:

AppleScript:
tell application "Adobe InDesign CS6"
    --activate
    --- Setting Measurement units to Point and Origin
    set theOrigin to ruler origin of view preferences of document 1
    if theOrigin is not spread origin then
        set ruler origin of view preferences of document 1 to spread origin
    end if
    set myOldViewPreferences to properties of view preferences of active document
    set horizontal measurement units of view preferences of active document to points
    set vertical measurement units of view preferences of active document to points
    set myTextInfoLayerName to "•Image Info"
    set mydocument to active document
    tell mydocument
        set InfoStyle to make paragraph style with properties {name:"Image Info", applied font:"Times", font style:"Plain", fill color:swatch "Black", point size:6, justification:left align, leading:7}
        try
            set myLayer to layer myTextInfoLayerName of mydocument
        on error
            -- Create the layer if it didn't already exist.
            tell mydocument
                set myLayer to make layer
                set name of myLayer to myTextInfoLayerName
            end tell
        end try
        set IDLinks to links whose status is normal
        repeat with myCounter from 1 to (count IDLinks)
            set myLink to link myCounter of mydocument
            if link type of myLink is "Photoshop" or link type of myLink is "JPEG" or link type of myLink is "TIFF" then
                set theImage to parent of item myCounter of IDLinks
                set myFilePath to file path of item myCounter of IDLinks
                set LinkName to name of item myCounter of IDLinks
               
                set theFrame to parent of theImage
                set EffectRes to effective ppi of theImage
               
                set HRes to item 1 of EffectRes as string
                set VRes to item 2 of EffectRes as string
               
                set ColorSpace to space of theImage
               
                set myRotation to rotation angle of theImage
               
                set myHScale to horizontal scale of theImage
                set myVScale to vertical scale of theImage
               
                set myShear to shear angle of theImage
               
                set {a, b, c, d} to geometric bounds of theFrame
                repeat
                    set theClass to class of parent of theFrame
                    if theClass = master spread then
                        set theSpread to parent of theFrame
                        exit repeat
                    end if
                    if theClass = spread then
                        set theSpread to parent of theFrame
                        exit repeat
                    end if
                    if theClass = page then
                        set theSpread to parent of theFrame
                        exit repeat
                    end if
                end repeat
               
                set myH to 35
                set myW to 100
                set mytrueLabelPositon to {(a + c) / 2 - (myH / 2), (b + d) / 2 - (myW / 2), (a + c) / 2 + (myH / 2), (b + d) / 2 + (myW / 2)}
                set ImgTxtFrame to make text frame at theSpread with properties {fill color:swatch "Paper", layer:myLayer}
                set geometric bounds of ImgTxtFrame to mytrueLabelPositon
                set vertical justification of text frame preferences of ImgTxtFrame to center align
                set inset spacing of text frame preferences of ImgTxtFrame to {2, 2, 2, 2}
                set ignore wrap of text frame preferences of ImgTxtFrame to true
                set applied paragraph style of insertion point 1 of ImgTxtFrame to InfoStyle
               
                set contents of insertion point 1 of ImgTxtFrame to "Path: " & LinkName & return & "W Scale: " & (round (myHScale * 10)) / 10 & return & "H Scale: " & (round (myVScale * 10)) / 10 & return & "Rotation: " & myRotation
            end if
        end repeat
    end tell
    tell view preferences of active document to set properties to myOldViewPreferences
    if theOrigin is not spread origin then
        set ruler origin of view preferences of document 1 to theOrigin
    end if
   
end tell

делал кто-то давно на эрллскрипте. в яву не переносил, бо и так работает :)

для работы все группы должны быть разгрупированы
 
  • Спасибо
Реакции: Килгор Траут

Gad

Сообщения
2 971
Реакции
1 405
2020-10-13_10-43-54.png
 

bossrus

шибка умный, аднака
12 лет на форуме
Сообщения
447
Реакции
74
а в принципе в яваскрипте масштабирование картинки находится тут:
Код:
    app.documents[0].allGraphics[0].horizontalScale
    app.documents[0].allGraphics[0].verticalScale
 

Gad

Сообщения
2 971
Реакции
1 405
Буду рад если подскажете как это работает
Так на скрине все есть же :) Type > Text Variables > Define > New Потом как на скрине назначаете текстовую переменную которая берет из Metadata Caption масштаб. Создаете текстовый фрейм который касается изображения или сгруппирован с ним, в него вставляете эту переменную Type > Text Variables > Insert Variable > [переменная как вы там ее назвали]
 
Последнее редактирование:
  • Спасибо
Реакции: DrEgor и mike215

mike215

Топикстартер
15 лет на форуме
Сообщения
200
Реакции
6
Так на скрине все есть же :) Type > Text Variables > Define > New Потом как на скрине назначаете текстовую переменную которая берет из Metadata Caption масштаб. Создаете текстовый фрейм который касается изображения или сгруппирован с ним, в него вставляете эту переменную Type > Text Variables > Insert Variable > [переменная как вы там ее назвали]
Разобрался, но понял что фрейм текстовый должен быть на объекте. Спасибо огромное
 

RIKITIKI

20 лет на форуме
Сообщения
1 465
Реакции
515
Как-то через Подписи/Captions (как предлагали выше) проще и элегантнее однако :)
 

RIKITIKI

20 лет на форуме
Сообщения
1 465
Реакции
515
Проще жмякнуть на скрипт
ну не скажи... раз настроил подписи - отступ там, стиль, группировку и это сохранилось в публикации. И отредактировать можно параметры. А скрипт если и работает без глюков (в этой версии индизайна) ещё настроить, таскать с собой с машины на машину, не забыть как называется и пр.