2017-10-06 55 views
0

我有這個問題。
在我的文檔中,我想「掃描」每個文本框,並搜索特定應用字體和應用大小的具體第一個字母(等等...)
如果我找到它,複製文本項目的整個故事,另一份文件
如果我沒有找到,搜索其他類型的特定的第一個字母...
如果我找到它,複製文本項目,過去,它的整個故事,在另一個文件
如果我沒有找到,搜索另一種類型的具體的第一個字母...
如果我找到它,複製文本項目的整個故事,並在另一個文檔中過去它按第一個字符的字體和大小選擇「故事」

那對於人我的文檔

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 

回答

0

有通過文本框無需循環:你可以簡單地通過文檔中的故事環。

不幸的是,我在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]) 
     } 
} 

希望這可以讓你在正確的道路上

相關問題