in

Quark Forums

Quark to xPress Tags - All stories

Last post 04-12-2010 7:39 AM by myeager. 33 replies.
Page 1 of 3 (34 items) 1 2 3 Next >
Sort Posts: Previous Next
  • 08-20-2009 1:34 PM

    Quark to xPress Tags - All stories

    Is there a way by which we can save all text from all story in a quark file as an xPress tag file?  If yes please share the apple script code...

    I am new to Quark and Apple Script.. I am working on a logic to reduce errors in a quark typeset document 

    Thanks in advance

    smrkeyanSmile

     

  • 08-20-2009 4:55 PM In reply to

    Re: Quark to xPress Tags - All stories

    This seems to work. I just tried it a couple of times. If your hard drive is called something besides "Macintosh HD", you'll want to change that part of the script. You may also need to change "QuarkXpress" if you are working with a differently named version of Quark. This doesn't combine all the stories into one, so it may be too simple for your needs. I think it will pick up every "story", so if there are running heads on each page, or drop folios,or captions under pictures, each one will be a separate xpress tags file. But it may be useful in some situations.

    If you're new to Quark and Applescript, you have many happy hours ahead of you. Each one has its quirks and surprises.

    tell application "QuarkXPress"
        tell document 1
            set storyCount to count of stories
            repeat with thisStory from 1 to storyCount
                tell story thisStory
                    save text 1 as "xpress tags" in "Macintosh HD: Test" & thisStory & ".txt"
                end tell
            end repeat
        end tell
    end tell

  • 08-21-2009 11:27 AM In reply to

    Re: Quark to xPress Tags - All stories

    HI,  Thanks for your reply..  I will try and let you know my experience...

    Actually.. i was incharge of quality for my team.. and my team faces problem with column alignment..irrespective of guides they use while working on quark..becoz of job pressure..

    myidea for my team is to create a macro that will check the tab positions in xpress tags and highlight the alignment errors...

     is that idea will work?  or do you have any other idea on how to fix the column alignment..(pls consider job pressure also)?

    Thanks, smrkeyan

     

  • 08-22-2009 3:43 AM In reply to

    Re: Quark to xPress Tags - All stories

    From what you've said, it's hard to think how using xpress tags would be helpful. It would be an extra step. Applescript alone can get and set tabs. However, I don't know whether it would be able to highlight errors. How would it know an error? And how would it highlight? Highlighting many pieces of text at the same time is not something you can do easily in Quark.

    It would help to know more about how your team is working, and what text they are working on, and what is the problem. Could you post some lines of the text they have to work with?

    Or could you e-mail me some screen shots with Guides and Invisibles showing? Or even some documents? Just click on my name over the picture at the left to get to the e-mail option.

  • 08-23-2009 10:34 AM In reply to

    Re: Quark to xPress Tags - All stories

    Hi..

     

    Ok.. let me try to explain the process clearly this time

     

    Our document looks like below

                            Col1     Col2     Col3

                            X         Y          ZZZZZZZZ

    Row1A            10        20.0     $30

    Row2B            5          30.0     $400

    Row3C            666      12.2     40 nos

    …..

    ……

    ……

    Row500           6          12.2     120 nos

      

    We spend time in creating styles for alignments and use tab grabber for aligning the values to the centre of the column head “X” “Y” “ZZZZZZZ    while doing so, the tab positions in some of the rows is not matching exactly with other rows (my guess tab positions should match in all the rows for proper alignment) (we use necessary guides to check the column alignment)

     

    We need to calculate

    The maximum value in each column

    How values should be aligned

    How column heads should be aligned

    Etc..

     

    For this what I thought of is

     

    Once quark document is read

    Save text as Xpress tag file (eg. tab position will be saved as <*t(120, 1, “1 “)>)

    Open this file in a word document

    If all tab positions in quark are correct then Xpress tags will display as <*t(120, 1, “1 “)>) in all the rows

    Imagine if few tab positions in few rows were wrong then Xpress tags will display it as <*t(115, 1, “1 “)>)

    Create a macro and highlight all the wrong tab positions in this case <*t(115, 1, “1 “)>) in word file

     

    Exceptions..

    If all rows has wrong tab positions macro will not highlight

     

    Hope this is better from my previous message..

  • 08-24-2009 5:29 PM In reply to

    Re: Quark to xPress Tags - All stories

    Hi, smrkeyan,

    I got your e-mail, but I'll reply here in case anyone else sees this and can offer some help.

    I'm still trying to understand what you are looking for. It sounds like you are starting with a quark document that has hundreds of lines of tabbed text and numbers, and you want a macro that will:

    --calculate the maximum value for each column

    --determine (by their content) how values should be aligned

    --determine how column heads should be aligned

    --and then create the xpress tags that will set up the proper tabs based on this information

    Is that what you are looking for? It is probably too complicated for me, but someone may already have a solution. But if you want to send me some real xpress tags from a real Quark document I'd be happy to give it a try. However, I would not try and do anything in Word, because I don't know the language (Visual Basic?).

    But you also mention highlighting xpress tags, and I'm confused about what you mean. Do you mean, after someone has set up the tabs in a Quark document, and you save the document as xpress tags, THEN you want to change this:

    <*t(120,1"1 ")>

    <*t(120,1"1 ")>

    <*t(115,1"1 ")>

    <*t(120,1"1 ")>

    To this:

    <*t(120,1"1 ")>

    <*t(120,1"1 ")>

    Error:<*t(115,1"1 ")>

    <*t(120,1"1 ")>

    You could do that easily in TextWrangler as a grep search, but someone would have to set up the search.

    I'm also wondering how your team is creating the tables. If I have to make a table where each row is just 1 line tall, I copy the longest word or number from each column to make a new row, set up the alignments for that row, and copy the alignment to all the other rows. This works pretty well, it's quick, and all the alignments are the same.

    Please feel free to send me a whole set of xpress tags from a real document, or some PDFs, so I can get a better idea of what you are working on.

  • 08-25-2009 11:43 AM In reply to

    Re: Quark to xPress Tags - All stories

    hi..

    my comments are underlined

    --calculate the maximum value for each column
    --determine (by their content) how values should be aligned
    --determine how column heads should be aligned
    --and then create the xpress tags that will set up the proper tabs based on this information ////we are not creating xpress tags that sets the tab position..rather we are greating xpress tags from quark file and checking whether tab positions are correct in all the rows ////

    To this:

    <*t(120,1"1 ")>
    <*t(120,1"1 ")>
    Error:<*t(115,1"1 ")> - we want to highlight this row as the tab position is incorrect (tab position is not constant it will vary depending upon the widest value in the column) 
    *t(120,1"1 ")>

    You could do that easily in TextWrangler as a grep search, but someone would have to set up the search. //// can we create a grep search that will get the tab position from Quark and checks whether rows in the table has the same position ////////

    sorry we should not share the document we process -=

    waiting for your reply...

  • 08-25-2009 5:28 PM In reply to

    Re: Quark to xPress Tags - All stories

    Here are some things that might be useful. These are just starting points for checking rows.

    This script can highlight rows in Quark:

    tell application "QuarkXPress"      

    tell document 1           

    tell story 1                

    set tabList to tab list of paragraph 1                

    set rowCount to count of every paragraph                

    repeat with i from 1 to rowCount                     

    try                          

    if tab list of paragraph i is not equal to tabList then                               

    set color of text of paragraph i to "Red"                          

    end if                     

    end try                

    end repeat           

    end tell      

    end tell

    end tell

    ------------------------- [This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

    This script can fix tabs in Quark:

    tell application "QuarkXPress"      

    tell document 1           

    tell story 1                

    set tabList to tab list of paragraph 1                

    set rowCount to count of every paragraph                

    repeat with i from 1 to rowCount                     

    try                          

    if tab list of paragraph i is not equal to tabList then                               

    set tab list of paragraph i to tabList                          

    end if                     

    end try                

    end repeat           

    end tell      

    end tell

    end tell

    ------------------------- [This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

    These are very simple scripts. They are mostly just for testing. They should work on a Quark document that has just 1 story, and the "story" only has rows of tabbed text. You can see that they get info from paragraph 1, and use that info to check the other paragraphs.

    To try these, copy one section of the colored text (each "section" is 15 lines of text). Open Script Editor from inside the Applescript folder of the Applications folder. Open a new Script Editor window, paste the text in there, and click Compile or (press command k). You can save the script anywhere, but if you save in inside the Scripts folder inside the QuarkXpress folder (in Applications), then you can run the script right from within Quark. (I'm not sure if the Script icon is always available in the Quark menu bar...if it's not there, just run the script from Script Editor by clicking Run).

    Here's how you could do a grep search in TextWrangler. This is also a simple test method, to see if it does the basic function you need.

    Save the xpress tags for the table ONLY (this is to make the test easier). Open the xpress tags document in Textwrangler.

    Use the cursor to highlight one instance of the correct tags, for instance, <*t(120,1"1 ")>

    With the text still highlighted, choose Find... from under the Search menu. The Find and Replace window should open.

    Check the Use Grep check box if it is not already checked, then click the "SS" button to the left of the check box. (It's not exactly SS, it's like a "section" symbol). What this does is load the selection into the Find box with the proper escapes (i.e., backslashes).

    The selection <*t(120,1"1 ")> should now look like this in the Find and Replace: <\*t\(120,1"1 "\)>

    Add a caret (^) to the beginning: ^<\*t\(120,1"1 "\)> This caret means, Look only at the start of each line.

    Add some parentheses for grouping: ^(<\*t)(\(120,1"1 "\)>). Two sets of parens were added: ^(<\*t)(\(120,1"1 "\)>)

    Add the "negative look ahead" argument, which is "?!" (but no quotes): ^(<\*t)(?!\(120,1"1 "\)>)

    Okay, find side is done.

    In the replace side, put in "Error\1" (without the quotes) "Error" is just a word, you can use any word you like, and backslash 1 (\1) recalls the contents of the first set of parens on the Find side: (<\*t).

    Check the "Start at top" check box and start searching. The search should find all the "wrong" xpress tags, and mark with the Error message when you click replace.

    Got to go now, but maybe some of this will help. Let me know what you think, and I'll try and help develop something more complex. The hardest part of all this is getting it formatted for the forum using Safari browser.

  • 08-26-2009 3:19 AM In reply to

    Re: Quark to xPress Tags - All stories

    Here's a little better version of the highlighting script that works within Quark. If the operator selects a paragraph that has tab settings, this script will highlight the paragraphs that don't have the same tab settings. It's set up to turn text red for highlighting.

    It seems easier to do this directly in Quark instead of exporting Xpress tags. Please let me know if this is useful.

    Thanks to Jean-Marie Schwartz for his post in the "syntax for 'current' paragraph" thread on Publi-Script Forums. I couldn't figure out how to reference a selected paragraph.

    This seems to work as long as some part of the paragraph is selected--even one letter.

    tell application "QuarkXPress"

    activate

    tell document 1

    set sel to the selection

    set tabList to tab list of paragraph 1 of sel

    tell story 1

    set rowCount to count of every paragraph

    repeat with i from 1 to rowCount

    try

    if tab list of paragraph i is not equal to tabList then

    set color of text of paragraph i to "Red"

    end if

    end try

    end repeat

    end tell

    end tell

    end tell

  • 08-26-2009 10:56 AM In reply to

    Re: Quark to xPress Tags - All stories

    Hi

    Thank you so much for your suggestions..i will try this and let you know my experiences...

    why i choose xpress tags initially is becoz of (align on character - "%" or ")" or "*"), alignment (left, right, center)... also we need to consider a) entries with $ and b) entries without $ (bcoz an extra tab is set inbetween $ and value and $ is aligned to widest character)...

    i stongly beliver you will have answer to the above situations...

    Thanks,  smrkeyan

     

  • 08-26-2009 4:46 PM In reply to

    Re: Quark to xPress Tags - All stories

    I think the Applescript picks up all the information that is in the Xpress tags--the "align on" character, the alignment, and the tab position (along the ruler). You can run this script to see the information. Make sure the "Result" button at the bottom of the Script Editor window is highlighted, because that's where the the info will show up. The script is set for paragraph 1 of story 1 of an open Quark document...but you can change paragraph and story numbers if needed. I think you can click the link below to open the Script Editor automatically.

    --Click here to open this script in a new Script Editor window.

    tell application "QuarkXPress"
        tell story 1 of document 1
            tab list of paragraph 2
        end tell
    end tell

    As far as what you say here:

    "also we need to consider a) entries with $ and b) entries without $ (bcoz an extra tab is set inbetween $ and value and $ is aligned to widest character"

    can't there just be an extra tab (that is, press the tab key on the keyboard 2 times) in the entries that don't have the $? That way, every row could have the same tab stops (set with the little ruler and tab arrows). The extra tab from the keyboard would push the material past the tab stop for the $ (for the entries that don't contain the $ character), to the next alignment point.

  • 08-27-2009 7:32 AM In reply to

    Re: Quark to xPress Tags - All stories

    Hi.. Its working very well. Thanks.

    challenges we have currently is with the align on and the fill characters in the Tab List..  we would like to check only the position of the tab by ignoring the align on and fill characters..

    ///// set tabList to tab list of paragraph 1 of sel  /////

    from the above line we want to set only the tab position to the tabLilst. eg.. tab positions -120, align on and fill characters should be 0 by default or ignored

    set list_of_tab to {{justification:left justified, fill character:" ", position:"24 mm"}} - this i got by searching applescript code.. hope it helps you to help me Smile

    waiting for your suggestions...

    Thanks

  • 08-28-2009 2:28 AM In reply to

    Re: Quark to xPress Tags - All stories

    I'm having trouble altering the "tab list" so that it can ignore the align on and fill characters. In fact, I'm having trouble even getting Applescript to read the contents of a tab list--that is, I can't get Applescript to tell me if a tab list contains align on or fill characters. All I can do so far is "get" and "set" a tab list. I'll post a query about the problem here on the forum and do some searching to see if I can figure this out.

    Also, there may be a more basic problem with trying to ignore the "align on" character. If you take the align on character out of the tab list, the tab stop acts like a "Left" tab. You can try this out by using get and set.

    For example, "get tab list of paragraph 1" returns this for a paragraph with 2 tabs:

    {{justification:align on, align character:"$", position:"6p"}, {justification:align on, align character:"$", position:"12p"}}

    I take out the $ (by hand), and use the result to "set tab list of paragraph 2 to ":

    {{justification:align on, align character:"", position:"6p"}, {justification:align on, align character:"", position:"12p"}}

    The 2 tabs now act just like Left align tabs. Perhaps the position alone is not enough--the justification has to be considered as well. Please consider this and let me know what you think.

  • 08-28-2009 7:46 PM In reply to

    Re: Quark to xPress Tags - All stories

    hi,

    Thanks, we almost got the solution to the alignment problem.

    As the no. of columns in the table are different we will not prefer/suggest our team members to delete align on character and run the script.. this will become an extra task

    we should find a way by which only the tab position in paragraph 1 is compared with other paragraphs..

    set tabList to tab list of paragraph 1 of sel

    can we edit the above code as... set tabList to position of tab list of paragraph 1 of sel ??

    Thanks, smrkeyan 

     

  • 08-29-2009 4:14 PM In reply to

    Re: Quark to xPress Tags - All stories

    Hi, smrkeyan

    Looks like you edited that post since I looked at it before.

    You can't set a tab with just a position. A tab must also have a justification.

    That is, it must be set to left, center, right, decimal, comma, or align on. So the choice would be

    set tabList to justification and position of tab list of paragraph 1 of sel

    or

    set tabList to (some other justification) and position of tab list of paragraph 1 of sel

    Would either of these choices work for you? I think the second choice could be set up with a dialog box so the operator could choose which justification to use.

Page 1 of 3 (34 items) 1 2 3 Next >
Powered by Community Server (Commercial Edition), by Telligent Systems