Thread: Wait in applescript.
06-21-2012, 08: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, 01: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, 01:44 PM #3
06-22-2012, 04: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, 10:15 AM
By ogacon in forum Switcher HangoutReplies: 9Last Post: 03-21-2008, 01:20 PM
By mac2k in forum Apple DesktopsReplies: 3Last Post: 08-28-2007, 11:07 PM
By Spicky in forum Apple NotebooksReplies: 29Last Post: 05-15-2006, 12:29 AM