 |
 |
Schedule a windowed app with launchd
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2006
Status:
Offline
|
|
Hi everyone!
I'm a novice in Mac OS X programming and I need for help with starting apps by schedule. Please help me, people!
As I understand, launchd deamon is the best way to schedule any task, including a windowed app. I had a chance to schedule the app with launchd, but there is one problem. My app is started as service application. It has a window, but the window doesn't receive user's input (clicks on buttons etc). So, the question is how to start the app under WindowServer process with launchd to make the app interactive with user? Or might there be another way to do the app interactive?
I used "open" command to run my app under WindowServer. It was succsessful, but there is side effect - "open" command starts terminal window. Sure, it's inappropriate.
--
Thanks in advance,
Vadim
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status:
Offline
|
|
A system service should probably not have a GUI at all. Then you could have a separate componenent (a normal application) with a GUI which can be run by users (automatically on login, if you wich). There are a variety of ways for the two to communicate (eg, distributed ojects in Cocoa). Not sure if this applies to your situation, as I'm not sure what you mean by 'service'.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2006
Status:
Offline
|
|
2 Brass
My application is not service or deamon etc. My app is usual GUI application. I just need to start it by schedule with command-line parameters.
(Last edited by MereMortal; Jul 18, 2006 at 03:07 PM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2006
Status:
Offline
|
|
2 Angus
I read the article, but it says that I'm on right way. Namely, an agent can be a GUI application. That means, it can have one or more windows. I run my app as agent, so there should be no problem (I don't write about situation when user logins to the system thru console in context of other user. Such situation is not interesting for me at this moment). But there is a problem - as I wrote in my post, launchd starts my app and my app shows its window, but I can't press any button on the window. That is exactly the problem. Why is the window displayed, but user can't interact with the window?
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status:
Offline
|
|
Originally Posted by MereMortal
2 Brass
My application is not service or deamon etc. My app is usual GUI application. I just need to start it by schedule with command-line parameters.
So is there any reason you don't want to run it as a normal login item?
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2006
Status:
Offline
|
|
2 Brass
Yes. Because a login item is started just after user loged-in. But I need to start my app by schedule. For example, I need to start the app at 2006-09-01 15:45. If Mac is off at the specified time, the app must start as soon as Mac have started.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Originally Posted by MereMortal
2 Angus
I read the article, but it says that I'm on right way. Namely, an agent can be a GUI application. That means, it can have one or more windows. I run my app as agent, so there should be no problem (I don't write about situation when user logins to the system thru console in context of other user. Such situation is not interesting for me at this moment). But there is a problem - as I wrote in my post, launchd starts my app and my app shows its window, but I can't press any button on the window. That is exactly the problem. Why is the window displayed, but user can't interact with the window?
There are issues with launchd and windowed applications in Tiger, as I said. You will have to use a different solution.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2006
Status:
Offline
|
|
2 Angus
Yes. There are issues. But I didn't find any issue, caused my problem. Maybe you wrote about certain issue which I overlooked while reading the article. If so, what is the issue do you mean? Also maybe could you write me other solution that I can use instead of launchd?
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jan 2002
Location: Melbourne, Australia
Status:
Offline
|
|
Due to a limitation in current system software (r. 4255854), launchd agents are much less useful that you might think. Specifically, the system creates a single instance of launchd for each user on the system, rather than for each login session. Thus, if the same user logs in via the GUI and SSH, they only get a single instance of your launchd agent and you can't guarantee which context it inherits.
(r. 4255854) refers to an internal Apple Radar bug raised with the problems.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status:
Offline
|
|
Originally Posted by MereMortal
2 Brass
Yes. Because a login item is started just after user loged-in. But I need to start my app by schedule. For example, I need to start the app at 2006-09-01 15:45. If Mac is off at the specified time, the app must start as soon as Mac have started.
If you want it to run at startup, and not at login, it would be advisable to NOT have a GUI at all for it (and have a separate GUI utility to communicate with it later, after login, if necessary).
Or do you want users to be able to interact with it a GUI when nobody is logged in (ie, do you want a GUI to appear on the same screen as the login panel?
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|