tell application “InDesign CS”
if (count documents) > 0 then
my myDisplayDialog()
else
display dialog “Please open a document and try again!” buttons “Cancel” default button “Cancel”
end if
end tell
— Dialog Start
on myDisplayDialog()
tell application “InDesign CS”
--Get a list of the color names of active document
set myColorNames to name of every swatch of active document
set myFirstColumnWidth to 150
set myDialog to make dialog with properties {name:"Images Name Text Frame Options"}
tell myDialog
tell (make dialog column)
--First Panel Border start
tell (make border panel)
tell (make dialog column)
--Options for a paragraph style name
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Paragraph Style Name:", min width:myFirstColumnWidth}
end tell
tell (make dialog column)
set myParaStyleName to make text editbox with properties {edit contents:"ImagesTag_Style", min width:200}
end tell
end tell
--Options for a text size
set myTextSizeList to {"4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"}
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Text Size:", min width:myFirstColumnWidth}
end tell
tell (make dialog column)
set myTextSizeDropdown to make dropdown with properties {string list:myTextSizeList, selected index:5, min width:200}
end tell
end tell
--Popup Options which choice of Color for the Text
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Text Color:", min width:myFirstColumnWidth}
end tell
tell (make dialog column)
set myTextColorDropdown to make dropdown with properties {string list:myColorNames, selected index:2, min width:200}
end tell
end tell
end tell
end tell
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Warning: Font used for WHO AM I will be Geneva-Regular!"}
end tell
end tell
--Second Panel Border start
tell (make border panel)
tell (make dialog row)
tell (make dialog column)
--Options for a paragraph style name
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Layer name:", min width:myFirstColumnWidth}
end tell
tell (make dialog column)
set myLayerName to make text editbox with properties {edit contents:"ImagesTag_Layer", min width:200}
end tell
end tell
--Options for dimensions of text frame
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Frame Size:", min width:myFirstColumnWidth}
end tell
tell (make dialog column)
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"W:"}
end tell
tell (make dialog column)
set myWFrame to make measurement editbox with properties {edit value:72, edit units:points, small nudge:18, minimum value:36, maximum value:1224, min width:48}
end tell
tell (make dialog column)
make static text with properties {static label:"H:"}
end tell
tell (make dialog column)
set myHFrame to make measurement editbox with properties {edit value:9, edit units:points, small nudge:1, minimum value:6, maximum value:288, min width:48}
end tell
end tell
end tell
end tell
--Options for offset value of text frame from Images frame
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Frame Offset:", min width:myFirstColumnWidth}
end tell
tell (make dialog column)
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"X:"}
end tell
tell (make dialog column)
set myXOffset to make measurement editbox with properties {edit value:0, edit units:points, small nudge:1, minimum value:-72, maximum value:72, min width:48}
end tell
tell (make dialog column)
make static text with properties {static label:"Y:"}
end tell
tell (make dialog column)
set myYOffset to make measurement editbox with properties {edit value:0, edit units:points, small nudge:1, minimum value:-72, maximum value:72, min width:48}
end tell
end tell
end tell
end tell
--Popup Options which choice of Color for the frame
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Frame Color:", min width:myFirstColumnWidth}
end tell
tell (make dialog column)
set myframeColorDropdown to make dropdown with properties {string list:myColorNames, selected index:0, min width:200}
end tell
end tell
end tell
end tell
end tell
--Third Panel Border start
tell (make border panel)
tell (make dialog column)
--- Choose the position of the text frame
set myLabelPositionList to {"Center on Image", "Center-Top-Outside", "Center-Top-Inside", "Center-Bottom-Outside", "Center-Bottom-Inside", "Top-Right-Outside", "Top-Right-Inside", "Bottom-Right-Outside", "Bottom-Right-Inside", "Top-Left-Outside", "Top-Left-Inside", "Bottom-Left-Outside", "Bottom-Left-Intside"}
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Position of labels:", min width:myFirstColumnWidth}
end tell
tell (make dialog column)
set myLabelPositionDropdown to make dropdown with properties {string list:myLabelPositionList, selected index:0, min width:200}
end tell
end tell
--- Choose the status of images
set myImagesStatusList to {"All Images", "Up to Date", "Missing", "Modified", "Embeded"}
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:"Images that are:", min width:myFirstColumnWidth}
end tell
tell (make dialog column)
set myImagesStatusDropdown to make dropdown with properties {string list:myImagesStatusList, selected index:0, min width:200}
end tell
end tell
end tell
end tell
tell (make dialog row)
tell (make dialog column)
set myPathorName to make checkbox control with properties {static label:"Use Full Path Instead of Name of image", checked state:false}
end tell
end tell
tell (make dialog row)
tell (make dialog column)
set mySelorAll to make checkbox control with properties {static label:"Create on Selected items only", checked state:false}
end tell
end tell
-- Collecting Results
set myResult to show myDialog
if myResult is true then
set myPSName to edit contents of myParaStyleName
if selected index of myTextSizeDropdown is 0 then
set myTextSize to 4
else if selected index of myTextSizeDropdown is 1 then
set myTextSize to 5
else if selected index of myTextSizeDropdown is 2 then
set myTextSize to 6
else if selected index of myTextSizeDropdown is 3 then
set myTextSize to 7
else if selected index of myTextSizeDropdown is 4 then
set myTextSize to 8
else if selected index of myTextSizeDropdown is 5 then
set myTextSize to 9
else if selected index of myTextSizeDropdown is 6 then
set myTextSize to 10
else if selected index of myTextSizeDropdown is 7 then
set myTextSize to 11
else if selected index of myTextSizeDropdown is 8 then
set myTextSize to 12
else if selected index of myTextSizeDropdown is 9 then
set myTextSize to 13
else if selected index of myTextSizeDropdown is 10 then
set myTextSize to 14
end if
set myTextColor to item ((selected index of myTextColorDropdown) + 1) of myColorNames
set myLayerN to edit contents of myLayerName
set myW to edit value of myWFrame
set myH to edit value of myHFrame
set myXO to edit value of myXOffset
set myYO to edit value of myYOffset
set myFrameColor to item ((selected index of myframeColorDropdown) + 1) of myColorNames
if selected index of myLabelPositionDropdown is 0 then
set myLabelPositon to 0
else if selected index of myLabelPositionDropdown is 1 then
set myLabelPositon to 1
else if selected index of myLabelPositionDropdown is 2 then
set myLabelPositon to 2
else if selected index of myLabelPositionDropdown is 3 then
set myLabelPositon to 3
else if selected index of myLabelPositionDropdown is 4 then
set myLabelPositon to 4
else if selected index of myLabelPositionDropdown is 5 then
set myLabelPositon to 5
else if selected index of myLabelPositionDropdown is 6 then
set myLabelPositon to 6
else if selected index of myLabelPositionDropdown is 7 then
set myLabelPositon to 7
else if selected index of myLabelPositionDropdown is 8 then
set myLabelPositon to 8
else if selected index of myLabelPositionDropdown is 9 then
set myLabelPositon to 9
else if selected index of myLabelPositionDropdown is 10 then
set myLabelPositon to 10
else if selected index of myLabelPositionDropdown is 11 then
set myLabelPositon to 11
else if selected index of myLabelPositionDropdown is 12 then
set myLabelPositon to 12
end if
if selected index of myImagesStatusDropdown is 0 then
set myImagesStatus to 0
else if selected index of myImagesStatusDropdown is 1 then
set myImagesStatus to 1
else if selected index of myImagesStatusDropdown is 2 then
set myImagesStatus to 2
else if selected index of myImagesStatusDropdown is 3 then
set myImagesStatus to 3
else if selected index of myImagesStatusDropdown is 4 then
set myImagesStatus to 4
end if
set myText to checked state of myPathorName
set myTarget to checked state of mySelorAll
destroy myDialog
my myLabelsOptions(myPSName, myTextSize, myTextColor, myLayerN, myW, myH, myXO, myYO, myFrameColor, myLabelPositon, myImagesStatus, myText, myTarget)
else
destroy myDialog
end if
end tell
end tell
end tell
end myDisplayDialog
on myLabelsOptions(myPSName, myTextSize, myTextColor, myLayerN, myW, myH, myXO, myYO, myFrameColor, myLabelPositon, myImagesStatus, myText, myTarget)
tell application “InDesign CS”
— 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 myLayerN
set myDocument to active document
tell myDocument
set Info to make paragraph style with properties {name:myPSName, applied font:"Geneva", font style:"Regular", fill color:swatch myTextColor, point size:myTextSize, justification:center align}
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
-- Search document for linked images
if myTarget is false then
if myImagesStatus is 0 then
set IDLinks to links
else if myImagesStatus is 1 then
set IDLinks to links whose status is normal
else if myImagesStatus is 2 then
set IDLinks to links whose status is link missing
else if myImagesStatus is 3 then
set IDLinks to links whose status is link out of date
else if myImagesStatus is 4 then
set IDLinks to links whose status is link embedded
end if
else
try
if myImagesStatus is 0 then
set IDLinks to item link of all graphics of selection
else if myImagesStatus is 1 then
set IDLinks to item link of all graphics of selection whose status is normal
else if myImagesStatus is 2 then
set IDLinks to item link of all graphics of selection whose status is link missing
else if myImagesStatus is 3 then
set IDLinks to item link of all graphics of selection whose status is link out of date
else if myImagesStatus is 4 then
set IDLinks to item link of all graphics of selection whose status is link embedded
end if
on error
display dialog "No image selected. Select one and try again!" buttons "Cancel" default button "Cancel"
end try
end if
repeat with myCounter from 1 to (count IDLinks)
set LinkName to name of item myCounter of IDLinks as string
set theImage to parent of item myCounter of IDLinks
set theFrame to parent of theImage
set ImagePath to file path of item myCounter of IDLinks as string
set ImgPos to geometric bounds of theFrame
repeat
set theClass to class of parent of theFrame
if theClass = spread then
set theSpread to parent of theFrame
exit repeat
else
set theFrame to parent of theFrame
end if
end repeat
-- Calculate position
set myY1 to (item 1 of ImgPos) + myYO
set myX1 to (item 2 of ImgPos) + myXO
set myY2 to (item 3 of ImgPos) + myYO
set myX2 to (item 4 of ImgPos) + myXO
if myLabelPositon = 0 then
set mytrueLabelPositon to {(myY1 + myY2) / 2 - (myH / 2), (myX1 + myX2) / 2 - (myW / 2), (myY1 + myY2) / 2 + (myH / 2), (myX1 + myX2) / 2 + (myW / 2)}
else if myLabelPositon = 1 then
set mytrueLabelPositon to {myY1 - myH, (myX1 + myX2) / 2 - (myW / 2), (myY1), (myX1 + myX2) / 2 + (myW / 2)}
else if myLabelPositon = 2 then
set mytrueLabelPositon to {myY1 + myH, (myX1 + myX2) / 2 - (myW / 2), myY1, (myX1 + myX2) / 2 + (myW / 2)}
else if myLabelPositon = 3 then
set mytrueLabelPositon to {(myY2), (myX1 + myX2) / 2 - (myW / 2), (myY2) + myH, (myX1 + myX2) / 2 + (myW / 2)}
else if myLabelPositon = 4 then
set mytrueLabelPositon to {(myY2) - myH, (myX1 + myX2) / 2 - (myW / 2), (myY2), (myX1 + myX2) / 2 + (myW / 2)}
else if myLabelPositon = 5 then
set mytrueLabelPositon to {myY1 - myH, myX2 - myW, myY1, myX2}
else if myLabelPositon = 6 then
set mytrueLabelPositon to {myY1 + myH, myX2 - myW, myY1, myX2}
else if myLabelPositon = 7 then
set mytrueLabelPositon to {myY2, myX2, myY2 + myH, myX2 - myW}
else if myLabelPositon = 8 then
set mytrueLabelPositon to {myY2, myX2, myY2 - myH, myX2 - myW}
else if myLabelPositon = 9 then
set mytrueLabelPositon to {myY1 - myH, myX1, myY1, myX1 + myW}
else if myLabelPositon = 10 then
set mytrueLabelPositon to {myY1 + myH, myX1, myY1, myX1 + myW}
else if myLabelPositon = 11 then
set mytrueLabelPositon to {myY2, myX1, myY2 + myH, myX1 + myW}
else if myLabelPositon = 12 then
set mytrueLabelPositon to {myY2, myX1, myY2 - myH, myX1 + myW}
end if
set ImgTxtFrame to make text frame at theSpread with properties {fill color:swatch myFrameColor}
set geometric bounds of ImgTxtFrame to mytrueLabelPositon
set vertical justification of text frame preferences of ImgTxtFrame to center align
set ignore wrap of text frame preferences of ImgTxtFrame to true
set applied paragraph style of insertion point -1 of ImgTxtFrame to Info
if myText is false then
set contents of insertion point -1 of ImgTxtFrame to (LinkName as string)
else
set contents of insertion point -1 of ImgTxtFrame to (ImagePath as string)
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
beep
end tell
end myLabelsOptions
tell application “InDesign CS”
tell view preferences
set cursor key increment to (0.0139)
end tell
end tell
but for some reason it is not going back to 0.0139 please help