1 2 3 2 Previous Next 61 Replies Latest reply: Aug 20, 2007 4:56 AM by (DaveSaunders) Go to original post RSS
      • 50. Re: With CS2, some things have changed
        Community Member
        Ah, that's a different issue. There is a bug that I reported a month or so ago. I'm not sure if I reported here, though. Here's how I got around the problem of the no-iteraction flag in the place command not working:

        // 1. Import Excel File

        var myFile = File.openDialog("Choose an Excel file");
        if (myFile == null) { exit() }

        if (app.version == 3) {
         app.userInteractionLevel = UserInteractionLevels.neverInteract;
        } else {
         app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
        }

        myDoc = app.documents.add();
        setXLimportPrefs();
        try {
         myDoc.pages[0].place(myFile,[0,0],undefined,false,true);
        } catch (e) {
         alert (e + " " + app.excelImportPreferences.errorCode);
         exit();
        }
        if (app.version == 3) {
         app.userInteractionLevel = UserInteractionLevels.interactWithAll;
        } else {
         app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
        }

        [snip]

        function setXLimportPrefs() {
         with (app.excelImportPreferences) {
          alignmentStyle = [AlignmentStyleOptions.spreadsheet,
            AlignmentStyleOptions.leftAlign,
            AlignmentStyleOptions.rightAlign,
            AlignmentStyleOptions.centerAlign][0];
          //decimalPlaces = 3;
          //errorCode = 0;
          //preserveGraphics = true; // Not sure what this does either
          //rangeName = ""; // Hopefully leaving this blank will cause ranges to be ignored
          //sheetIndex = 0;
          //sheetName = "";
          //showHiddenCells = true;
          tableFormatting = [TableFormattingOptions.excelFormattedTable,
            TableFormattingOptions.excelUnformattedTable,
            TableFormattingOptions.excelUnformattedTabbedText][1];
          useTypographersQuotes = true;
          //viewName = "";
         }
        }

        As you can see, I ended up commenting out most of the import preferences.

        Oh, this is JavaScript, so you'll need to translate.

        Dave
        • 51. Re: With CS2, some things have changed
          Thanks for your script Dave.

          But the problem is the same, because you can't specify the sheet and zone you want to import in your script. It seems I should have a file for each sheet in the excel file :(

          Serge
          • 52. Re: With CS2, some things have changed
            Hi Dave

            I finally decided to try make an import in Javascript and it works a lot
            better. I "uncommented" the following lines

            sheetName = "mysheetname";
            rangeName = "xx:yy";

            And it work perfectly well! selecting the right sheet!

            I think there is a problem with the VBS feature. I'll continue in javascript then.

            Thanks for your help.
            Serge
            • 53. Re: With CS2, some things have changed
              Community Member
              Ah, I was going to asked if you'd tried uncommenting those two lines. Glad it worked.

              Dave
              • 54. Re: With CS2, some things have changed
                I am not a scripter but I'm hoping someone can help me with a problem given that it's likely to be small. The script below works in version 2.0 but not version CS2. This handy little thing saves me hours of work!

                Any help is very much appreciated.

                tell application "Adobe InDesign CS2"
                tell document 1
                set theSelection to selection

                repeat with anItem in theSelection
                set theTarget to anItem
                set theClass to class of theTarget
                if theClass is in {EPS, PDF} then -- if the image is selected by direct tools
                set theTarget to parent of anItem
                end if

                if page item 1 of theTarget exists then
                tell theTarget
                «event K2 fitc» given «class givn»:content to frame
                set horScale to round (horizontal scale of page item 1) + 0.5
                -- add 0.5 %
                set vertScale to round (vertical scale of page item 1) + 0.5
                -- add 0.5 %

                if horScale is greater than vertScale then
                set vertical scale of page item 1 to horScale
                set horizontal scale of page item 1 to horScale
                else
                set horizontal scale of page item 1 to vertScale
                set vertical scale of page item 1 to vertScale
                end if
                «event K2 fitc» given «class givn»:center content
                end tell
                end if
                end repeat
                end tell
                end tell
                • 55. Re: With CS2, some things have changed
                  sstanleyau Community Member
                  tell application "Adobe InDesign CS2"<br />    set theSelection to selection<br />    <br />    repeat with anItem in theSelection<br />        set theTarget to anItem<br />        if exists graphic 1 of theTarget then<br />            set theTarget to graphic 1 of theTarget<br />        else<br />            set theClass to class of theTarget<br />            if theClass is not in {EPS, PDF} then<br />                set theTarget to {}<br />            end if<br />        end if<br />        if theTarget is not {} then<br />            tell theTarget<br />                fit parent given fill proportionally<br />                set horScale to round (horizontal scale) + 0.5<br />                -- add 0.5 %<br />                set vertical scale to horScale<br />                set horizontal scale to horScale<br />                fit parent given center content<br />            end tell<br />        end if<br />    end repeat<br />end tell<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
                  • 56. Re: With CS2, some things have changed
                    Thanks Shane. People like you make the world a better place!
                    • 57. Re: With CS2, some things have changed
                      Community Member
                      I couldn't find any of the commands for dealing with InCopy stories in the scripting reference. Commands like check in and check out. I looked under Links and under Stories and did a search for InCopy. Am I looking for the wrong thing?

                      ID has made it easy to export all stories to InCopy, but it doesn't make it easy to unlink. You have to select all the stories in the links pallet, choose check out and then unlink. It doesn't seem like much, but if you have 40 documents with multiple InCopy stories each, it can be time consuming. There is also no way to do a global check out of all IC stories in all the open documents which would be handy for making global changes like changing a font or doing an all documents find/replace.
                      • 58. Re: With CS2, some things have changed
                        pkahrel MVP
                        duplicate() has changed. In CS2 you can now add an offset to duplicate an object at a certain position. To duplicate an object and move the duplicate 4cm to the right and 3cm down, this can be done with one statement in CS2:
                        myObject.duplicate(['3cm',4cm'])
                        

                        In CS1 you need two steps: duplicate and move:
                        myObject.duplicate()
                        
                        myObject.move(undefined,['3cm',4cm'])

                        Peter
                        • 59. Re: With CS2, some things have changed
                          Is there a breakdown on the change of syntax for AppleScript as well? I have run into a few problems with updating scripts for CS2, and while I have been able to find the solutions with the help of this thread and the scripting guide the latest one I don't see a reference to. Specifically making an inline graphic (rectangle) in the text flow is not working in CS2.
                          • 60. Re: With CS2, some things have changed
                            can u tell how to place assets in a library using adobe indesign CS3
                            • 61. Re: With CS2, some things have changed
                              Community Member
                              I answered in the topic: With CS3, some things have changed.

                              Dave
                              1 2 3 2 Previous Next