start stop button for xcode app

Discussion in 'Mac Programming' started by idonotliketostu, Mar 17, 2010.

  1. idonotliketostu macrumors 6502

    Joined:
    Feb 28, 2008
    #1
    I wrote an applescript script that would loop forever refreshing an rss feed. I use it quite often so i though it'll port it over to xcode and make it neater. When i press a button to start, the program loops and it locks up, its working but it's frozen. How do I make a start stop button looping something without making the program freeze?
     
  2. fernandovalente macrumors 6502

    fernandovalente

    Joined:
    Aug 29, 2008
    Location:
    Third world **** hole, I mean, Brazil
    #2
    Do NOT use an infinite loop, it will certain crash your app. Use NSTimer for that. NSTimer is used to execute a function in a period of time you set. If I wanted to create an infinite loop, I would set it to 0.1 seconds.

    Hope that helps.
     
  3. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
    #3
    As far as I know, you cannot actually use NSTimer in an Applescript. What you might want to investigate is "Stay Open" scripts.

    Try this page
     
  4. fernandovalente macrumors 6502

    fernandovalente

    Joined:
    Aug 29, 2008
    Location:
    Third world **** hole, I mean, Brazil
    #4
    He/She wants to port it to Objective-C. At least that's what I understood.
     

Share This Page