Thread: Wait in applescript.
06-21-2012, 09:08 PM #1
Wait in applescript.
- Member Since
- Jan 04, 2011
I am trying to make a simple AppleScript application in Xcode. I want it to set the computer to sleep after 30 minutes. My code looks like this:
property parent : class "NSObject"
-- Insert code here to initialize your application before any files are opened
tell the application "Finder" to sleep
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
06-22-2012, 02:36 PM #2
I beleive the Applescript delay command still works in ApplescriptObjC projects, like this.
delay (30) --delays code execution for thirty seconds
06-22-2012, 02:44 PM #3
06-22-2012, 05:07 PM #4
vansmith is right, the delay setting is in seconds and not minutes, I read your posting wrong.
The other alternative is to create your own timer with the NSTimer class, but that will be a bit more involved, so see how you get on with the delay command first.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By ohmandd in forum OS X - Operating SystemReplies: 6Last Post: 12-15-2011, 11:15 AM
By ogacon in forum Switcher HangoutReplies: 9Last Post: 03-21-2008, 02:20 PM
By mac2k in forum Apple DesktopsReplies: 3Last Post: 08-29-2007, 12:07 AM
By Spicky in forum Apple NotebooksReplies: 29Last Post: 05-15-2006, 01:29 AM