4 Replies Latest reply on Jun 14, 2011 7:12 AM by davidpeterwilliams

    Please take pity on me!

    davidpeterwilliams

      I am desparately trying to get my head round the makeup of scripts. I have tried to read a few guides but become confused very quickly.

       

      Firstly I need a good guide for writing and working with javascript/applescript starting from the beginning explaining things thoroughly!

       

      Secondly, I need a script. I have tried making my own frankenstein script taking parts of other scripts but I just cant understand it.

       

      My script will apply a cell style to any given selection in a table

       

      i.e. highlight 1 row, column or cell, run the script and this will apply the relevant cell style.

       

       

      Kind Regards

      Dave Williams

        • 1. Re: Please take pity on me!
          Mary Posner Level 3

          Okay, consider yourself pitied. <g> Hey, we all have to start somewhere.

           

          As a very simple quick start in AppleScript, you might want to take a look at this PDF, "AppleScript for Absolute Starters": www.fischer-bayern.de/as/as4as/AS4AS_e.pdf

           

          For a much more detailed step-by-step tutorial, Sal Soghoian's "AppleScript 1-2-3" is a great resource. It's available on Amazon and other booksellers.

           

          Now, down to your question. Maybe I'm missing something, but I don't understand what you're trying to script. Given the steps you mentioned:

           

          i.e. highlight 1 row, column or cell, run the script and this will apply the relevant cell style.

           

          ... if you are manually making the selection, how would running the script be different from simply selecting the cell style from the cell style panel?

           

          Can you elaborate on what you want the script to do that's different from just using the panel?

           

           

          (And a forum etiquette hint -- next time, you might want to write a subject line that's descriptive of the actual problem you're trying to solve. You'll be more likely to find someone with specific expertise in cell styles if you put that in the title.)

          • 2. Re: Please take pity on me!
            davidpeterwilliams Level 1

            Many thanks for your reply Mary,

             

            Thanks for your recomendations I will definately give them a go!

             

            Place a table from excel into ID. Make sure the excel file is called in as a link (ID preferences/file handling/create links when placing text&spreadsheet files).

            Style up your table with cell and paragraph styles.

            Now go back to the linked excel file and change a figure.

            Go back to your ID file and update the link !

            The updated table goes back to basic paragraph and basic cell styles. WHY?

             

            Whilst trawling through forums on why ID does this I observed that a couple of people from different forums all seemed to suggest that the only way to keep the styles when updating links is to apply the cell styles with a script.

             

            Bearing in mind the tables in question have different cells styles i.e. header row, body row and total row so I need to select one row at a time the run a different script for each different type of row style.

             

            I know I could just not link excel file and make the change in the actual ID file but this is not always an option for me and having this script would allow me to keep styling and save me lots of time.

             

            Im using cs4.

             

            Kind regards

            Dave Williams

             

            ps. apologies for my poor forum etiquette - Im new here

            • 3. Re: Please take pity on me!
              Mary Posner Level 3

              Hi, David,

               

              Sorry for the late reply. Gotta love summer Fridays....

               

              And I'm afraid I'm not going to be much help to you. I've never worked with linked Excel files and only briefly worked with cell and table styles. I did a quick test going through the steps you mentioned and it worked fairly well for me, once I had the table and cell styles set up -- it did retain the formatting and updated only the content. When you placed the file initially, did you choose "unformatted"? Again, no Excel expert here, but if it was originally placed as formatted, it might be updating using whatever formatting (or lack thereof) is in your Excel document.

               

              If that doesn't work for you, you might want to re-post your question with a more specific subject line mentioning Excel and that you're losing formatting on updating the link. There's bound to be someone on this forum who knows more about these areas!

               

              Mary

              • 4. Re: Please take pity on me!
                davidpeterwilliams Level 1

                Im not interested in excel. I used this as an example for the script that I am trying to get.

                 

                I want to select a row and then run the script which will apply a cell style and paragraph style.

                 

                Thanks

                Dave Williams