2017-10-06 6 views
0

J'ai ce problème.
Dans mon document je veux "scanner" chaque zone de texte et rechercher une première lettre spécifique avec la police appliquée spécifique et la taille appliquée (etcetera ...)
Si je le trouve, copiez l'histoire entière de l'élément de texte et passé dans un autre document
Si je ne trouve pas, la recherche d'un autre type de première lettre spécifique ...
Si je trouve, copiez toute l'histoire de l'élément de texte et passé dans un autre document
Si je ne trouve pas, la recherche un autre type de première lettre spécifique ...
Si je le trouve, copiez l'intégralité de l'histoire d'un texte et faites-le dans un autre documentSélectionnez une "histoire" par la police et la taille du caractère du premier caractère

l page de mon doc

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 

ou

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 ... 

mais ça n'a pas marché ... :-(

Mon AppleScript sont de-connaissance pire que mon mauvais anglais ... désolé.
Merci à l'avance pour chaque suggestion

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 

Répondre

0

Il n'y a pas besoin de boucle à travers les zones de texte: vous pouvez faire une boucle à travers les histoires du document.

Malheureusement, mes compétences en AppleScript sont nuls, mais voici comment le faire en 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]) 
     } 
} 

Espérons que peut vous mettre sur le droit chemin