按第一个字符的字体和大小选择“故事”
问题描述:
我有这个问题。
在我的文档中,我想“扫描”每个文本框,并搜索特定应用字体和应用大小的具体第一个字母(等等...)
如果我找到它,复制文本项目的整个故事,另一份文件
如果我没有找到,搜索其他类型的特定的第一个字母...
如果我找到它,复制文本项目,过去,它的整个故事,在另一个文件
如果我没有找到,搜索另一种类型的具体的第一个字母...
如果我找到它,复制文本项目的整个故事,并在另一个文档中过去它按第一个字符的字体和大小选择“故事”
那对于人我的文档
tell application (CS6)
-- bla bla bla
if applied font of character 1 of characters of texts of object reference of text frame 1 of text frames is ("Taz" & tab & "Regular") then
或
tell application (CS6)
set Titoli to {applied font:"Taz", point size:{15, 16, 17, 18, 19, 20}}
-- bla bla bla
if applied font of character 1 of characters of texts of object reference of text frame 1 of text frames is in Titoli then ...
,但它没有工作... :-(
我的AppleScript的knowledgement l的页面比我的英语不好糟糕...对不起。
预先感谢每一个建议
tell application "Adobe InDesign CS6"
-- VERIFICA E DEFINIZIONE DOCUMENTO
try
set Tedesco to active document
on error
display dialog "Nessun documento aperto." buttons {"Annulla"} default button "Annulla" with icon 0
end try
set Titoli to {applied font:"Taz", point size:{15, 16, 17, 18, 19, 20}}
set Testo to {applied font:"Taz", fill color:"Black", point size:8}
set Didascalie to {applied font:"TazCd", fill color:"Black", point size:7.5} -- dev'essere "da 5 a 7.5"
set Sottotitoli to {applied font:"Taz" & tab & "Semibold", fill color:"White", point size:14}
tell Tedesco
set PagineTotali to count pages of Tedesco
repeat with PaginaCorrente from 1 to PagineTotali -- ripeti per tutte le pagine del documento
set locked of every text frame to false -- sblocca tutti i box di testo
set allTextBoxes to text frames of page (PaginaCorrente) -- seleziona tutti i box di testo della pagina
repeat with textboxnum from 1 to count allTextBoxes
set currentTextBox to item textboxnum of allTextBoxes
set myTextFrame to currentTextBox -- definisce myTextFrame il testo contenuto nel frame 1 della mia pagina
tell parent story of myTextFrame -- chiama tutto il contenuto di myTextFrame
set PrimoCarattere to object reference of text from character 1 to character 1 of paragraph 1 -- seleziona solo il primo paragrafo
tell PrimoCarattere -- chiama il testo selezionato
-- if label of properties of myTextFrame is not equal to "GoToTheNext"
if properties of every character of every text of ParagrafoUno is in Didascalie then
display dialog ("Didascalia")
set label of properties of myTextFrame to "GoToTheNext"
end if
end tell
-- set stileparagrafo to name of applied paragraph style of TestoTrovato -- definisce "stileparagrafo" il nome dello stile di paragrafo applicato al testo trovato
-- set stilecarattere to name of applied character style of TestoTrovato -- definisce "stilecarattere" il nome dello stile di carattere applicato al testo trovato
-- set corpo to point size of TestoTrovato -- definisce "corpo" la grandezza del corpo espressa in punti applicata al testo trovato
end tell
end repeat
end repeat
end tell
end tell
答
有通过文本框无需循环:你可以简单地通过文档中的故事环。
不幸的是,我在AppleScript的技能是零,但在这里是如何做到这一点的Javascript:
var myDocument = app.activeDocument;
for(myCounter = 0; myCounter < myDocument.stories.length; myCounter++){
if(myDocument.stories.item(myCounter).characters.item(0).appliedFont.fontFamily=='Arial' && myDocument.stories.item(myCounter).characters.item(0).appliedFont.fontStyleName == 'Regular'){
//copy paste the story here
var newDoc = app.documents.add();
var newTextFrame = newDoc.pages.item(0).textFrames.add();
newTextFrame.geometricBounds = [1, 1, 5, 5];
myCopy =myDocument.stories.item(myCounter).texts[0].duplicate(LocationOptions.AFTER,newTextFrame.insertionPoints[0])
}
}
希望这可以让你在正确的道路上