Re: Wait for applescript to complete
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