0
이것은 내 마음을 잃어 버리게 만듭니다. 여기에 내가 노력하려고 노력하는 짧은 코드가 있습니다. 기괴한 값을 반환하고 무작위 높이 및 너비 설정에서 오류가 발생합니다. 나는 내가 잘못한 곳을 알아낼 수 없다! 입력을 결정하는 논리 게이트가 견고하다고 생각했습니다! 어떤 도움이라도 대단히 감사하겠습니다!Indesign에서 AppleScript를 사용하는 여러 조건부 - 작동하지 않습니까?
tell application "Adobe InDesign CS6"
activate
set myDoc to active document
set origLevel to user interaction level of script preferences
set user interaction level of script preferences to interact with all
set myDialog to make dialog with properties {name:"Make Template", can cancel:true}
tell myDialog
tell (make dialog column)
tell (make border panel)
tell (make dialog column)
make static text with properties {static label:"Width:", min width:60}
make static text with properties {static label:"Height:", min width:60}
make static text with properties {static label:"Bleed:", min width:60}
end tell
tell (make dialog column)
set myWidth to make text editboxes with properties {edit contents:"", min width:60}
set myHeight to make text editboxes with properties {edit contents:"", min width:60}
set myBleed to make text editboxes with properties {edit contents:"", min width:60}
end tell
tell (make dialog column)
make static text with properties {static label:"in", min width:0}
make static text with properties {static label:"in", min width:0}
make static text with properties {static label:"in", min width:0}
end tell
tell (make dialog column)
make static text with properties {static label:"", min width:25}
end tell
end tell
end tell
end tell
set userResponse to show myDialog
if userResponse is true then
set docWidth to edit contents of myWidth as string
set docHeight to edit contents of myHeight as string
set docBleed to edit contents of myBleed as string
destroy myDialog
else
destroy myDialog
error number -128
end if
tell myDoc
if docHeight > docWidth then
set bigDim to docHeight
else
set bigDim to docWidth
end if
if bigDim ≤ 216 then
set buildSize to "1"
else if bigDim > 216 and bigDim ≤ 432 then
set buildSize to "2"
else if bigDim > 432 and bigDim ≤ 864 then
set buildSize to "4"
else if bigDim > 864 and bigDim ≤ 2160 then
set buildSize to "10"
end if
set newWidth to (docWidth/buildSize)
set newHeight to (docHeight/buildSize)
set newBleed to (docBleed/buildSize)
set document bleed top offset of document preferences to newBleed
set page width of document preferences to newWidth
set page height of document preferences to newHeight
end tell
set user interaction level of script preferences to origLevel
end tell
예상되는 결과와 실제 오류 메시지에 대한 설명이 유용합니다. –
높이와 너비를 "5"로 설정하면 25 %의 배율 크기로 반환됩니다. 다른 모든 if-then 문을 제거하고 "bigDim ≤ 216이라면 buildSize를"1 "로 설정하면 작동하지 않습니다. 단지 buildSize가 정의되지 않았다고 말합니다 - 내 입력 > 216이었습니다. 단지 의미가 없습니다! –