Looping through Multiline list in Workflow

We have a Workflow that sends an email with an Office document (ie., Excel) as an attachment to each Executing Service Engineer on service items that are relevant for planning. In an attempt to do that we loop through a multiline list, which is used to hold the relevant service items for processing.
1.     We created an activity step Initialize work items count to store the number of service work items, e.g. Work_items_count
2.     We use a loop step (loop until) to keep looping while work_items_count has a value greater than zero.
3.     Within the loop, we use another activity step Get install item ibase components that processes the first item of the multiline container element Work_items and returns the ibase components for the Executing Service Engineer. After processing has completed, we delete the item from Work_items and decrement the counter work_items_count by 1.
4.     As part of the final steps in the loop, an Excel document is created from a template using a standard object method WF_DOC-CREATE. The document is than converted to an SOFM object using standard object method WF_DOC-CREATE_SOFM, and than an email is generated with the SOFM object as an attachment using standard object method SELFITEM-SENDTASKDESCRIPTION.
The problem that’s occurring is that on the second loop pass, the status for activity step Get install item ibase components is set to ready expecting user intervention. I know that it’s a dialogue step, but why than does it execute seamlessly on the first loop pass? I’ve set the agent assignment on the Workflow and on the task to General task so that anybody can execute it so I don’t think it’s an agent assignment problem.
Does anyone have any suggestions? Do i need to use dynamice parallel processing in this case?

We have a Workflow that sends an email with an Office document (ie., Excel) as an attachment to each Executing Service Engineer on service items that are relevant for planning. In an attempt to do that we loop through a multiline list, which is used to hold the relevant service items for processing.
1.     We created an activity step Initialize work items count to store the number of service work items, e.g. Work_items_count
2.     We use a loop step (loop until) to keep looping while work_items_count has a value greater than zero.
3.     Within the loop, we use another activity step Get install item ibase components that processes the first item of the multiline container element Work_items and returns the ibase components for the Executing Service Engineer. After processing has completed, we delete the item from Work_items and decrement the counter work_items_count by 1.
4.     As part of the final steps in the loop, an Excel document is created from a template using a standard object method WF_DOC-CREATE. The document is than converted to an SOFM object using standard object method WF_DOC-CREATE_SOFM, and than an email is generated with the SOFM object as an attachment using standard object method SELFITEM-SENDTASKDESCRIPTION.
The problem that’s occurring is that on the second loop pass, the status for activity step Get install item ibase components is set to ready expecting user intervention. I know that it’s a dialogue step, but why than does it execute seamlessly on the first loop pass? I’ve set the agent assignment on the Workflow and on the task to General task so that anybody can execute it so I don’t think it’s an agent assignment problem.
Does anyone have any suggestions? Do i need to use dynamice parallel processing in this case?

Similar Messages

  • Text is not being displayed in sync on a label when looping through a list -- how to fix?

    I have a list of states (50 states).  I loop through this list (in a winform app -- VS2012) and want to display the current state ID that is being processed in the loop in the text property of a label.  I precede the label.Text = StateID line with
    Application.DoEvents() but I am also (in Debug mode) writing the same text to the console.  The console displays correctly, but there appears to be a lag in the label.Text property
    List<string> StateList = new List<string> { "al", "ak", "az","ar","ca","co","ct","de","fl","ga",...};
    foreach (string stateID in StateList)
        Application.DoEvents();
        lblStateID.Text = "State is " + stateID;  //--there is a lag here
    I vaguely recollect something about a NotifyPropertyChanged event.  I know this is common in WPF, but is there something similar in winform?  Or is there a way to make the desired text to be displayed in the label.Text property in synchronization
    with the loop?
    Rich P

    Thank you.  This is way simpler than implementing the INotifyPropertyChanged Interface.  Although, here is an article on the INotifyPropertyChanged Interface and event
    http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=vs.110).aspx
    Rich P

  • Problem when loop through a list within CollectionModel

    In my bean, I have these codes to define a node.
    Map<String, Object> node = new HashMap<String, Object>();
    node.put("Nodeid", nodeid);
    List theColors = new ArrayList();
    node.put("Colors", colors);
    node.put("Type", type);
    node.put("Desc", desc);
    Then, a list of these nodes are converted to CollectionModel using ModelUtils.toCollectionModel(nodes);
    In my jspx, I am able to loop through nodes, and get Type, Nodeid and Desc from the node to show on the screen.
    I am trying to loop through the list of colors within the node to draw circles with different diameter.
    <af:forEach var="theColor" items="#{node.Colors}" varStatus="vs">
    <dvt:pointLocation pointX="50%" pointY="50%">
    <dvt:marker id="mk2" scaleX="#{15-vs.index*2}" scaleY="#{15-vs.index*2}" shape="circle" fillColor="#{theColor}" />
    </dvt:pointLocation>
    </af:forEach>
    But above code does not work.
    Can someone help me? Any suggestions?
    Thanks.

    I want to call a javascript function inside a c:forEach loop.Nope sorry, won't work.
    Java/JSP runs on the server. At the server end, any html/script code is just template text to output to an html file.
    The server produces an html file, and sends it to the client.
    Java stops running.
    Java cannot call javascript, javascript can not call java. There is no direct communication.
    Java code can produce javascript code to run on a page.
    The only communication javascript has back with the server is if it makes a request (click a link, submit a button, Ajax call...)

  • How to Loop through another list and update a column with SharePoint Designer 2013 Workflow

    Hi,
    I am trying to get my head around the new 2013 Workflow Engine and SharePoint Designer 2013 Workflow Text-Based Designer.
    I have two lists.
    List A has 2 columns: Title, Completed (Yes/No)
    List B has 3 columns: Title, LookupListATitle, Completed (Yes/No)
    All the 2013 Workflow components have been installed and configured and I am selecting the 2013 Workflow option in SPD
    I am trying to set off a 2013 Workflow when an item in List A is edited to Loop through List B and select items where the LookupListATitle column's value is equal to the Title value of the current item, and set the value of the Completed column for those
    items in ListB to "Yes".
    I have the Workflow configured like this:
    Stage: Stage 1
    IF Current Item:Completed equals Yes
    Loop: 1
    The contents of this loop will run repeatedly while: ListB:LookupListATitle equals Current Item: Title
    Update item in ListB. 
    (The dialog options for the update item action as follows:
    List: ListB
    Field: Completed, Value: Yes
    In the Find the List Item section
    Field: LookupListATitle
    Value: Current Item: Title)
    Transition to stage
    Go to End of Workflow
    When I update an item in ListA and set its Completed column to Yes, I would expect the Workflow to find all the items in List B where the Lookup column is equal to ListA's Title (there are 2) and update their Completed column to Yes. But it doesn't work.
    When I look at the Workflow Status it says the Internal Status is "Canceled" and the information pop up has the following alien language (and may be truncated):
    RequestorId: 95f03b62-8956-ac14-c5cf-dc98c89c589c. Details: System.ArgumentException: Invalid JSON primitive: Item001. Parameter name: value at Microsoft.Workflow.Common.Json.JXmlToJsonValueConverter.ConvertStringToJsonNumber(String value) at Microsoft.Workflow.Common.Json.JXmlToJsonValueConverter.ReadPrimitive(String
    type, XmlDictionaryReader jsonReader) at Microsoft.Workflow.Common.Json.JXmlToJsonValueConverter.JXMLToJsonValue(XmlDictionaryReader jsonReader) at Microsoft.Workflow.Common.Json.JXmlToJsonValueConverter.JXMLToJsonValue(Stream jsonStream, Byte[] jsonBytes)
    at Microsoft.Activities.DynamicValue.ParseJson(String json) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor
    executor, BookmarkManager bookmarkManager, Location resultLocation)
    Unfortunately I don't have access to the server, logs etc.
    I would love to find some tutorials, or any books on SharePoint Designer 2013 in general and Workflows in particular but my searches haven't turned up much so far apart from a pre-release Beginning SharePoint Workflows which is in its very early stages and
    not much help yet.
    Can anyone give me some guidance on how to set up While Loops to iterate through a related list using SharePoint Designer 2013?
    Mark

    Hi,
    I understand that you wanted to update the items in the other list (Participants) where the Course equals the Current Item.
    You need to use “Call HTTP Web Service" action and “Build Dictionary" action to get the Maxid and then loop Participants to update the items.
    You can follow the steps as below to achieve what you want:
    Create a custom list named Courses, add columns: Title(Single line of text), Course ID(Single line of text), Course Finalised (Yes/No).
    Create a custom list named Participants, add columns: Title(Single line of text), Course(Lookup), CourseFinalised (Yes/No).
    Create workflow associated to Courses, start the workflow automatically when an item is created or changed.
    Add conditions and actions:
    The HTTP URL is set to
    https://sitename/_api/web/lists/GetByTitle('listname')/items?$orderby=Id%20desc and the HTTP method is set to “GET”. Then the list will be order by Id and desc.
    Then if Course Finalised is equal to Yes, the CourseFinalised  of the associated items in Participants will be updated to Yes.
    More information:
    http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/
    Thank you for your understanding.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Looping through a list with an iterator

    Hi I have a list of objects allCrecords which I want to loop through using an iterator In the method printcoauthors I have to create another instance of class Extractdata because that's where the objects are added to the list allCrecords. The getauthor, getcoauthor and gettitle are methods in the Coauthorship class where this method printcoauthors is also
    public void printcoauthors(String currentauthor){
             Extractdata ed = new Extractdata();
        for(Iterator it = ed.allCrecords.iterator();it.hasNext();){
            if(currentauthor.equals(getauthor()))
                System.out.println(getcoauthor());
            else if (currentauthor.equals(getcoauthor()))
                System.out.println(getauthor());
                System.out.println(gettitle());
               Object element = (Object)it.next();
        }thanks in advance

    Here's the extractdata class it takes data from an xml file and stores it as strings or lists or arrays
    public class Extractdata {
         public String name1, name2, TITLE;
              SNAnalyser sn = new SNAnalyser();
              Document doc = sn.extractDoc();
         public List allCrecords = new ArrayList();
      /** Creates a new instance of extractdata */
      public Extractdata(){
      public void extract(){ 
           List allauthors = new ArrayList();
           allauthors = Collections.synchronizedList(new ArrayList(allauthors));
           allCrecords = Collections.synchronizedList(new ArrayList(allCrecords));
           List alltitles = new ArrayList();
           alltitles = Collections.synchronizedList(new ArrayList(alltitles));
           String[] names = new String[20];
          NodeList records1 = doc.getElementsByTagName("record");
            for( int i = 0; i < records1.getLength();i++)
                Record records = null;
                Element record = (Element) records1.item(i);
                NodeList headers = record.getElementsByTagName("header");
                Element header = (Element) headers.item(0);
                NodeList ids = header.getElementsByTagName("identifier");       
                    Element id = (Element) ids.item(0);
                    String ID = getText(id);
                    NodeList metadatas = record.getElementsByTagName("metadata");
                    Element metadata = (Element) metadatas.item(0);
                    NodeList citeseers = metadata.getElementsByTagName("oai_citeseer:oai_citeseer");
                    Element citeseer = (Element) citeseers.item(0);
                    NodeList titles = citeseer.getElementsByTagName("dc:title");
                    Element title = (Element) titles.item(0);
                    TITLE = getText(title);
                    NodeList subjects = citeseer.getElementsByTagName("dc:subject");
                    Element subject = (Element) subjects.item(0);
                    String SUBJECT = getText(subject);    
                    NodeList descriptions = citeseer.getElementsByTagName("dc:description");
                    Element description = (Element) descriptions.item(0);
                    String DESCRIPTION = getText(description);                
                    //Writing data to class Record
                    Record r = new Record(ID, TITLE, allauthors);
                    //Write to text files
                    writeTo(DESCRIPTION,SUBJECT, i);
                    //Extract attributes authorname(s) from xml file
                    NodeList authors = citeseer.getElementsByTagName("oai_citeseer:author");               
                    for(int l = 0; l < authors.getLength(); l++){
                        Element author = (Element) authors.item(l);
                        names[l] = author.getAttribute("name");
                        allauthors.add(names[l]);
                    //Checks if the document was cowritten
                    if(authors.getLength() > 0)            
                                for(int z = 0; z < authors.getLength(); z++){
                               //Begin with the second author so not to include the author in the list of coauthors
                                        for(int w = 1; w < authors.getLength(); w++){
                                           //Ensures that the author is not counted as a co-author
                                            if(z != w){
                                                name1 = names[z];
                                                name2 = names[w]; 
                                            //Creates a new instance of Coauthorship
                                          Coauthorship c = new Coauthorship(name1, name2, TITLE);
                                          allCrecords.add(c);
      public void printallCrecords(){
          Iterator iter = allCrecords.iterator();
          while(iter.hasNext())
              System.out.println(iter.next());
      public String getname1() {
          return name1;
       public String getname2() {
          return name2;
        public String getTITLE() {
          return TITLE;
       public void writeTo(String DESCRIPTION, String SUBJECT, int i){
          try{
          //Write to text files 
          String testing = "test.txt";
          File dir = new File ("Description/" + i);
          dir.mkdirs();
          File file = new File(dir, testing);
          FileOutputStream fout = new FileOutputStream(file);
          Writer out = new OutputStreamWriter(fout, "UTF-8");
          out = new BufferedWriter(out);
          out.write(SUBJECT);
          out.write(" ");
          out.write(DESCRIPTION);
          out.flush();
          out.close();     
          catch (IOException e) {
          System.out.println(
           "Due to an IOException, the parser could not check citeseer.xml");
        public String getText(Node node) {
        // We need to retrieve the text from elements, entity
        // references, CDATA sections, and text nodes; but not
        // comments or processing instructions
        int type = node.getNodeType();
        if (type == Node.COMMENT_NODE
         || type == Node.PROCESSING_INSTRUCTION_NODE) {
           return "";
        StringBuffer text = new StringBuffer();
        String value = node.getNodeValue();
        if (value != null) text.append(value);
        if (node.hasChildNodes()) {
          NodeList children = node.getChildNodes();
          for (int i = 0; i < children.getLength(); i++) {
            Node child = children.item(i); 
            text.append(getText(child));
        return text.toString();
      }

  • Looping through List

    Hello everyone,
    I have some troubles looping through a List using JSTL.
    I have a List (itemList) of ItemConfiguration objects stored in session that i want to loop through. This is what i got so far:
    <table width="200" border="0" cellpadding="0" cellspacing="0">
    <jsp:useBean id="itemList" class="" scope="session" />
    <c:forEach items="${itemList}" var="itemConfig">
      <tr>
         <td width="5"><img src="images/pixel.gif" width="1" height="2" /></td>
         <td width="190"><img src="images/pixel.gif" width="1" height="2" /></td>
         <td width="5"><img src="images/pixel.gif" width="1" height="2" /></td>
      </tr>
      <tr>
         <td width="5"> </td>
         <td width="190" align="center" class="menu"><c:out value="${itemConfig.name}" escapeXml="false"/></td>
         <td width="5"> </td>
      </tr>     
    </c:forEach>
    </table>ItemConfiguration class have get/set methods (getName()/setName())
    Can someone help me? im stuck at this and can�t make it work.
    Thanks in advance

    Try like this,
    <logic:iterate id="myArray" property="itemConfig" Collection="<%=itemList%>">     
         <bean:write name="myArray" property="name" filter="false"/>"
    </logic:iterate>
    {code}                                                                                                                                                                                                                                                                                                                                                                                       

  • Looping through list, searching for text

    If i am looping through a list and trying to find the text I am looking for to make a selection statement, how would i achieve that?
    <cfif text="TheTextI'mLookingFor></cfif>?

    you would use Find of FindNoCase function.
    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7e 7c.html

  • Upload XLS File, Loop through rows query a DB

    What I would like to do is enable the user to upload an excel
    spreadsheet with one column and many row of IP's. Then put the ips
    in a list or array and loop through the list and query a table to
    get the IPs that match the list.
    Any help would be greatly appreciated.

    We have some similar apps except that, instead of uploading a
    file, the users copy and paste the column into a text area. Then we
    do this:
    <!--- First, replace carraige returns (chr(13)) and line
    feeds (char(10)) with commas --->
    <cfset
    hscnumbers=Replace(form.hscnumbers,chr(13)&chr(10),",","ALL")>
    <!--- remove last comma, if commas exist (there may be
    only one hsc number) --->
    <cfif find(",", hscnumbers) gt 0 and right(hscnumbers, 1)
    is ",">
    <cfset hscnumbers = left(hscnumbers, len(hscnumbers) -
    1)>
    </cfif>
    And then we have a list to send to the db.

  • Loop through Dimension

    Is there a way to,
    1 - get a list of zero level dimension members
    2 - determine the count and set it equal to a variable
    3 - loop through the list and set an "If" condition to execute if the UDA equals a certain value?
    Thanks,
    J

    Hi J,
    1. When you say 'setting' a variable . you are going to assign based on certain conditions or criteria.
    i.e ex: if UDA of xyz is abc then
    assign something to somthing.
    2. you also mentioned , "number of level zero member" , I understand that you want assign the value i.e number,whihc you can attain using cross dim operator.
    Revert back for further clarification.
    Sandeep Reddy Enti
    HCC
    http://hyperionconsultancy.com/

  • Looping through email addresses. CFTRY/CFCATCH

    I am building an email system that will be looping through a
    list of email addresses in our database and sending mail via
    CFMAIL. Alot of times, the email addresses are bad. i.e.: no
    ".com", a comma in the email address, bad characters etc. How can I
    loop through the email addresses sending them out, but when CFMAIL
    errors out because of a bad address, the loop continues on ignoring
    the bad address. Can I do this with CFTRY/CFCATCH? Will
    CFTRY/CFCATCH halt the process entirely or will it catch it then
    continue on?

    Cold Fusion has an isvalid function you can use to confirm
    that any
    given string is a properly formatted email address. You can
    use this to
    prevent improperly formatted addresses from getting into your
    db in the
    first place.
    If ColdFusion was used to put the email address into the
    database in the
    first place. That is not always true. Some places have more
    the one
    application working with a given database.
    Now using isValid to validate the address before attempting
    to use it in
    a <cfmail...> tag may provide some value, but would
    still be comfortable
    with wrapping the tag with a try catch. I just like to do so
    whenever I
    am playing with other protocols.

  • How to find out the list of workflows with active event linkage?

    Hi All,
    I want to find out the list of workflows whoe event linkage is activated in the system.
    Through SWU0, we can get a list of workflows attached to a particular event of a business object.
    Thanks,
    Sivagami

    Hi,
    Thanx for ur reply..
    I got the list from the table...
    thanks,
    sivagami

  • Automator - Loop through a text file and process data through a 3rd party software

    Just stumbled on Automator the other day (I am a mac n00b) and would like to automate the processing of a text file, line-by-line, using a third party tool.  I would like Automator to loop through the text file one line at a time, copy the string and keep as a variable.  Next, place the variable data (copied string) into the text field of the 3rd party software for processing.  Once the processing is complete, I would like Automator to fetch the next line/string for processing.  I see items like "copy from clipboard" and  "variables" within the menu but I am not finding much documentation on how to utilizle this tool.  Just hear how potentially powerful it is. 
    The 3rd party software is not a brand name, just something made for me to process text.  I may have to use mouse clicks or tabs + [return] to navigate with Automator.  A term I heard on Bn Walldie's itunes video series was "scriptable software" for which I don't think this 3rd party app would be. 
    Kind regards,
    jw

    Good news and bad news...
    The good news is that it should be entirely possible to automate your workflow.
    The bad news is that it will be a nightmare to implement via Automator, if it's even possible.
    Automator is, essentially a pretty interface on top of AppleScript/Apple Events, and with the pretty interface comes a certain stranglehold on features. Knowing how to boil rice might make you a cook, but understanding flavor profiles and ingredient combinations can make you a chef, and it's the same with AppleScript and Automator. Automator's good at getting you from points A to B but if there are any bumps in the road (e.g. the application you're using isn't scriptable) then it falls apart.
    What I'm getting at is that your requirements are pretty simple to implement in AppleScript because you can get 'under the hood' and do exactly what you want, as opposed to Automator's restricted interface.
    The tricky part is that if no one else can see this app it's going to be hard to tell you what to do.
    I can give you the basics on reading a file and iterating through the lines of text in it, and I can show you how to 'type' text in any given application, but it may be up to you to put the pieces together.
    Here's one way of reading a file and working through each line of text:
    -- ask the user for a file:
    set theFile to (choose file)
    -- read the file contents:
    set theFileContents to (read file theFile)
    -- break out the lines/paragraphs of text:
    set theLines to paragraphs of theFileContents
    -- now iterate through those lines, one by one:
    repeat with eachLine in theLines
      -- code to perform for eachLine goes here
    end repeat
    Once you have a line of text (eachLine in the above example) you can 'type' that into another application via something like:
    tell application "AppName" to activate
    tell application "System Events"
              tell process "AppName"
      keystroke eachLine
              end tell
    end tell
    Here the AppleScript is activating the application and using System Events to emulate typing the contents of the eachLine variable into the process. Put this inside your repeat loop and you're almost there.

  • Forms 6i loop through datablock question

    I am writing a piece of code to loop through items with in a datablock to programmatically set the width between each field.
    I created my data block through the wizard, but then manually added some fields. I have them listed in the order I expect them to be navigated, which is the order I expect them to appear on the screen.
    When I am looping through the data block, I was assuming that next_item would go to the next navigable item, and it doesn't.
    For example, I have items received_today, worked_today, total_waiting, total_for_today, total_calls, total_priority.
    When the code loops through the data block, it actually loops in this order: received_today, worked_today, total_callbacks, total_priority, total_waiting, total_for_today.
    I even set the next navigation item property for each item, but that didn't help.
    My questions:
    1. Is there a way to control what order the data block loops through items?
    2. Why does this line get_item_property(get_block_property(block_name, FIRST_ITEM), x_pos); sometimes return null? (in my "proof of concept" form it returns a value, but the form I am modifying does not)
    Following is my code:
    PROCEDURE set_x_y_positions IS
         current_x_position pls_integer;
         current_y_position pls_integer;
      block_name varchar2(30) := 'BLOCK22';
      CurrentItem varchar2(30);
    BEGIN
      go_block(block_name);
      current_x_position := get_item_property(get_block_property(block_name, FIRST_ITEM), x_pos);
      current_y_position := get_item_property(get_block_property(block_name, FIRST_ITEM), y_pos);
          go_block(block_name);
      loop
           BEGIN
                if :system.cursor_item <> (block_name || '.' || get_block_property(block_name, FIRST_ITEM))
                     and get_item_property(:system.current_item, displayed) = 'TRUE' then            
                  SET_ITEM_PROPERTY(:system.current_item, x_pos, current_x_position + 38);
                  current_x_position := get_item_property(:system.current_item, x_pos);
                end if;
                if :system.cursor_item = 'BLOCK22.INTERNATIONAL' THEN--block_name || '.' || get_block_property(block_name, LAST_ITEM) then
                          exit;
                else
                     next_item;
                end if;
           END;
      end loop;
    END;I am using Forms 6i version 6.0.8.26.0
    Thank you!
    Katia

    I do have an exit, and yes it does run well.
         if :system.cursor_item = 'ATS_MON_REPORTING_QUEUES_VW.INTERNATIONAL' THEN--block_name || '.' || get_block_property(block_name, LAST_ITEM) then
                          exit;
                else
                     next_item;
                end if;That redundant go_block is there because I had some output going to a dummy field in another block, so I had to make sure it was navigating back to the block. But yes, in this code example, that go_block is redundant.
    Thank you, adding the
    current_x_position := get_item_property(block_name||'.'|| get_block_property(block_name, FIRST_ITEM), x_pos);
      current_y_position := get_item_property(block_name||'.'|| get_block_property(block_name, FIRST_ITEM), y_pos); worked perfectly.

  • How to loop through the "On My Mac" folders in mail?

    Hi there - i am new to applescript, but am slowly working out how to use it.
    I am stumped on how to write a rule that will move a message to a folder identified by a tag in a message (I am using MailTags).
    I have script that will take the first tag and move the message to a mail folder in a fixed location (e.g. Archive/<tag name>) however I wanted to make it more generic by looping over all of my mail folders and finding one that matched the tag name.
    However I am stumped on how to loop over all of my mail folder names - I have tried:
    repeat with aFolder in (every mailbox of (mailbox for "ON MY MAC"))
    and
    repeat with aFolder in every mailbox of inbox
    etc.
    but none of these seem to work.
    Is there some magic syntax to do this, so that I can do:
    if (name of aFolder = msgTag) then
    move oneMessage to mailbox (name of aFolder)
    end if
    Tim

    You don't necessarily need to assign a variable to the entire list in order to loop through them (unless you really want to) - for example:
    tell application "Mail" to repeat with aFolder in (get mailboxes)
            -- do stuff with aFolder
    end repeat
    There are several AppleScript resources, but the main ones I use are:
    AppleScript Language Guide
    AppleScript Tutorials at MacScripter.net

  • Looping through inbox items on timer event is really slow...?

    Hi,
    I have an issue with a email sync event that I am running.  Essentially, I am given a date (the received date of the last email synced) via another process and then need to return all the emails in the user's inbox the where receivedDate > this given
    date.
    I have a timer object than triggers my sync event every 15 mins.  I also have a button that allows the user to manually activate the sync - this basically changes the timer to 3 secs and so it fires the sync event.
    If the sync event is fired manually as per above, it loops through everything quite quickly (~12,000 emails in 30 secs) and I can stored the sender/recipient and received time data I require from these in a list of objects, which I sync later on in a background
    process.  During this loop the main UI freezes up, which is fine since I show a progress bar so the user knows how long they need to wait, and a large sync like this should only occur on their first sync theoretically.  If the first sync event is
    fired without the manual input - so still called from the same timer event, but just on the normal 15 min event, not the shortened 3 sec one - then it runs differently.  The sync takes a lot lot longer, and the UI doesn't freeze up.
    I presume this might be because it is fired slightly differently and does not hog up the main thread, but rather shares it with normal Outlook operations.  Maybe the operations are being run on a background thread and then keep having to jump into the
    main thread to access the email items...?  Either way, I'm not quite sure how this is happening since the only difference is the user pressing a button that changes the timer.interval.  The code that is run is the same, and the button press doesn't
    trigger the actual sync itself.
    Is there a way I can force this first sync to always run solely in the main thread, it can freeze up Outlook and show the progress bar until it is done?  Ideally any subsequent syncs would then be run with no progress bar and no freezing up of the UI.
    Many thanks,
    Tom

    Hello Tom,
    > Maybe the operations are being run on a background thread and then keep having to jump into the main thread to access the email items...?
    You shouldn't use another threads when dealing with the Outlook object model. Office applications use the single threaded apartment (STA) model and don't support multithreading. All calls made from another threads are marshalled by Outlook to the main
    thread. However, you can use a low-level code (Extended MAPI) to access the data from secondary threads. For example, you can use Redemption which is based on Extended MAPI.
    >  it loops through everything quite quickly (~12,000 emails in 30 secs)
    Instead of looping over all items in the folder I'd recommend using the
    Find/FindNext
    or
    Restrict methods of the Items class. You can read more about them in the following articles:
    How To: Use Find and FindNext methods to retrieve Outlook mail items from a folder (C#, VB.NET)
    How To: Use Restrict method to retrieve Outlook mail items from a folder
    You can use the System.Windows.Forms.Timer class which uses the main thread for invoking the Tick event. The .NET
    Framework Class Library provides three different timer classes: System.Windows.Forms.Timer, System.Timers.Timer, and System.Threading.Timer. Each of these classes has been designed and optimized for use in different situations. The Comparing
    the Timer Classes in the .NET Framework Class Library article examines the three timer classes and helps you gain an understanding of how and when each class should be used.
    Also you may find the
    AdvancedSearch method of the Application class helpful. Pay special attention to the fact that the search is performed in another thread. You don’t need to run another thread manually since the
    AdvancedSearch method runs it automatically in the background. See
    Advanced search in Outlook programmatically: C#, VB.NET for more information.

Maybe you are looking for

  • Time Capsule as External Hard Drive Doesn't Save Harddrive Space.

    I have a 2TB TC and I am trying to use it as a wireless external harddrive. I was able to transfer my music from my computer to the TC but when I deleted it from my computer and checked my storage stats it just said my music went down by 10 GB but my

  • Reg:Insert the record in another ztable

    Hi Experts,                   My scenerio is that when a record is inserted from a program to a table i need to added the same values to another table which is on different server(ex: BW). Is it necessary to create events to do that because i don't n

  • Maybe I havent found it yet but...

    Is there a way to set a buffer size to a JEditorPane? It will be placed inside a JScrollPane so maybe it needs to be done via the scroll pane... The plan is to have a mudclient type interface (it isnt for a mud client just using it as an example) whe

  • 10.4.2 No Boot w/ FW HDD I Use for Backup

    Okay, so I plug in my new iMac 20", RevB and all my accessories. Including me 200GB external Fire Wire HDD. Everything is good. Then, I run Software Update and things are fine. After restarting with the 10.4.2 update, I get the "Please Restart Your S

  • Deserializing to a completely different classname ?

    Hi, I'm trying to read in a serialized obfuscated class, and dynamically replace it with an unobfuscated version. The classnames, method names & field names are different, but the field types are the same. Any ideas ? Or is it possible at all ? any h