• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Wait for applescript to complete
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wait for applescript to complete


  • Subject: Re: Wait for applescript to complete
  • From: Scott Ribe <email@hidden>
  • Date: Thu, 12 Jul 2007 16:50:36 -0600
  • Thread-topic: Wait for applescript to complete

Style suggestion: do you know about string constant concatenation in C? Do
you know the Objective-C compiler does the same thing for NSString
constants? In other words, this:

> NSString *source = @"tell application \"System Events\" \nset
> iSync_Running to (exists process \"iSync\")\nend tell\ntell
> application \"iSync\"\nlaunch\nif not syncing then\nsynchronize\nend
> if\nif not iSync_Running then\nrepeat while syncing\ndelay 1\nend
> repeat\nquit\nend if\nend tell";

Could be written as:

NSString *source =
    @"tell application \"System Events\" \n"
        @"set iSync_Running to (exists process \"iSync\")\n"
    @"end tell\n"
    @"tell application \"iSync\"\n"
        @"launch\n"
        @"if not syncing then\n"
            @"synchronize\n"
        @"end if\n"
        @"if not iSync_Running then\n"
            @"repeat while syncing\n"
                @"delay 1\n"
            @"end repeat\n"
            @"quit\n"
        @"end if\n"
    @"end tell";

Somewhat easier to read ;-)

--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Wait for applescript to complete (From: Andrew James <email@hidden>)

  • Prev by Date: Re: Bonjour Rendezvous
  • Next by Date: Re: NSTask troubles
  • Previous by thread: Re: Wait for applescript to complete
  • Next by thread: Re: Wait for applescript to complete
  • Index(es):
    • Date
    • Thread