[JS] [CS3] Getting references of items

Hi
I am working with an InDesign file that has been built with an applescript.  The page contains a mixture of text and image frames, drawn in a grid style (see attached).
I need to somehow be able to toggle through each item, and get a reference on the order the object was drawn on the page. When I get all items:
myDocFrames = myDoc.allPageItems;
the order the page items are returned is NOT the order they were drawn on the page.  Is there another reference, maybe an ID number that I can use to act as my reference?
Once I can work to some order, I can then decipher which is an image, which is a text frame, and do what I need to do.
Thanks all,
Roy

Hi Roy,
You can set and get a reference on the order the object was created by using APID Toolkit. Here is an example (I assume that APID is installed):
1. I create a subject observer on the pasteboard.
2. In APID panel, I set List of Subjects to "*" (all subjects)
3. Event Filter field I set to "subjectCreated#CreationCounter" (subjectCreated is event which triggers the script, CreationCounter is the name of scripting engine)
4. In Script field I type the following script
if (myCounter == undefined) var myCounter = 1;
theItem.eventSource.setDataStore("created", myCounter);
myCounter ++;
Then, in another script, I can retrieve the order of creation of each page item, e.g.:
var myDoc = app.activeDocument;
myDocFrames = myDoc.allPageItems;
for (i = 0; i < myDocFrames.length; i++) {
      myDocFrames[i].select();
      alert("Creation order of selected item is " + myDocFrames[i].getDataStore("created"));
Kasyan

Similar Messages

  • [CS3 JS] Getting a page item by its script label

    I have a text frame on a master page with its script label set. In my script, I am trying to get a reference to the text frame with this:
    var doc = app.activeDocument;
    var spread = doc.masterSpreads[0];
    var tabFrame = spread.allPageItems.item("TabLeft");
    I get the error "spread.allPageItems.item is not a function"
    Any help will be appreciated. Thanks.
    Rick

    Hi Rick,
    spread.allPageItems returns a flattened array of all of the page items in the spread, at any level of the hierarchy (i.e., inside groups and other page items). Is that what you want? Sadly, allPageItems does not benefit from the special case where we use the label as a name, so you'll have to iterate if that's what you want.
    As Peter says (thanks, Peter!), spread.pageItems.item("label") gives you all of the page items whose label matches the string, but it does so in sort of a weird way--you'll always get a page item object. If no page items match, you get an invalid page item; if one matched, you get a single page item, and if multiple page items matched, you get a page item object that actually contains multiple page items. It can take a little testing to figure out exactly what it is that was returned.
    Thanks,
    Ole

  • Price on PO getting deleted once you reference an item with a contract

    Hi,
    We are using SRM5.5, ECS, and I am trying to create a standalone PO with a line item reference with material/service ID and also I want to reference it to a contract line, but once I add the contract line for that material, the price is getting deleted. Any clues?
    The second point is that I am not able to create a limit item with reference to contract in BBP_POC, in other words, I can't even see the contract field if I select limit item, any thing missing?
    Thanks,
    CS

    Hi Peter,
    Thanks for your reply, but I have no price on the contract line, and I tested with a contract with price too, but still once I reference the item from a PO line item, the price is getting deleted. Wondering why this is happening?
    Thanks,
    CS

  • Customer Field in Delivery Address(Reference data, item)tab under Ite in PO

    Dear experts,
    While creating a PO in line item level, under the "Delivery Address" tab, we are able to see the Vendor option and the Address option for selecting the delivery address in the PO. We are unable to view the Customer Option even though we have maintained the optional entry in table T162(Reference data, item).
    We are only able to see the Customer option in the display mode, but unable to see in the create or change mode.
    Please advise is there any other setting is required for getting the customer field  under billing address tab under line item in create and change mode so as to be able to select customer code directly.
    Regards
    Sai

    no answer

  • Problem with GET REFERENCE statement

    Hi gurus,
    shortly; I need to populate a table whose elements are made as follows:
    CODE   TYPE MDM_FIELD_CODE (a string, basically)
    VALUE  TYPE REF TO DATA.
    I need to loop over an item table and populate the above sketched table; so I wrote as follows:
    LOOP AT lt_item INTO ls_item.
    *** MDMSRM_SHORT_DESCRIPTION ***
         CLEAR value_pair.
         MOVE 'MDMSRM_SHORT_DESCRIPTION' to value_pair-code.
         GET REFERENCE OF ls_item-short_desc INTO value_pair-value.
         APPEND value_pair TO lt_value_pair.
    ENDLOOP.
    The problem is: each time the loop is performed, all the VALUE fields already appended have the value of the last iteration.
    How can I overcome this problem? Is there a sort of unassignment technique for GET REFERENCE?
    Thanks,

    Had some difficulties in working with field-symbols as I have to reference to a structure which is partly derived from the workarea and partly fixed...
    I did as follows, maybe it's not the best solution, however, seems to work:
    FIELD-SYMBOLS <item>        TYPE zsrm_cat_files_i.
    FIELD-SYMBOLS: <minqty>      TYPE mdm_gdt_quantity-content.
    FIELD-SYMBOLS: <minqty_unit> TYPE MDM_CDT_MEASURE_UNIT_CODE.
    FIELD-SYMBOLS: <minqty_struct> TYPE mdm_gdt_quantity.
    DATA minimum_qty TYPE REF TO mdm_gdt_quantity
    LOOP ... ASSIGNING <item>.
       CREATE DATA minimum_qty.
       ASSIGN minimum_qty->* TO <minqty_struct>.
       ASSIGN COMPONENT 1 OF STRUCTURE <minqty_struct> TO <minqty>.
       ASSIGN COMPONENT 2 OF STRUCTURE <minqty_struct> TO <minqty_unit>.
       <minqty> = <item>-min_qty.
       <minqty_unit> = '$$$'.
       GET REFERENCE OF <minqty_struct> INTO value_pair-value.
       APPEND value_pair TO lt_value_pair.

  • In Which Table  I Will get Reference Document for MIGO Transaction

    Hai Experts
    In Which Table  I Will get Reference Document for MIGO Transaction
    Regards
    Jagadish

    Hi,
    The 2 main tables for this MIGO Transaction are ,
    MKPF - Header table
    MSEG -  Item table
    Reference Document is XBLNR.
    Regards,
    Raj.

  • FRM-40105 Impossible to resolve reference to item

    I have a control block with a save button in. I have another block 'AAA' on wich I have a when-validate-item on an item at the block 'AAA' level. If I have an error on this item and I push the save button, why I always receive the FRM-40105 Impossible to resolve reference to item ?

    Hello,
    Why am i not able to answer if i don't get the whole information ?
    What is the code behind the push button and the W-V-I trigger ?
    Francois

  • [AS CS5.5] Bad Perfomance: sequentially using DOM to get references

    Hi guys,
    The issue
    I'm having terrible performance problems when using a complex script I wrote.
    The script
    I need to make some special comparisons between found text and the texts in that page.
    My script is written in Flash Builder 4, using the CS_SDK (without Extension Builder)
    In short, my script has a class that performs the following tasks:
    1. Finds texts that meet some criteria (by using Document.findText() method) and stores the Array of texts result in an array.
    2. Traverses the Array of found texts and, for each one of them:
    a. Finds a reference to the page where that text is. Something like (within a for loop, with iFoundText as the indexing var):
    var currentParentPage     :Page     =
         foundText[iFoundText].parentStory.textContainers[0].parentPage;
    b. Finds all the page items in that page. The code goes something like this:
    var myPageItems      :Object     =
         currentParentPage.allPageItems;
    c. If the PageItem is a TextFrame, then make the 'special comparison', word by word.
    if (currentPageItem is TextFrame)
              var allTheWords     :Words =
                   currentPageItem.words
              for (var iWord:int = 0 ; iWord < allTheWords.length ; iWord++)
                   //Code to perform comparison and related operations...
    It seems to work OK, when allowing to perform the script for he first three occurrences (although very slow, say some 12 seconds for this).
    So, what's the problem?
    What happens when I run it with more load:
    When I run the script for all the occurrences (I know that the number is around 100), the application halts, an stops responding. After 10 min it doesn't work anymore.
    What the documentation says:
    I found a document called "FEATURE DEVELOPMENT WITH SCRIPTING - Adobe CS5" (link), where it gives this recommendation:
    Performance techniques
    Minimize access to InDesign DOM
    Querying the InDesign DOM may be the main performance bottleneck for your script. A considerable amount of time typically is spent resolving object references, because InDesign does not hand out pointers to objects but rather uses references that need to be resolved every time they are used. Here are some techniques to alleviate this problem:
    z Reduce the number of calls to the scripting DOM.
    z Store and reuse resolved references in variables wherever possible.
    z Use everyItem() to fetch and cache data of a collection object all at once, instead of querying the properties with separate calls.
    But I don't know how to not query InDesign's DOM every time...
    So. I understand that calling InDesign's DOM is bad for the script's performance, but I really don't know how could I avoid querying it for getting references to parent objects, or any other item.
    I have two questions
    1. If I have a variable stored in my AS script, for example:
    var anyTextItem:com.adobe.indesign.Text
    When I call a property or a method of that variable... Am I querying InDesign's DOM? (in other words, the variables' content is passed as a reference?)
    2. How do I query the DOM less times?
    For example:
    Problem: I constantly need to know what's the parent page of a found text, and then get the array of page items, and then, the array of words of every page item that is a textframe.
    How could I query the DOM once and then play with the stored variables instead of repetitively querying the DOM?
    Because, even if I have the variable stored, say "anyTextItem:Text", and I also have all the document's TextFrames stored in other variable (say "var allTextFrames:TextFrames"), I would still need to call "anyTextItem.parentTextFrame" to get a reference to the containing textFrame, and that would mean "querying InDesign's DOM".
    I would appreciate if anybody understands how to solve this.
    Thanks you, guys !

    Harbs,
    Thank you very much for your answer. You're very knowledgeable about InDesign DOM.
    Your message gives me a better understanding of how objects are managed between a scripting environment and the DOM. I still have some questions, though...
    b.
    I will change the call to 'allPageItems' to 'page.textFrames.everyItem().getElements()'. It makes much more sense.
    Now, quick question:
    What do you use 'getElements()' for?
    What's the diference between calling 'page.textFrames.everyItem().getElements()' and 'page.textFrames.everyItem()'?
    c.
    OK. I kinda got it. But, I have questions here too.
    For me, it's been quite tricky to understand indexes and references for InDesign DOM objects.
    Let's say that I have stored a Story's words object in my script. Something like:
    var currentWords     :Words = currentStory.words;
    And then, I go through a TextFrame that contains part of that Story, and find one word that meets my criteria. So I get:
    var foundWord        :Word = (... Somehow I got a reference to this ...);
    Is it there a way to easily find that word (by index) in the 'currentWords' object? (maybe using index or id...) The problem is that I've found that sometimes the indexes don't match (i. e. if I call "foundWord.index", its index can be way larger than the parentStory.words.length, for example, I got foundWord.index=942, whereas foundWord.parentStory.length=742).
    And, as a consequence, I'm using long workarounds to find the word within that collection (and I guess you'd scold me for this one; now I think that might be a serious performance killer, because I'm reconstructing the 'words' collection over and over again :S)
    Thanks again to both of you (@Harbs and @Andrés), you've been very kind and helpful.

  • FRM - 40105 : Unable to resolve reference to item item name

    Hi,
    FRM - 40105 : Unable to resolve reference to item <item name>
    When I am opening a form I am getting the above mentioned error. Instead of <Item name> how we can display the error like <:CTRL_BLK.DOC_DATE>
    Thanks & Regards,
    Jenson

    Hi,
    Actually I know what is the reason for getting this error. What I tried to ask you is any way to display the item name, which error is occurred.
    In the form around more than hundred item setting the SET_ITEM_PROPERTY , there only I am getting this error. Like this around more than five form I have to debug. I would like to know through error handling routine or some other code we can display the exact item name, which error is occurred.
    Thanks & Regards,
    Jenson V.A.

  • I had to get my computer cleaned off. I have itunes back now how do i get my phones items back on itunes? I was backed up on icloud

    I had to get my computer cleaned off. I have itunes back now how do i get my phones items back on itunes? I was backed up on icloud

    It has always been very basic to always maintain a backup copy of your computer for just such an occasion.
    Use your backup copy to put everything back.

  • How do you get your purchased items on apple tv to you i tunes on your computer

    How do you get your purchased items on apple tv to you i tunes on your computer

    Download them.
    Store > Check for Available downloads.

  • Problem with existing script, can't get text of item

    I'm taking an earlier script and condensing it so that it will only work from one SELECTED folder. I thought it would be simple but i seam to be running into a few issues
    This is the error I get
    Result:
    error "Can’t get last text item of alias \"Images:2012-2013:WK21:Freedom:Freedom_WK21_PSD:\"." number -1728 from last text item of alias "Images:2012-2013:WK21:Freedom:Freedom_WK21_PSD:"
    property type_list : {"8BPS"}
    property extension_list : {"psd"}
    script o
              property theseNames : {}
    end script
    -- empty log file
    do shell script "echo  'Files not processed in Photoshop :'  > ~/Desktop/LogPhotoshopError.txt"
    set noError to true
    --at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
    --use the result for the if file exists?
    display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
    set skipFiles to (button returned of the result) is "Skip (Faster)"
    --Below is what I removed
    --set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
    --set tc to (count dtF)
    --repeat with i from 1 to tc
    --          set folderName to item i of dtF --<:  is the folder name, no need to use text item delimiters -->":"
    --          if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does --not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not
    --start with "Sue" and folderName does not start with "Design" then
    --Setup list of folders and process details of folders
    tell application "Finder" to set folderName to (choose folder with prompt "Select Folder")
    set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
    set FolderEndName to last text item of folderName
    set brandName to first text item of folderName
    set my text item delimiters to "_PSD"
    set weekNumber to first text item of FolderEndName
    set my text item delimiters to oldTID
    set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
    --set up names to destination folders and create locally based on brand name and week number
    set this_local_folder to "Images:2012-2013"
    set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
    set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
    set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
    set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
    set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
    set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
    set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
    set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
    set website_images to "DCKGEN:Website_Images:"
    --set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
    set this_ftp_folder to "Impulse:"
    set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
    set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
    set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
    set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
    --taking the folder identify which process it must follow.  F R E E D O M   W I T H  P N G
    if brandName is equal to "Freedom" then
              try
                        tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
              on error
                        set o's theseNames to {} -- no psd files or "8BPS"
              end try
              set numOfNames to (count o's theseNames)
              repeat with j from 1 to numOfNames
                        set thefile to theFolder & ":" & (item j of o's theseNames)
      --    F R E E D O M     Folder Photoshop Process W I T H  P N G
                        set thisName to (item j of o's theseNames)
                        tell application "Finder"
                                  set t_ext to name extension of file thefile
                                  if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
                                  set b to exists file (localBrandFolder_PSD & thisName & ".psd")
                        end tell
                        if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
                                  tell application "Adobe Photoshop CS5.1"
      -- I remove the command activate, Photoshop stay in background
                                            set ruler units of settings to pixel units
                                            try
      open (alias thefile) showing dialogs never
                                                      set origName to name of current document
                                                      set myOptions to {class:JPEG save options, quality:12}
                                                      set myPNGOptions to {class:PNG save options, interlaced:false}
                                                      set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                                                      tell current document
      --If the quick mask mode has been left on then delete the channel Quick Mask
                                                                if (quick mask mode) then delete channel ¬
                                                                          "Quick Mask"
      --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                                                                if (exists layer "Original Layer") then ¬
                                                                          tell layer "Original Layer" to set name to "Original Image"
      save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                                                                (delete layer "Original Image") flatten
      resize image resolution 300 resample method none
      --sharpen image
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
      --Prepare for Low RES by resetting image history
                                                                set current history state to history state 3
      delete current layer
      merge visible layers
                                                                resize image width 1020
      resize image resolution 300 resample method none
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      --add save to lowResFolder with same options
      save in (networkBrandFolder_Low_Res & name) as PNG with options myPNGOptions without copying
      flatten
      save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
                                                                set newFile to file path
                                                                set newFile2 to newFile as string -- for testing end of name
                                                                if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" or newFile2 ends with "_4.jpg" or newFile2 ends with "_5.jpg" or newFile2 ends with "_6.jpg" or newFile2 ends with "_7.jpg" or newFile2 ends with "_8.jpg" or newFile2 ends with "_9.jpg" or newFile2 ends with "_10.jpg" or newFile2 ends with "11.jpg" then -- exclude website_images
                                                                          my duplicateFile(newFile, {ftpBrandFolder_Low_Res})
                                                                else
                                                                          save in (website_images & name) as JPEG with options myOptions without copying
                                                                end if
      close saving no
                                                      end tell
                                            on error
                                                      set noError to false
                                                      my myLogs(thefile) -- write path to log file in Desktop
                                                      try
      close saving no --if exists, close current document
                                                      end try
                                            end try
                                  end tell
                        end if
              end repeat
      --End F R E E D O M  W I T H  P N G
    end if
    if not noError then do shell script "/usr/bin/open  ~/Desktop/LogPhotoshopError.txt'"
    on myLogs(t)
              try
                        do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
              end try
    end myLogs
    on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
              tell application "Finder" to repeat with folderPath in foldersPath
                        with timeout of 200 seconds -- adjust it,  error if the copy  is longer that 200 seconds
      duplicate tFile to folder folderPath with replacing
                        end timeout
              end repeat
    end duplicateFile
    on getFolderPath(tName, folderPath)
              tell application "Finder" to tell folder folderPath
                        if not (exists folder tName) then
                                  return (make new folder at it with properties {name:tName}) as string
                        else
                                  return (folder tName) as string
                        end if
              end tell
    end getFolderPath
    tell application "Finder"
              open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
    end tell

    I'm getting close or at least I hope this is how it looks now, but appears not pick up the files in the folder?
    The result
              exists folder "Freedom_WK20_HR" of folder "impulse:Week20:Freedom:"
              get folder "Freedom_WK20_HR" of folder "impulse:Week20:Freedom:"
              get name of every file of alias (alias "Images:2012-2013:WK20:Freedom:Freedom_WK20_PSD:") whose {"8BPS"} contains file type or {"psd"} contains name extension
              open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
    end tell
    --------------------MAIN SCRIPT BELOW__------------------
    property type_list : {"8BPS"}
    property extension_list : {"psd"}
    script o
              property theseNames : {}
    end script
    -- empty log file
    do shell script "echo  'Files not processed in Photoshop :'  > ~/Desktop/LogPhotoshopError.txt"
    set noError to true
    --at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
    --use the result for the if file exists?
    display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
    set skipFiles to (button returned of the result) is "Skip (Faster)"
    --Setup list of folders and process details of folders
    tell application "Finder"
              set theFolder to (choose folder with prompt "Select Folder")
              set folderName to name of theFolder
              set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
              set FolderEndName to last text item of folderName
              set brandName to first text item of folderName
              set my text item delimiters to "_PSD"
              set weekNumber to first text item of FolderEndName
              set my text item delimiters to oldTID
      --set up names to destination folders and create locally based on brand name and week number
              set this_local_folder to "Images:2012-2013"
              set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
              set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
              set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
              set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
              set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
              set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
              set website_images to "DCKGEN:Website_Images:"
      --set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
              set this_ftp_folder to "Impulse:"
              set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
              set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
              set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
              set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
      --taking the folder identify which process it must follow.
              if brandName is equal to "BHS" then
                        try
                                  tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
                        on error
                                  set o's theseNames to {} -- no psd files or "8BPS"
                        end try
                        set numOfNames to (count o's theseNames)
                        repeat with j from 1 to numOfNames
                                  set thefile to theFolder & ":" & (item j of o's theseNames)
      --    B H S    Folder Photoshop Process
                                  set thisName to (item j of o's theseNames)
                                  tell application "Finder"
                                            set t_ext to name extension of file thefile
                                            if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
                                            set b to exists file (localBrandFolder_PSD & thisName & ".psd")
                                  end tell
                                  if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
                                            tell application "Adobe Photoshop CS5.1"
      -- I remove the command activate, Photoshop stay in background
                                                      set ruler units of settings to pixel units
                                                      try
      open (alias thefile) showing dialogs never
                                                                set origName to name of current document
                                                                set myOptions to {class:JPEG save options, quality:12}
                                                                set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                                                                tell current document
      --If the quick mask mode has been left on then delete the channel Quick Mask
                                                                          if (quick mask mode) then delete channel ¬
                                                                                    "Quick Mask"
      --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                                                                          if (exists layer "Original Layer") then ¬
                                                                                    tell layer "Original Layer" to set name to "Original Image"
      save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                                                                          (delete layer "Original Image") flatten
      resize image resolution 300 resample method none
      --sharpen image
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
      --Prepare for Low RES by resetting image history
                                                                          set current history state to history state 3
                                                                          flatten
                                                                          resize image width 1348
      resize image resolution 300 resample method none
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      --add save to lowResFolder with same options
      save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
                                                                          set newFile to file path
                                                                          set newFile2 to newFile as string -- for testing end of name
                                                                          if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" or newFile2 ends with "_4.jpg" or newFile2 ends with "_5.jpg" or newFile2 ends with "_6.jpg" or newFile2 ends with "_7.jpg" or newFile2 ends with "_8.jpg" or newFile2 ends with "_9.jpg" or newFile2 ends with "_10.jpg" or newFile2 ends with "11.jpg" then -- exclude website_images
                                                                                    my duplicateFile(newFile, {ftpBrandFolder_Low_Res})
                                                                          else
                                                                                    my duplicateFile(newFile, {ftpBrandFolder_Low_Res, website_images})
                                                                          end if
      close saving no
                                                                end tell
                                                      on error
                                                                set noError to false
                                                                my myLogs(thefile) -- write path to log file in Desktop
                                                                try
      close saving no --if exists, close current document
                                                                end try
                                                      end try
                                            end tell
                                  end if
                        end repeat
      --End BHS
      --taking the folder identify which process it must follow. B U R T O N
              else if brandName is equal to "Burton" then
                        try
                                  tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
                        on error
                                  set o's theseNames to {} -- no psd files or "8BPS"
                        end try
                        set numOfNames to (count o's theseNames)
                        repeat with j from 1 to numOfNames
                                  set thefile to theFolder & ":" & (item j of o's theseNames)
      --    B U R T O N    Folder Photoshop Process
                                  set thisName to (item j of o's theseNames)
                                  tell application "Finder"
                                            set t_ext to name extension of file thefile
                                            if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
                                            set b to exists file (localBrandFolder_PSD & thisName & ".psd")
                                  end tell
                                  if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
                                            tell application "Adobe Photoshop CS5.1"
      -- I remove the command activate, Photoshop stay in background
                                                      set ruler units of settings to pixel units
                                                      try
      open (alias thefile) showing dialogs never
                                                                set origName to name of current document
                                                                set myOptions to {class:JPEG save options, quality:12}
                                                                set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                                                                tell current document
      --If the quick mask mode has been left on then delete the channel Quick Mask
                                                                          if (quick mask mode) then delete channel ¬
                                                                                    "Quick Mask"
      --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                                                                          if (exists layer "Original Layer") then ¬
                                                                                    tell layer "Original Layer" to set name to "Original Image"
      save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                                                                          (delete layer "Original Image") flatten
      resize image resolution 300 resample method none
      --sharpen image
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
      --Prepare for Low RES by resetting image history
                                                                          set current history state to history state 3
                                                                          flatten
                                                                          resize image width 1020
      resize image resolution 300 resample method none
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      --add save to lowResFolder with same options
      save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
                                                                          set newFile to file path
                                                                          set newFile2 to newFile as string -- for testing end of name
                                                                          if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" or newFile2 ends with "_4.jpg" or newFile2 ends with "_5.jpg" or newFile2 ends with "_6.jpg" or newFile2 ends with "_7.jpg" or newFile2 ends with "_8.jpg" or newFile2 ends with "_9.jpg" or newFile2 ends with "_10.jpg" or newFile2 ends with "11.jpg" then -- exclude website_images
                                                                                    my duplicateFile(newFile, {ftpBrandFolder_Low_Res})
                                                                          else
                                                                                    my duplicateFile(newFile, {ftpBrandFolder_Low_Res, website_images})
                                                                          end if
      close saving no
                                                                end tell
                                                      on error
                                                                set noError to

  • How to get the selected items from listbox

    Regarding listbox i have two questions
    1) I want to get the selected items as per the order in which ihave selected.Presently i'm getting in the ascending order.For example after selcting the 1,2,6 if i select 3 then its giving 1,2,3,6.But i want it in the order 1,2,6,3
    2)I want to select items from a single list box to many other listboxes.(ie) my first selection should goto first,second one to the second listbox and like this.How should i write the logic.
    please give me a suggestion.

    In order to have the selected items line up in accordance to the selection order, please do it one at a time. (That's the limit for that VI)
    If you need more than that (i.e. to regconize which item clicked first and which one comes later), you may have to figure it out ya
    Wish you good luck. Perhaps, someone else has a already made vi.
    Cheers!
    ian.f
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com

  • How to get all checked items from TreeView in VC++ mfc

    void CPDlg::OnTreeClk(NMHDR *pNMHDR, LRESULT *pResult)
    NMTREEVIEW& nm = *(LPNMTREEVIEW)pNMHDR;
    // which item was selected?
    HTREEITEM hItem = m_columnTree.GetTreeCtrl().GetSelectedItem();
    temp = m_columnTree.GetItemText(hItem, 0);
    MessageBox(temp);
    if (!hItem) return;
    // the rest of processing code..
    I'm new in VC++ .
    this code gives only current selected item . but i need to get all checked items from treeView.
    kindly help me..

    no not unchecked .. the all check box's gone from tree view. which means Treeview without check box.
    finally i tried SetCheck 
    void CPracticesDlg::OnSelchangedTreectrl(NMHDR* pNMHDR, LRESULT* pResult)
    NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
    // TODO: Add your control notification handler code here
    tree_state = 1;//changed
    HTREEITEM hItem = m_columnTree.GetTreeCtrl().GetSelectedItem();
    BOOL chk = m_columnTree.GetTreeCtrl().GetCheck(hItem);
    if (chk == TRUE)
    HTREEITEM hmyItem = m_columnTree.GetTreeCtrl().GetSelectedItem();
    // Check all of the children of hmyItem.
    if (m_columnTree.GetTreeCtrl().ItemHasChildren(hmyItem))
    HTREEITEM hNextItem;
    HTREEITEM hChildItem = m_columnTree.GetTreeCtrl().GetChildItem(hmyItem);
    while (hChildItem != NULL)
    hNextItem = m_columnTree.GetTreeCtrl().GetNextItem(hChildItem, TVGN_NEXT);
    m_columnTree.GetTreeCtrl().SetCheck(hChildItem, 1);
    hChildItem = hNextItem;
    else
    HTREEITEM hmyItem = m_columnTree.GetTreeCtrl().GetSelectedItem();
    // Uncheck all of the children of hmyItem.
    if (m_columnTree.GetTreeCtrl().ItemHasChildren(hmyItem))
    HTREEITEM hNextItem;
    HTREEITEM hChildItem = m_columnTree.GetTreeCtrl().GetChildItem(hmyItem);
    while (hChildItem != NULL)
    hNextItem = m_columnTree.GetTreeCtrl().GetNextItem(hChildItem, TVGN_NEXT);
    m_columnTree.GetTreeCtrl().SetCheck(hChildItem, 0);
    hChildItem = hNextItem;
    code works good . but here is i think small problem . i cant find it.
    when i click the root node it goes to checked state but not child node. again i click same root node it goes to unchecked state but all child's are goes to checked state.
    help me. here what is the problem?

  • How to get a tree item when my mouse moves

    I want to get the tree item which my cursor points to when my
    cursor moves over a tree.
    I can get a row index in itemRollOver event, but it seems
    useless.
    And I don't know how to use getObjectsUnderPoint method.
    Is there anyone who can help me?

    Take a look this example:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="srv.send()">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var selectedNode:Object;
    [Bindable]
    public var XLC:XML;
    public function initList(event:Event) : void
    XLC = event.target.lastResult;
    public function treeChanged(event:Event) : void
    selectedNode=Tree(event.target).selectedItem;
    ]]>
    </mx:Script>
    <mx:HTTPService id="srv" url="../assets/tree.xml"
    resultFormat="e4x"
    result="initList(event)"/>
    <mx:HDividedBox width="100%" height="100%">
    <mx:Tree id="myTree" width="50%" height="100%"
    labelField="@label"
    showRoot="false" dataProvider="{XLC}"
    change="treeChanged(event)"/>
    <mx:TextArea height="100%" width="50%"
    text="Selected Item: {selectedNode.@label}"/>
    </mx:HDividedBox>
    </mx:Application>
    "hybak" <[email protected]> wrote in message
    news:fd5gao$229$[email protected]..
    >I want to get the tree item which my cursor points to
    when my cursor moves
    >over
    > a tree.
    > I can get a row index in itemRollOver event, but it
    seems useless.
    > And I don't know how to use getObjectsUnderPoint method.
    > Is there anyone who can help me?
    >

Maybe you are looking for

  • Xml matrix report not expending horizontally

    hi guys m trying to develop xml matrix report but m totally stuck.value are not expanding vertically. RTF tags are here.Plz tell me how can i attach rtf and xml file with this post so you people can help me in better way. plz help me its very urgent

  • Error When Opening Any Form

    Hi All., Im facing some issue while opening any form..its stuck in below mention file while opening any form i tried all the ways still im not able to fix the issue. Application:11.5.10.2 OS-----------HP-UX DB-----------10.2.0.4.0 File Name: oracle/f

  • Data gets not saved?

    Hi i am new at programming and also i am dutch so my english is not that high quality. sorry for that. reading is a lot better than writing ;) So here is my problem (i use visualstudio 2013 express) my goal is to design a desktop app that keeps track

  • Remove Show/Hide Filters link in UWL

    Hello, In the standard delivered UWL iview there is a link in the upper right hand corner that toggles the filters on and off. We want to remove this link. Does anyone know how to do it? We have checked iview properties and the UWL XML config file an

  • How do i find out what teachers editions and resources are available to compliment etextbooks?

    How do i find out what teachers editions and resources are available to compliment etextbooks? I'm researching the possibility of using iPads for our school but I need to make sure that we can get the appropriate teacher resources to go along with th