ITunes graceful exit from using SDK

hello,
im developing a c# application that uses the iTunes sdk to copy and share the playlists.
i've also found a way to detect the iTunes shutdown to shutdown my application, however, i also need to prevent iTunes from asking this annoying question,
"One or more applications are using the iTunes scripting interface. Are you sure you want to quit?"
I hope people who developed the iTunes sdk for c# could help me out here.
Thank you so much!

Okay, I think I need some more help with my problem. This is how I have constructed the code per the suggestion mentioned above:
class NewThread implements Runnable {
     Thread t;
     NewThread() {
          t.start();
     public void run() {
          try
               Thread.sleep(60000);
          catch (Exception e) {
               System.out.println(e);
public class ExecuteCommand {
  static int run( String[] cmdvars ) {
    try {
      Runtime rt = Runtime.getRuntime();
      Process proc = rt.exec( cmdvars );
NewThread(); //This starts the sleep thread
      int exitVal = proc.waitFor();
       return exitVal;
    } catch ( Exception e ) {
      System.out.println(e);
      return -1;
  }So, over here the NewThread() starts the sleeping part while the original thread continues running the external program until it finishes. What is the best way to check for the status of proc, and how do I destroy proc if NewThread() finishes first? Also, the way it is written right now, will it still wait if proc finishes first?
Any pointers will be much appreciated.
Thanks.

Similar Messages

  • Gracefully exit from a Linux kill

    Is there a way to gracefully exit from a Linux kill command?
    Given the following code:
      public static void main(String[] args) throws IOException
        boolean bExit = false;
        while (!bExit)
          try
            Thread.sleep(1000L);
          catch (InterruptedException ex)
            bExit = true;
        System.out.println("Program exiting gracefully.");
      }Is there a way for the Linux kill command to make the message "Program exiting gracefully." appear?

    Certainly not for kill -9.
    But you can look at Runtime.addShutdownHook().The problem I have with Runtime.addShutdownHook() is (from the API Javadoc):
    "Shutdown hooks should also finish their work quickly. When a program invokes exit the expectation is that the virtual machine will promptly shut down and exit. When the virtual machine is terminated due to user logoff or system shutdown the underlying operating system may only allow a fixed amount of time in which to shut down and exit. It is therefore inadvisable to attempt any user interaction or to perform a long-running computation in a shutdown hook."
    I just was wondering if there was a built-in hook for the kill command like the hook for "kill -3" that calls the Thread.interrupt() method on the main thread of execution.
    My actual code is more like:
      public static void main(String[] args) throws IOException
        boolean bExit = false;
        SubThreadManager1.init();
        SubThreadManager2.init();
        while (!bExit)
          try
            Thread.sleep(1000);
          catch (InterruptedException ex)
            bExit = true;
        // After these shutdown methods are called it could take up
        // to 30 seconds before they reach the stopped state.
        SubThreadManager1.shutdown();
        SubThreadManager2.shutdown();
        while (!SubThreadManager1.isStopped() || !SubThreadManager2.isStopped())
          try
            Thread.sleep(500L);
          catch (InterruptedException ex)
        System.out.println("Program exiting gracefully.");
      }I was just simplifiying the test case to get the point across.

  • HT2204 If I change my password does stop the kids from using I tunes?

    If I change my password on apple I'd will my kids be able to order off I tunes with the old password?

    It would stop them from purchasing through iTunes, but not from using it otherwise. But you may be able to do that through Parental Controls. Or create a user account exclusively for their use, then change your admin account password so they cannot access your account. Use Parental Controls on their account to restrict their use of iTunes.

  • Can you help me EXIT  from the itunes store back to my play list?

    can you help me EXIT  from the itunes store back to my play list?

    If you're using iTunes 11, click on "Library" on the top right, then clck on "Playlists" on the top.

  • I accidentally uploaded songs from cds to the wrong itunes library. i would like to move those songs to my regular itunes library that i use to purchase and download music, since my ipod cant sync to both libraries. how can i do this? please advise. thank

    i accidentally uploaded songs from cds to the wrong itunes library. i would like to move those songs to the regular itunes library that i use to purchase and download music, since my ipod cant sync to both libraries. how can i do this? please advise? thank you.

    See this older post from another forum member Zevoneer covering the different methods and software available to assist you with the task of copying content from your iPod back to your PC and into iTunes.
    https://discussions.apple.com/thread/2452022?start=0&tstart=0
    B-rock

  • How can I play an HD movie purchased from Itunes  on my TV using HDMI connection?

    I would like to know how i can play movies purchased in Itunes on my TV using the HDMI cable?   When I try playing HD movies from Itunes I can't play them.  I get the following error:
    "To play in HD, you must have a computer with a built in display or have it connected to a display that supports HDCP".
    I used to be able to play them before but not anymore.  Not sure why.  Maybe it's due to the new update.  Is there a fix?
    Thanks,

    Ok, best to contact itunes then so they can look into it

  • How do I sync my iPod to iTunes? I've used the final steps from Article HT1329, but when I open my iPod there is no "iTunes" folder.  Please help!

    How do I sync my iPod to iTunes?  I've used the final steps from Article HT1329, but when I open my iPod there is no "iTunes" folder.  Please help!

    Ah I see. That folder would only be there if you had perfomed the earlier steps in that section.
    Recover media from iPod
    See this post from forum regular Zevoneer for options on moving your iPod data back to your computer.
    tt2

  • HT3819 If I have to load the same apple id on all devices to use home share, does that preclude each device from using a second apple id and does that constitute a separate Itunes db or something?

    If I have to load the same apple id on all devices to use home share, does that preclude each device from using a second apple id and does that constitute a separate Itunes db or something?

    Welcome to the Apple community.
    Only one of your libraries needs to use your iTunes Store Apple ID for home sharing. Your other computers can use their own ID for iTunes, so long as they use the same ID as all of the devices on the network for home sharing.

  • I am receiving a new ipad (3 i guess) from my mom who is in the U.S but i am currently in the philippines. I ofcourse, want to have apps,games,movies etc. can i use an itunes giftcard (also from the U.S) to buy my apps without any problems?

    i am receiving a new ipad (3 i guess) from my mom who is in the U.S but i am currently in the philippines. I ofcourse, want to have apps,games,movies etc. on it. can i use an itunes giftcard (also from the U.S) to buy my apps without any problems?

    No.
    iTunes terms of service:
    The iTunes Service is available to you only in the United States, its territories, and possessions. You agree not to use or attempt to use the iTunes Service from outside these locations. Apple may use technologies to verify your compliance.

  • I got a Itunes gift card from my uncle from the UK and i live in Sweden, how do i use it? It says that my account only allows me to buy from swedish iTunes

    I got a iTunes gift card from my uncle, he lives in England and i lve in Sweden, so i cant use it because it only works in the "UK Itunes". And when i change so i get "UK Itunes" i cant buy it cause my account only allows me to buy in swedish Itunes store... Please help me!!!

    You cannot use it.
    Gift cards are country specific.
    Sorry
    Give it to some in the U.K who can use it

  • How to deactivate other phones from using my itunes account

    Please help how to deactivate other phones from using my itunes account?

    Hello Kirstyspencer
    I would sign out of your Apple ID on those devices and also change the password to your Apple ID. That should stop people from accessing and using your Apple ID.
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/ht1311
    Apple ID: Changing your password
    http://support.apple.com/kb/ht5624
    Regards,
    -Norm G.

  • How can i see the "manage devices" in my itunes account? because i want to remove a device from using my apple id. tnx so much

    how can i see the "manage devices" in my itunes account? because i want to remove a device from using my apple id. tnx so much

    Thanks pvonk, I will try downloanding the book from the Iphone right now.......
    Just tried to download and it wants me to buy it again?  Is there some way around this?  I guess I thought that was the whole point of the cloud, buy it once and access from any of your devices right?
    Also, I have logged into the icloud.com as suggested and will plink around there for a bit and try to understand.  It is just all so dang different that what I am used to; Apple's way, that is.
    Thanks again for the Icloud tip and if you know of a way to download without making a 2nd purchase I would sure love to hear it!
    Geez. one other thing (I guess I am complaining) but I bought more space in the cloud, they took my cash fast enough but have not yet increase the size of my storage space yet?  Is Apple sometimes slow to get internal stuff done?

  • How do I stop iTunes from using the cloud?

    I use iTunes primarily for listening to podcasts.  I recently upgraded to version 11.1.
    Now, it used to be that I'd refresh podcasts, download the subscribed ones, listen to them, delete them. done.  I just opened iTunes and under one of the podcasts, there were about a hundred old ones; I used to be able to show everything on one page, now I have to scroll 4 or 6 pages to see what I want.  The "new" podcasts have a little cloud icon, so I guess that's where they are, or downloaded from.
    Two questions:  how do I delete these files, and how do I stop from using the cloud for podcasts?
    (This is a repeat question, because SoonerDoc1 marked it as solved, and it's not)

    That doesn't fix it as the podcast with the cloud logo show up as/in unplayed, I subscribe to CNET First Look Podcasts, some download and some don't download but have a cloud logo. Seems very random. iTunes is a badly written application that is getting worse after every new release.  If iTunes doesn't improve soon I'll downgrade to iTunes 10.7 which was just about use-able. for the second time.

  • HT1689 Can I use iTunes store credit (from a gift card) to purchase an app for a friend?

    Can I use iTunes store credit (from a gift card) to purchase an app for a friend?

    No.
    (71262)

  • How to show screen design in .srf (from Screen Painter) using SDK?

    How to show screen design in .srf (from Screen Painter) using SDK?

    You need to use the LoadBatchActions method of the Application object to load .SRF files.
    John.

Maybe you are looking for

  • My macbook keeps crashing, and now won't startup, not sure what issue is!?

    I got a used macbook about 3 months ago, it's the second I've bought and had no issue with it up until about a month ago, when it started giving me the fatal error and saying "please restart your computer" and freezing up. I tried to run disk utility

  • Need to have a reply-to address different than my Gmail account.

    I use gmail to send and receive my business email. When I send mail the recipient sees it as coming from [email protected] not gmail. On the mac this is fine as the "Email Address" is different to the username used to login to the Gmail IMAP account.

  • Does the new mac mini server do lights out management?

    can't see it in the tech specs anywhere...

  • BGB Best path selection

    Hi, Could someone tell me why second path remains as best? MPLS_CORE#show ip bgp 192.168.1.0 BGP routing table entry for 192.168.1.0/24, version 27 Paths: (2 available, best #2, table default)   Advertised to update-groups:      1            Refresh

  • Query Timeout setting

    Hi Folks, Can we have a setting for the Oracle Server that for a particular user, if a query is taking beyond a particular time (say 2 mins), it should be timed out. Regards, Gaurav