Moving a rectangle - [CS2 VB Script]

Hi
I'm writing a scatter proof programme and I have no problem importing the graphics into separate graphic frames. The problem happens
when I attempt to move each frame into position.
I'm using this code:
        For myCounter = 1 To UBound(myFileList) + 1
            myFile = myFileList(myCounter - 1)
            Set myPage = myPages.Item(PageCount)
            Set myRectangle = myPage.Rectangles.Add
            myRectangle.GeometricBounds = Array(0, 0, 40, 40)
            myRectangle.strokeWeight = 0
            myRectangle.strokeColor = myDocument.Swatches.Item("None")
            myRectangle.place myFile
            myRectangle.Label
            myRectangle.fit idFitOptions.idFrameToContent
            Y1 = myRectangle.GeometricBounds(0)
            X1 = myRectangle.GeometricBounds(1)
            Y2 = myRectangle.GeometricBounds(2)
            X2 = myRectangle.GeometricBounds(3)
     myRectangle.GeometricBounds = Array (Y1 + 20, X1 + 20, Y2 + 20, X2 + 20)
            myRectangle.fit idFitOptions.idFrameToContent
       Next
If I don't use the second FrameToContent (the one before Next), the result is that the frame is moved but the graphic ends up zoomed
down to about 50% of normal size.
Putting in the second FrameToContent results in the graphic coming out the correct size, but the graphic frame doesn't move and remains
in the top left corner of the screen.
Is there a better way to move a graphic frame?
TIA
[Addendum]
What appears to be happening is that the graphic frame moves, but the graphic stays in its original position. I want to move the graphic
frame and move the contents by the same amount.
Message was edited by: John Galvin

Yes, I tried to group them first by
    Dim oGrp As GroupItem
    For Each oPageItem In oCurDoc.PageItems
        Set oGrp = oCurDoc.GroupItems.Add
        Set oPageItem = oGrp.PageItems.Add
        iCnt = iCnt + 1
        If iCnt > iPageItemCount  Then Exit For
    Next
     oCurDoc.Selection = oGrp
But the selection is always "empty" - nothing been selected.  Why?
Thanks.

Similar Messages

  • Embedded HTML is moving my rectangles

    Hello all,
    I'm embedding HTML (a Business Catalyst module) into my site and it moves down my two side rectangles.  I don't understand why because there's plenty of room.  I tried moving the rectangles (they're on a master page) backward, moving them to a separate layer, as well as moving the embedded HTML on the page they're on to a separate layer but nothing has helped.  Can someone please help me with this?
    I provided a link below.
    http://thecoffeebean.businesscatalyst.com/africa

    Yep, that's what I thought I'd see. The height of the box containing the HTML embed in Design view is important. It sets the minimum size of the output "div" and it also establishes the distance you'd like to have maintained between the item and what's below it. Thus in this case bottom of your HTML embed will remain above the top of the left side bar and when the HTML item ends up being much bigger on the live page everything will shift down.
    To fix this resize the HTML embed object in Muse Design view tall enough to contain a typical item from the module tag.

  • Moving a rectangle or change color in "Run-Time "?

    First step, the objects of decoration you can modify its properties in "Run-Time "?
    Moving a rectangle or change color in "Run-Time "?
    I want to develop a mini SCADA application, where I have to do some animations usingsimple objects like Shapes.

    Yes, it is possible to modify decorations in runtime. An example is below.
    As you can see, you just need to get a reference to the front panel containing the decoraitions, and then use the Decos[] property to get an array of references to the decorations. These can be passed to a property node.
    Unfortunately, the decorations cannot be given a unique identifier, such as a label. So if you have multiple decorations, it can be tricky to modify the properties of a specific one. If you are only dealing with one shape, this won't be an issue. One roundabout way to pick out a particular decoration would be to search through the array references until you find the one with matching size and location on the front panel. Alternatively, you could use a disabled control, such as a boolean push button with no caption, and refer to that directly.
    Hope this helps.
    -Garrett

  • Upgrade to Vista/Office 2007 blew my CS2 VBA script to heck...

    I am scripting a conversion program in Excel 2007. I cannot get the CreateObject to work. Period. The code worked fine under Office 2003 under XP, but now I get "Type Mismatch" at the
    Set MyInDesign = CreateObject("InDesign.Application.CS2")
    line of code. I have checked the references, and they are on for the InDesign CS2 type library. I have run this as both a standard user and as administrator. No joy.
    I did, however, go into Office 2007 macro settings and change the security settings to enable all macros and trust access to vba project object model. Once I did this, the above line of code generates an "Out of Memory" error.
    Yes, I shouldn't have gambled with changing a Microsoft product, but I figured we would eventually all be using Vista whether we wanted to or not, as Microsoft is dropping support and development of XP soon...
    But regardless, we are dead in the water... any ideas???
    Thanks!!!
    jdb

    Hi,
    Which type of email account are you using? If you are using Exchange or IMAP account, your items are usually delivered to and saved on the mail server. You can also view your items if you configure your email account in another PC.
    If it's only a pst-file in the local disk of your work pc, it's not possible to view the items unless you can go back to your work pc and copy the pst-file to your home pc. I'd like to let you know that a Personal Folders file (.pst) is an Outlook data file
    that stores your messages and other items on your computer. It won't sync to the mail server. See:
    http://office.microsoft.com/en-in/outlook-help/introduction-to-outlook-data-files-pst-and-ost-HA010354876.aspx
    Regards,
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • CS2 AS: Scripted "Import XML" is not working (like manual import does)

    I have problem where importing a XML (merge import + delete unmatched) by script simply doesnt work, where the manual import works 100% fine!!??
    (I'm exporting the XML, refill it with new text data (localisation process actually), and bring the xml back to commit the change in the Indesign document).
    With the script, the XML get imported as a child in the XML
    I have xml structure like:
    root
    node
    and get something like
    root
    node
    root
    node
    My code looks like this (sorry for the formatting):
    tell application "Adobe InDesign CS2"
    tell XML import preferences
    set create link to XML to false
    set ignore unmatched incoming to true
    set ignore whitespace to false
    set import style to merge import
    set import text into tables to false
    set import to selected to false
    set repeat text elements to false
    set remove unmatched existing to true
    end tell
    try
    import XML (document 1) from pFilePath
    on error pmsg
    display dialog pmsg
    end try
    end tell
    Is there something obvious that i'm misssing??
    ps: I have checked the XML structure correspondance already.. but i dont think that's the cause of problem as the manual import is working.
    Thanks for any help!
    Eric

    Hi Eric,
    If you can see the behavior in the user interface, you can see it in scripting. I think it makes perfect sense to have the XML import preferences set at the document level, because some documents need one set of preferences; other documents need another. I think (hope) that the user documentation covers the differences between application and document preferences (if not, I do, in my book).
    If you see a preferences object on both the application and the document, assume you want to use the document preferences. Unless you're trying to set preferences for new documents.
    Thanks,
    Ole

  • Understanding the app.batch method is CS2 JS scripting

    Hi,
    I'm a press officer in a fairly busy press office and I'm trying to automate my image-processing workflow for the images we put on our website...So far I've been using photoshop's (CS2) batch command to do this but it's not as performant as I would like it to be.
    For each of the pictures I have I need to produce
    - 'large'(1024px wide),
    - 'frontpage'(240px wide),
    - 'rollup'(85px wide) versions.
    I put all my original pictures in a source folder and the processed ones go to a destination folder. The only problem I've got is that I need to run the batch command three times for each format, plus photoshop asks me for JPEG options for each picture, so I can't really press a button and get away from my work station..
    So I've looked into scripting in javascript and have managed to automate some of my sipmle tasks but what I need to do here (producing images in three different formats with a specific file naming conventions) is obviously complicated.
    Now, reading the CS2 javascrip reference guide, I found that the app.batch method and all the options that go along with it (destinationFolder, fileNaming especially) might be what I'm looking for. The only problem is that i can't seem to find any examples (I've spent the last week searching) to help me using that method...
    Can anyone share an example of how you use this method so I can get my head around it?
    Thanks in advance!
    G

    Finding a version that works with CS2 might be a problem.
    xbatch may work. I haven't run it on CS2 in years.
    http://ps-scripts.cvs.sourceforge.net/viewvc/ps-scripts/xtools/apps/xbatch.jsx

  • [CS2 JS]Script UI Help !!!

    Hi,
    I want to create a dialog using Script UI . But i dont know where ro
    start with.Please tell the scripting reference.
    I found some sample in this forum which i tried is given below:
    var w = new Window( "dialog", "Example" );
    But when i run the script in Indesign i get an error like "Window is not a constructor".Where am i going wrong?Please guide
    Thanks in advance

    Hi myriaz,
    As Kasyan says (thanks, Kasyan!), use the dialog object. Most of the example scripts for CS2 contain a dialog--if you don't already have them, you can get them from the bottom of the InDesign scripting home page (a link is at the top of this forum).
    Thanks,
    Ole

  • CS2 VBA Scripts in CS5

    Hi everyone, I am using VBA via MS Excel to import data into InDesign CS2 templates. I am considering upgrading to CS5. Should my VBA scripts work in CS5, or do you suspect there would be a problem?
    Thanks everyone,
    Mike

    Mike,
    I split your question off to a new thread. Please don't tag questions onto other threads.
    The answer to your question depends on what's in your script, but there's quite a few changes to the object model from CS2 to CS5. You can try putting it into a version folder (i.e. "Version 4.0 Scripts").
    Harbs

  • Help with moving contact info using Apple Script in Address Book

    Hi folks,
    I wonder if someone can help? I imported a few hundred contacts via a Gmail created vCard into my Address Book. The problem is that instead of inserting the email addresses into one of the email fields for each record, it has inserted the email address into the Notes field as follows: "EmailAddress: [email protected]".
    I would like help to write an Apple Script that will search my contacts in Address Book, find those with "EmailAddress:" in the notes field, cut the email address that follows it, and pastes it into the Work Email field, carries out the operation for the whole address book and saves the changes.
    Can anyone help me write a script for this. I've not used Apple Script before so this will be my first attempt!
    Thanks in advance,
    ayworld

    This should work:
    tell application "Contacts"
      activate
              set thePeople to every person whose note contains "EmailAddress:"
              set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
              repeat with thePerson in thePeople
                   set nn to thePerson's note
                    make new email at end of emails of thePerson with properties {label:"Notes", value:text item 2 of nn}
              end repeat
      save
    end tell
    It will leave the entry in notes and make the label of the new email 'Notes"
    Normally when I post an AppleScript like this I tell the user to test it out before using it on the actual data but in this case I don;t know how you'd do that given there is only one Contacts and only one Contacts database.
    Just make sure you have a backup just in case. I tried it here on some dummy entries in my Contacts and it worked OK.
    Again this totaly relies on the data you presented. The Notes field has to be in the format
    EmailAddress:[email protected]
    for this to work.
    regards
    Message was edited by: Frank Caggiano - If you select all the text in the box, then right click and select Make new AppleScript the script will open in the AppleScript editor. Just make sure you get all the text it is easy to drop the first or last char when selecting.

  • CS2: Internal script execution error

    Hi,
    My Illustrator v12.0.0.5 send this error message every time when I'd like to run any VBScript. Any means not just my code but the original samples also. The JavaScript engine is working fine.
    Has anybody a good idea what can I do?
    The reinstall at this time is not the preferred way... Only there's no other way.
    Thanks in advance,
    Tom

    Ah, I'v caught that...
    The problem was the localization (because unfortunately I have a localized Illustrator CS2). The lovely translator translated the folder names in the filesystem but leaved them untouched in the registry entry of TypeLib...
    I fixed that and now it's working fine.
    Regards,
    Tom

  • CS2 JavaScript Scripting Reference

    Does anyone know if the reference guide is complete because
    The reference guide does not talk about ExportOptions JPEG where the user interface has a lot more optionsd like Image Quality, Resolution, Embed ICC Profile etc.
    Any help would be much appreciated.
    Regards
    Norbert

    The Javascript References (roughly one per application) are object-by-object, property-by-property, method-by-method references for looking up the descriptions of and syntax for specific objects, properties, and methods.
    The Scripting Guides provide more of a conceptual or introductory overview.
    > I don't know where to go to look up issues.
    That would depend upon what kind of issues. You mention an Acrobat-related scripting document. This is the Illustrator scripting forum.
    JET

  • Moving links in CS2?

    Here's my problem: I just finished working on a publication using photographs with massive file sizes. The printer that the job was sent to didn't require an InDesign package, so a high-res PDF was sent instead. As a result, I never made a package of the file and left it as is until I had a moment to back up. Now, I've found myself with less than 5 gb of HD space and a file + links and fonts that total to almost 10 gb. Is there anyway to collect the links WITHOUT making duplicates of them, or is there a quick way to locate the files in the finder so I can move them to a separate folder? I could scour the rest of my HD for other files/applications that are sucking up HD space, but this one is obviously the most guilty culprit and would solve the problem immediately.

    I'd think about getting an external hard drive.
    Then on the links panel you can go to "Copy Links to" and copy them to an external hard drive.
    Otherwise, I think you'll have to go to the first image and go to "Reveal in Explorer" in the Links panel flyout menu.
    Do this for all the images and move them manually.
    I'm not aware of a way to move images, only copy them.

  • Why my code(CS2 VB Script) only pastes what on the clipboard, not everything I select?

    I have created a graph, now I want to copy the entire thing to a new document.  I used the following code.  Even visually you can see it selected everything in the document, but when it pasted to a new document, it only pasted what's left on the clipboard, not everything as I wanted. 
    What's wrong here? Does it have anything to do with grouping?  See code below.
    Please help!  Thanks.
        Dim oCurDoc As Illustrator.Document
        Set oCurDoc = oApp.ActiveDocument
        Dim iPageItemCount As Integer
        iPageItemCount = oCurDoc.PageItems.Count - 1
        Dim vItems() As Variant
        ReDim vItems(iPageItemCount)
        Dim oPageItem As Object
        For Each oPageItem In oCurDoc.PageItems
            Set vItems(iCnt) = oPageItem
            iCnt = iCnt + 1
        Next   
        oCurDoc.Selection = vItems
        Dim oNewDoc As Illustrator.Document
        If oApp.Documents.Count > 0 Then
            If TypeName(oCurDoc.Selection) = "Variant()" Then
                oCurDoc.Copy
                Set oNewDoc = oApp.Documents.Add(aiDocumentRGBColor)
                oNewDoc.Paste
            End If
        End If

    Yes, I tried to group them first by
        Dim oGrp As GroupItem
        For Each oPageItem In oCurDoc.PageItems
            Set oGrp = oCurDoc.GroupItems.Add
            Set oPageItem = oGrp.PageItems.Add
            iCnt = iCnt + 1
            If iCnt > iPageItemCount  Then Exit For
        Next
         oCurDoc.Selection = oGrp
    But the selection is always "empty" - nothing been selected.  Why?
    Thanks.

  • Help needed to update CS2-script to CS3

    Folks,
    I am no good at scripting myself (its on my to-do-list), but a friend of mine has a problem with this script, that wont work in CS3. I know that the syntax is wrong, but am unable to do solve this. Who can help?
    var thecount = app.documents.length;
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences = NothingEnum.nothing;
    var myDocument = app.activeDocument;
    var mysearchitems = ["", "Double Paragraph", "Double Tab", "Double Space", "Para Tab", "Para Space", "? space", "Fullstop Double Space"]
    var mychangeitems = ["", "Single Paragraph", "Single Tab", "Single Space", "Para Tab", " Tab", "Fullstop Single Space"]
    var theClass = myDocument.selection
    if (theClass == ""){
    var searchOptions = ["Document"];
    else {
    var searchOptions = ["Document", "Selection", "Story"];
    //now to create the dialog
    var myDialog = app.dialogs.add({name:"Masterfoods B - zoek en vervang (© Hans de Bijl)", canCancel:true});
    with (myDialog){
    with (dialogColumns.add()){
    with (borderPanels.add()){
    with (borderPanels.add()){
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Zoek:"});
    with (dialogColumns.add()){
    var myvijffindfield = textEditboxes.add({minWidth:180});
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Vervang:"});
    with (dialogColumns.add()){
    var myvijfchangefield = textEditboxes.add({minWidth:180});
    with (borderPanels.add()){
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Zoek:"});
    with (dialogColumns.add()){
    var myzesfindfield = textEditboxes.add({minWidth:180});
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Vervang:"});
    with (dialogColumns.add()){
    var myzeschangefield = textEditboxes.add({minWidth:180});
    with (borderPanels.add()){
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Zoek:"});
    with (dialogColumns.add()){
    var myeighthfindfield = textEditboxes.add({minWidth:180});
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Vervang:"});
    with (dialogColumns.add()){
    var myeighthchangefield = textEditboxes.add({minWidth:180});
    with (borderPanels.add()){
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Zoek:"});
    with (dialogColumns.add()){
    var myninthfindfield = textEditboxes.add({minWidth:180});
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Vervang:"});
    with (dialogColumns.add()){
    var myninthchangefield = textEditboxes.add({minWidth:180});
    with (borderPanels.add()){
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Zoek:"});
    with (dialogColumns.add()){
    var mytienfindfield = textEditboxes.add({minWidth:180});
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Vervang:"});
    with (dialogColumns.add()){
    var mytienchangefield = textEditboxes.add({minWidth:180});
    with (borderPanels.add()){
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Zoek:"});
    with (dialogColumns.add()){
    var myelffindfield = textEditboxes.add({minWidth:180});
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Vervang:"});
    with (dialogColumns.add()){
    var myelfchangefield = textEditboxes.add({minWidth:180});
    with (borderPanels.add()){
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Zoek:"});
    with (dialogColumns.add()){
    var mytwaalffindfield = textEditboxes.add({minWidth:180});
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Vervang:"});
    with (dialogColumns.add()){
    var mytwaalfchangefield = textEditboxes.add({minWidth:180});
    with (borderPanels.add()){
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Zoek:"});
    with (dialogColumns.add()){
    var mydertienfindfield = textEditboxes.add({minWidth:180});
    with (dialogColumns.add()){
    staticTexts.add({staticLabel:"Vervang:"});
    with (dialogC

    Hi Bert,
    Find and change in InDesign CS3 changed quite a bit from CS2, and scripting changed as well. Tell your friend to look at the examples of find and change in the Text chapter of the Adobe InDesign CS3 Scripting Guide: JavaScript--you can find the PDF and the associated scripts at:
    http://www.adobe.com/products/indesign/scripting/index.html
    ...and click the Scripting Resources tab.
    In brief: the search method was removed, and find and change methods corresponding to the find/change type were added (findText, changeText, findGrep/changeGrep, findGlyph/changeGlyph). The find/change preferences objects were also removed, and preferences objects corresponding to the new find/change types were added (findTextPreferences, changeTextPreferences, findGrepPreferences, changeGrepPreferences, findGlyphPreferences, changeGlyphPreferences).
    Thanks,
    Ole

  • ExtendScript for CS3 and CS2

    I recently created a CS3 script but also need to make a CS2 version for some of the PC's that have not moved over to CS3. I currently have both CS2 and CS3 installed on my PC for this reason.
    The issue I'm have is that ExtendScript for CS2 does not seem to work properly.
    For example in CS3 to add a layer I did:
    try{
    myDocument.layers.item("Slug").name;
    catch (myError){
    myDocument.layers.add({name:"Slug"});
    to achieve the same in CS2 I did:
    var mysluglayer, myactlayer;
    mysluglayer = app.activeDocument.layers.item("Slug");
    try{
    mysluglay = mysluglayer.name;
    catch(myError){
    mysluglayer = app.activeDocument.layers.add({name:"Slug"});
    Now when I run it in ExtendScript I get and error on:
    mysluglay = mysluglayer.name; ---> Object is invalid.
    If I run the script from ID CS2 the script works.
    Is this because I have 2 versions of ExtendScript on my PC?
    The other issue is I'm trying to set Layer 1 as the active layer after by:
    myactlayer = app.activeDocument.layers.activeLayer('Layer 1');
    try{
    myactlay = myactlayer.name
    catch (myError){
    myactlayer = app.activeDocument.layers.item('Layer 1');
    The error I get is app.activeDocument.layers.activeLayer is not a function
    Is this option available in CS2 or is it only available in CS3?

    LayoutWindow is an object class. To access a member of the class, you need to address the property of the parent object. So:
    app.documents[0].layoutWindows[0].activeLayer = "Layer 1"
    is what you need.
    Except that that doesn't work! This looks like a documentation problem. If you run that you get an error message to the effect that it was expecting a layer object or a string. But actually, it doesn't take a string, because (I think) layer objects are properties of the document, not the window. So, instead, you must use:
    myLayer = app.documents[0].layers.item("Layer 1");
    app.documents[0].layoutWindows[0].activeLayer = myLayer;
    Dave

Maybe you are looking for