Interrupt repeat loops with buttons

Hi,
How do I make buttons available to the user while I run a repeat loop?
I'm doing a shell script in the background and I'm using a repeat loop to read out the log of the results. Meanwhile, I want to have a Cancel button available to the user.
The button however doesn't respond while the repeat loop runs, while the rest of my UI is in fact updating (based on the incoming log). I'm even using a one second delay at the beginning of the loop.
I'm using AppleScript Studio in Xcode/Interface Builder.
Thanks,
JW

1. Create a control in the window which has some sort of boolean property (if you are using a progress bar, then you already have one, since a progress bar can be indeterminate, and you can check this).
2. Set the handler which shows the window (or alters the window when the process begins) to set this boolean property to a particular value
3. Have the "Cancel" button handler invert the property
4. Have the repeat loop check the property as part of its boolean condition (as in "repeat while x is true")
Note that if the window is going to go away anyway when the process is complete, then you can use the window's title to indicate the status: set the title to "Cancelling..." and have the repeat loop check whether the title of the window is "Cancelling...".
You could also just create a global within the script file, and have the repeat loop check the status of the global, but that tends to lead, sooner or later, to overlapping reuse of a single global value, which is a bug.

Similar Messages

  • Controlling A Loop With Buttons

    Basically I need start and stop buttons for my loop which is in the main method. I figured I would use a boolean variable whose value is changed by the click of the buttons in a while statement. The problem is the loop is never started. So I must be following the wrong procedure. I would appreciate any help.

    This is part of the code
    public class MyClass extends JFrame implements ActionListener{
    private JButton start, stop;
    private boolean test;
    .....//other variables
    public MyClass() {
    ...initialize other variables
            test = false;
               setTitle("My Class");
               setLayout(new BorderLayout());
               grd = new MyGrid(W,H);
               add(grd);
         JPanel p = new JPanel();
         p.add(start = new JButton("Start"));
               p.add(quit = new JButton("Quit"));
               p.add(stop = new JButton("Stop"));
               add("South",p);
    //My actionPerformed Looks like this
    public void actionPerformed (ActionEvent e) {
            String s = e.getActionCommand();
            if ("Start".equals(s)) {
                flag= true;
            } else if ("Stop".equals(s)) {
                flag = false;
    //...other methods
    public  static void main(String []args){
              MyClass frame = new MyClass();
              JFrame.setDefaultLookAndFeelDecorated(true);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                     frame.setSize(FRAME_WIDTH,FRAME_HEIGHT);
                     frame.setVisible(true);
           while(frame.test == true){
             ///do the loop stuff
    }//end main
    }//end MyClass

  • How to interrupt running subvi with global variation

    Hi,all
       I want to use global variation STOP to interrupt the running VI at anytime, but the subVI must be running until executing the WHILE. I knew when one action is  operated in the EVENT case, the other action will not be iperated. My question is how to solve the problem without  POP subVI and the DATA transmitted to MAIN panel. Give me a suggestion, THKS!
      Lioncsu  
    Attachments:
    Main VI.jpg ‏43 KB
    Sub VI.jpg ‏41 KB

    Hi Lioncsu,
          In Main, when a Start event occurs, the Value of Stop (False?) is immediately written to the Global (once), and SubVI starts running.  The Start event case won't complete - or write another value to the Global - until the SubVI is done.  I haven't run this, but I think pressing Stop may cause the SubVI to run (again) - for one iteration! 
    Attached is a simple VI which uses two loops - one to handle GUI events (the buttons) and one to start a while loop.  Maybe you can replace the while-loop with your SubVI?
    Hope it helps!
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
    Attachments:
    Notifiers.vi ‏51 KB

  • Adobe Extension Manager loops with the following message: "The Extension Manager will now launch and

    Hi, whenever I open Dreamweaver CS5 I get this message:
    Adobe Extension Manager loops with the following message:
    “The Extension Manager will now launch and finish updating Dreamweaver”.
    Then the manager starts and I have to wait and click a few buttons until I can close it.
    How can I stop the Extension Manager popping up?
    Thanks for advice.

    Seems to be a lot of this going on. Wondering if we're wasting our time with this??!!

  • Having trouble with buttons in motion menus

    I'm having some problems with buttons in motion menus:
    - I've created a motion menu where some text (button names) fade in.
    - I set a loop point after the text has faded in completely.
    - I set the end condition to "loop"
    (there is some animation after the text fades in that I would like to loop)
    - I draw out 5 buttons and assign different overlay colors to each of the button states.
    The problem is that each time the motion menu jumps back to its loop point.. the menu seems to stutter - the overlay color on the currently selected button turns off for a second and the button is momentarily disabled (can't be selected). This problem only shows up on the actual dvd build. The buttons work smoothly when tested in the simulator.
    I can avoid this problem by losing the animation and just setting the end condition to "still".. but I was wondering if anyone knows if there is something I might have missed or could try as a workaround.
    17" powerbook g4   Mac OS X (10.4.5)  

    This problem only shows up on the actual dvd build. The buttons work smoothly when tested in the simulator.
    It could be how the DVD is reading the DVD (sort of the nature of DVD, everything is not exactly the same), because buttons will not show until the loop point and there may be a slight pause from end of animation in the menu to the loop point. And the overlay will turn off briefly when it hits the end.
    Visually what you can do is make the animation in a manner so that at the loop point the buttons are part of the background itself and make sure your loop point is at that point (or slightly after) so it looks like the button is there.
    For the most part the setting of still may work okay (really a creative call), sometimes listening to the same music/seeing samee animation may be too much (of course it depends on project) and you can jump to the loop point on the menu on subsequent calls

  • Display a message in a For Loop  with field value

    Hello All,
    pls,i wanna display a message in a For Loop with field value the code is:
    FOR Q1 IN GET_SUM_EXP_QUANTITY LOOP               .
    INSERT INTO PLN_PLAN_DISTRIBUTION_WAY
    (FIN_YEAR_CODE , MONTH_CODE , MATERIAL_CODE , DISTRIBUTION_WAY , EXPECTED_QUANTITY , GROUP_CODE)
    VALUES (:PLN_PLAN.FIN_YEAR_CODE , TO_CHAR(V_FROM_DATE,'MM') , Q1.MATERIAL_CODE , 1 , V_MONTHLY_QTY , Q1.GROUP_CODE);
    MESSAGE(':PLN_PLAN.FIN_YEAR_CODE'||:PLN_PLAN.FIN_YEAR_CODE ||' '||'V_FROM_DATE = '||TO_CHAR(V_FROM_DATE,'MM'), 'Q1.MATERIAL_CODE'||' '|| Q1.MATERIAL_CODE||' '||'DISTRIBUTION_WAY'||' = 1'||'EXPECTED_QUANTITY'||' = '|| V_MONTHLY_QTY||'GROUP_CODE'|| ' '|| Q1.GROUP_CODE);
    FORMS_DDL('COMMIT');
    How 2 display a message with the value:
    Q1.MATERIAL_CODE
    Q1.GROUP_CODE
    message(Q1.MATERIAL_CODE)     
    gave me numeric or value error on run time when pressed on button
    Regards,
    Abdetu..

    Thanks 4 reply..
    again they r in a For Loop as mentioned above...
         INSERT INTO PLN_PLAN_DISTRIBUTION_WAY
                                                           (FIN_YEAR_CODE , MONTH_CODE , MATERIAL_CODE , DISTRIBUTION_WAY , EXPECTED_QUANTITY , GROUP_CODE)
                                            VALUES (:PLN_PLAN.FIN_YEAR_CODE , V_REPAIR_MONTH , Q1.MATERIAL_CODE , 1 , V_REPAIR_Qty , Q1.GROUP_CODE);
    FORMS_DDL('COMMIT');
    The fields in bold r required to be displayed for testing puposes..
    this gives me numeric or value error in runtime..
    Best regards,
    Abdetu..

  • Horizontal Looper with Spry

    In ASP there are ways and extensions for creating Horizontal
    Loops in dreamweaver.
    Is there a way to create a Horizontal Loop with a Spry
    Dataset?

    It would just be a table with an image in it.
    <table>
    <tr>
    <td><img src="spryimgdata"/></td>
    </tr>
    </table>
    The img src is pulled from a spry dataset, but instead
    repeating the images all the way accross I would want to display
    only 3 images then start a new row and do another 3 images, and so
    on.
    Thanks

  • How do you start a loop with an event and end the loop when u release ....

    How do you start a loop with lets say an event of some sort, whether it be holding down a key or pressing the mouse click and then stopping the loop when you release that key or mouse button.?
    double c = 1.8, i = 1, max = 90, exp = 0;
    final double inc = 0.002; //speed at while it increases
    boolean f = false, g = false;
    while (true)
        while (f == false && stopMeter == false) //increasing speed going up to 90
            exp = Math.pow (c, i);
            i += inc;
            pAngle.setText (Math.round (exp) + "");
            if (exp > max)
                f = true;
                g = false;
            } //end if
        } //end while
        while (g == false && stopMeter == false)  //decreasing speed going down from 90
            exp = Math.pow (c, i);
            i -= inc;
            pAngle.setText (Math.round (exp) + "");
            if (exp < 1)
                g = true;
                f = false;
            } //end if
        } //end while
    } //end whilethis is a snippet of my increasing increments. Its for an angle meter. I can't get it to stop, when the user clicks or does something... the program just gets stuck in an infinite loop. I am still new to java and i do not know how to fix this.

    You are in the wrong forum. Try this one instead: http://forum.java.sun.com/forum.jspa?forumID=31
    /M

  • Repeat Loop times out and I don't want it to

    Maybe there is a better way to do this but I want an action to take place whenever the modification date of a certain file changes. This is what I use but it errors because of a timeout after about 10 mins if the mod date doesn't change. I need this to be checking all the time.
    on idle
    tell application "Finder"
    set UpdatedOLD to modification date of file aFile
    set UpdatedNEW to modification date of file aFile
    end tell
    repeat while UpdatedOLD = UpdatedNEW
    tell application "Finder"
    set UpdatedNEW to modification date of file aFile
    end tell
    end repeat
    end idle
    How can I get this to work?

    Hello
    I think you have stepped on a land mine set by OSX 10.6.
    There's a fatal bug in Apple Event Manager in 10.6 such that one event in every 65535 events will be lost and never be replied, which will result in Apple Event timeout error on sender. This bug has been reported shortly after the 10.6 release and has not yet been fixed as of 10.6.2.
    In your current script, you're continuously sending event to Finder and sooner on later send an event with the specific event id that is doomed to be lost. Judging from the time till you see the time out error, that is 10 min, you're at most sending 65535 / 600 = 109.225 events / sec to Finder. You can reduce the number of events by inserting some delay, e.g. 'delay 1' in your repeat loop but it can only defer the failure.
    cf.
    Re: Timed Out (Silence)
    http://lists.apple.com/archives/applescript-users/2009/Oct/msg00117.html
    Re: spurious timeout on nth Apple event on Snow Leopard
    http://lists.apple.com/archives/applescript-users/2009/Nov/msg00041.html
    A better way to achieve your task would be to let a launchd agent watch the file.
    A recipe is as follows.
    1) Save a compiled script in :
    ~/Library/Scripts/launchd/watchdog.1.scpt
    with contents :
    --SCRIPT
    -- Here put your script that is to be triggered when the file is modified.
    -- e.g.
    tell application "System Events"
    display dialog "The file is modified." giving up after 10
    end tell
    --END OF SCRIPT
    2) Save a UTF-8 plain text file in :
    ~/Library/LaunchAgents/watchdog.1.plist
    with contents :
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>watchdog.1</string>
    <key>Disabled</key>
    <false/>
    <key>Program</key>
    <string>/usr/bin/osascript</string>
    <key>ProgramArguments</key>
    <array>
    <string>osascript</string>
    <string>/Users/USER_NAME/Library/Scripts/launchd/watchdog.1.scpt</string>
    </array>
    <key>WatchPaths</key>
    <array>
    <string>POSIX_PATH_TO_THE_FIILE</string>
    </array>
    </dict>
    </plist>
    *Change USER_NAME to your user name and POSIX_PATH_TO_THE_FIILE to the POSIX path to the file to be watched.
    3) Issue the following command in Terminal to load the launchd agent :
    launchctl load ~/Library/LaunchAgents/watchdog.1.plist
    Or
    3a) Log-out and re-log-in to load the launchd agent.
    *The name 'watchdog.1.plist' and 'watchdog.1.scpt' and the script's location '~/Library/Scripts/launchd/' are mere examples. You may change them as you see fit.
    cf.
    http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/m an5/launchd.plist.5.html
    http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/m an1/launchctl.1.html
    Good luck,
    H
    Message was edited by: Hiroto (fixed typo)

  • Interrupting Keynote 3 with Front Row

    When I interrupt a slide with Front Row to play a song, I get the desktop back afterwards rather than the slide I interrupted. I have to manually click on the Keynote icon to get back to my slide. Is this the intended behavior? It would be really nice if the interrupted slide would come back up.

    When I interrupt a slide with Front Row to play a
    song, I get the desktop back afterwards rather than
    the slide I interrupted. I have to manually click on
    the Keynote icon to get back to my slide. Is this the
    intended behavior? It would be really nice if the
    interrupted slide would come back up.
    This drove me mad until I discovered the trick. This assumes you're using the Apple Remote.
    1) click through KN until the point you want to switch out to Front Row. (This can be any point, say build 27 on a slide with 43 builds. It can even be in the middle of an embedded QT movie - yes, even a 1920x1080 HDV assuming you've got the codec from FCP or QMaster).
    2) this is the important bit. Click the ENTER button on the remote - in the centre of the click wheel - BEFORE you click the MENU button to call up Front Row. The freezes KN at exactly the moment you click.
    3) Do whatever you want in Front Row
    4) Return to KN using the MENU Button to get back up the Front Row hierarchy
    5) Then click the ENTER button again to restart KN at exactly the point you left it. You do not get the Desktop back and you do not need to manually click the present slides button in KN.
    This really blew 'em away at one of my recent gigs.
    MacBookPro 17. G5 Dual 2Ghz. iMac G5   Mac OS X (10.4.7)  

  • Repeat loops

    Within a repeat loop, I get creation dates of sequential files. I can get the creation date of the first file but then when it repeats it wont get the creation date of the next file. When i run it again i can get the creation date of the first two, but not the third. The next time i run it i can get the creation date of the first three but not the fourth, and so on.
    Does anyone know why this is happening and what can i do to get the creation dates the first time?
    Thank you

    Hello John,
    The part where I am having a problem is here.
    I perform some script that allows me to find these files and which files i need to use and then there is this..
    count folder folderList
    set folderCount to result
    set x to 0
    repeat until x = folderCount
    set x to x + 1
    set filePath to folderList & ":" & x & ".jpg"
    get creation date of file filePath
    set creationDate to result
    get date string of creationDate
    set dateString to result
    get time string of creationDate
    set timeString to result
    theres a lot more between this and the end of the repeat.
    It won't allow me to get the creation date out of the file filePath. so there for I cannot perform the rest of this. I thought it was a problem with the computer because what I have should run. It does not run the first time, it says that the creation date is missing value in the event log. Then I run it again and it gets the first files date, but not the second. then the next time it gets the first two and not the third and so on..
    thanks for all the help,
    David

  • Nested Repeat Loops in Applescript

    The following code has two lists: myURLs and myIMGs. I want to loop through the sites listed in myURLs, take a screenshot, then save them in my Shared folder as the file name listed in myIMGs. So, google.com's image will be saved as "google.jpg", and so forth. The list in myIMGs corresponds to the list in myURLs.
    This is what I have, but it doesn't quite work. It loads the first URL from myURLs, takes a screenshot of it, but then loops through each file name in myIMGs and saves that one screenshot with all those various file names. Then, it loads the next URL in myURLs and does the same thing. How do I set the file names in the myIMGs list to correspond to the URLs being loaded from myURLs? I'm having trouble with the nested loops.
    set myURLs to {"https://google.com", "https://wikipedia.org", "https://bing.com", "https://apple.com"}
    set myIMGs to {"google.jpg", "wikipedia.jpg", "bing.jpg", "apple.jpg"}
    -- Sets settings of Safari without interferring with user's settings.
    repeat with myURL in myURLs
              tell application "Safari"
                        set myDoc to front document
                        set windowID to id of window 1
                        do JavaScript ("window.open('" & myURL & "','_blank','titlebar=0');") in document 1
      close window id windowID
                        set the bounds of the front window to {0, 20, 915, 812}
      delay 5
              end tell
    -- Screengrab, crop and save to Shared folder
              repeat with myIMG in myIMGs
                        do shell script "screencapture -o -l$(osascript -e 'tell app \"Safari\" to id of window 1') /Users/Shared/" & myIMG
                        set this_file to "Macintosh HD:Users:Shared:" & myIMG
                        try
                                  tell application "Image Events"
      -- start the Image Events application
      launch
      -- open the image file
                                            set this_image to open this_file
      -- get dimensions of the image
                                            copy dimensions of this_image to {W, H}
      -- Crops off the Safari header
      crop this_image to dimensions {W, H - 50}
      -- save the changes
                                            save this_image with icon
      -- purge the open image data
      close this_image
                                  end tell
                        end try
              end repeat
    end repeat

    Switch to an indexed loop and you don't need the extra repeat loop; you can run the two lists in parallel. See my changes in red:
    set myURLs to {"https://google.com", "https://wikipedia.org", "https://bing.com", "https://apple.com"}
    set myIMGs to {"google.jpg", "wikipedia.jpg", "bing.jpg", "apple.jpg"}
    -- Sets settings of Safari without interferring with user's settings.
    repeat with i from 1 to (count of myURLs)
              tell application "Safari"
                        set myDoc to front document
                        set windowID to id of window 1
                        do JavaScript ("window.open('" & item i of myURLs & "','_blank','titlebar=0');") in document 1
                                  close window id windowID
                        set the bounds of the front window to {0, 20, 915, 812}
                                  delay 5
              end tell
      -- Screengrab, crop and save to Shared folder
              do shell script "screencapture -o -l$(osascript -e 'tell app \"Safari\" to id of window 1') /Users/Shared/" & (item i of myIMGs)
              set this_file to "Macintosh HD:Users:Shared:" & myIMG
              try
                        tell application "Image Events"
      -- start the Image Events application
                                  launch
      -- open the image file
                                  set this_image to open this_file
      -- get dimensions of the image
                                  copy dimensions of this_image to {W, H}
      -- Crops off the Safari header
                                  crop this_image to dimensions {W, H - 50}
      -- save the changes
                                  save this_image with icon
      -- purge the open image data
                                  close this_image
                        end tell
              end try
    end repeat

  • Repeat loop in filemaker Pro 7 database

    How can I get my script to loop through a large FM database of records and change the data in a particular field as in the script below? I cannot figure out the syntax for the repeat loop...
    with timeout of "3000" seconds
    tell application "FileMaker Pro"
    go to database "CPA FM Log Copy"
    show every record of database "CPA FM Log Copy"
    set theCount to number of record of database "CPA FM Log Copy" as integer
    repeat with i from record theCount of database "CPA FM Log Copy"
    if field "ph" of record i of database "CPA FM Log Copy" is "NG" then
    set data field "ph" of current record of database "CPA FM Log Copy" to "Nice Going"
    else if field "ph" of record i of database "CPA FM Log Copy" is "EC" then
    set data field "ph" of current record of database "CPA FM Log Copy" to "Everything Cool"
    end if
    end repeat
    end tell
    end timeout

    Depending on the number of records in the database, this isn't the most efficient way of doing this.
    You should use a 'whose' clause in your script to narrow the FileMaker results to the subset of records you want to change, then change them all at once. This is far more efficient than looping through thousands of records in AppleScript looking for the ones you want.
    This should get you on the right track:
    <pre class=command>tell application "Filemaker Pro"
    go to database "CPA FM Log Copy"
    set theResults to every record of database "CPA FM Log Copy" whose field "ph" is "NG"
    set data field "ph" of every item of theResults to "Nice Going"
    set theResults to every record of database "CPA FM Log Copy" whose field "ph" is "EC"
    set data field "ph" of every item of theResults to "Everything Cool"
    end tell</pre>
    In this way you let Filemaker do the searching (which is what it's optimized for), and your script does the least work necessary.
    BTW, just so you know why your original script fails, it's because you say:
    <pre class=command>set data field "ph" of current record of database "CPA FM Log Copy" to "Nice Going"</pre>
    Note that you're always setting the 'current record'. This means that even if there are 1000 records in the database, you only ever set the first field. If you wanted to maintain the repeat approach this would have to change to something like:
    <pre class=command>set data field "ph" of record i of database "CPA FM Log Copy" to "Nice Going"</pre>
    so now it uses the loop iterator to track which record to change. An even better model that does use a scalar index is to do something like:
    <pre class=command>repeat with curRecord in every record of database "CPA FM Log Copy"
    if field "ph" of curRecord is "NG" then
    set data field "ph" of curRecord to "Nice Going"
    end if
    end repeat</pre>
    This nice thing about this model is that it uses FileMaker's internal references for records so that you know you're changing the right thing. This can be crucial if working in a multi-user database where there might be someone else is editing the data in parallel, changing theCount.

  • Repeat loops and goto's

    Can I ask two questions please,
    Q1.
    is there a way of telling a repeat loop to 'step' over
    numbers, I cannot find anything in the help files that mention this
    at all....
    For example, repeat with i := 1 to 200 'step 2' This would
    result in values of 1, 3, 5, 7, etc etc
    For example, repeat with i := 1 to 200 'step 3' This would
    result in values of 1, 4, 7, 10, etc etc
    Q2.
    Goto commands in a calculation icon.
    I can only find a reference that will use the
    goto(IconID@"TARGETICON") Is there anyway I can use the goto
    command inside a calculation. I need to set up a logical test,
    basically to say that if this isn't true go back to here and do it
    again(a repeat loop won't work)
    One day I think I may just get the hang of
    this.........

    I didn't examine your code closely, but for the future, if
    you need to
    randomly pull values from a list and you don't want
    duplicates...
    Copy the list to a new list, then after you pull a value from
    the list
    within the loop, immediately use DeleteAtIndex to remove that
    value from
    the temporary list. So during the next iteration of the loop,
    the
    previously pulled value is not present to be pulled again.
    Erik
    The Pc Doctor wrote:
    > Many thanks for your suggestions, I think I just got
    caught up the my knowledge
    > of VB and the for next loop, the solution was so obvious
    now you mention it.
    >
    > The second one I've also solved by way of different
    Calculation icons. Here
    > is what I was doing (Please forgive the awful code, I am
    still new at this)
    >
    > The whole point of this is to select a chosen number of
    Questions from a list
    > of a certain amount of questions - the numbers are not
    known and is subject to
    > change.
    >
    > I would seed a random numbers (between 1 and QNo) into a
    list of up to Q0
    > numbers and then use the below code to check to any
    duplicate numbers. The
    > problem I had was finding a way of if I found duplicate
    numbers replacing them
    > and testing them again, and again until no duplicates
    exist.
    >
    > I put the below in it's own calculation icon called
    'CheckIt'
    > - - - - - -
    > SortByValue(QuestionStore, TRUE)
    > again := 0
    > repeat with i := 1 to Q0 - 1
    > if QuestionStore = QuestionStore then
    > QuestionStore := Random(1,QNo,1)
    > again := 1
    > end if
    > end repeat
    > - - - - - - - -
    > I then put the following in a following calculation Icon
    > - - - - - - - -
    > -- Test to see if we have duplicate numbers, if yes then
    go back to the check
    > random numbers Icon.
    > if again = 1 then
    > GoTo(IconID@"CheckIt")
    > end if
    > - - - - - - - - - -
    >
    > Well it works
    >
    > Thanks again
    >
    > Paul
    >
    Erik Lord
    http://www.capemedia.net
    Adobe Community Expert - Authorware
    http://www.macromedia.com/support/forums/team_macromedia/
    http://www.awaretips.net -
    samples, tips, products, faqs, and links!
    *Search the A'ware newsgroup archives*
    http://groups.google.com/groups?q=macromedia.authorware

  • I have defined a finite state machine: pb with button : they need to be click twice

    I have defined a finite state machine and also defined a call to a C dll enabling to kill processus  since in my state machine I have to sequence several exe and being able to interupt them (This is the goal of mu manageProc dll)
    for the moment I make my integration test with the notepad.exe process
    the create and kill seems to work
    but I have problem wth my finite state machine I need to click twice on the differnts button for a given state to be really effective
    I have also used glabal variable and an event controller ( without that I was unable to get ffedback oo buuton click
    So my question are
    Is my problem due to the use of a shift register
    Please tell me if you need other file to understand my problem
    Regards
    Thibaut
    Attachments:
    Spectro State MAchine .vi ‏77 KB

    Thibaut,
    You should put the event structure into its own parallel while loop rather than sharing the loop with the state machine. Typically the terminals of the controls will be placed inside the event case where they are read. At least inside the loop.
    Run your VI with execution highlighting on (the light bulb on the diagram toolbar). This will show you how dataflow works.
    You probably do not need most of your global variables. Appropriate use of shift registers and wires would eliminate them.
    Lynn

Maybe you are looking for