Re: WebKit+AppleScript+JavaScript
Re: WebKit+AppleScript+JavaScript
- Subject: Re: WebKit+AppleScript+JavaScript
- From: Praveen Kumar <email@hidden>
- Date: Thu, 17 Apr 2008 21:38:54 +0530
I used that one Jean-Daniel Dupas specified.
-[NSWorkspace
openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers
:];
where i gave nil for last two arguments.
I created a sample cocoa+webkit application and added apple
scriptability. I execute the script on this application from script
editor. The application opened the given url successfully, but i can't
able to quit the application from the dock (right click on the
application icon on the dock and select quit option). If i open the
application and load the url manually then it is quitting fine from
the dock.
I don't know where i am wrong.
Do any one of you face the same issue, then please let me know the
resolution for it.
Thanks.
On 17-Apr-08, at 2:44 PM, Jean-Daniel Dupas wrote:
You can use -[NSWorkspace
openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers
:];
Le 17 avr. 08 à 09:24, Praveen Kumar a écrit :
NSWorkspace launch the application but loads the url in the default
browser.
What i have to do to make the url open in the my application (webkit
+cocoa).
Please give me the suggestions.
On 16-Apr-08, at 8:26 PM, Mike Abdullah wrote:
If it is absolutely necessary to use NSTask for launching the app,
you can also use the "open" command which honours the one instance
per-app rule properly. However, I agree that NSWorkspace is the
best thing to use in most cases.
Mike.
On 16 Apr 2008, at 15:43, Jens Alfke wrote:
On 16 Apr '08, at 5:16 AM, Praveen Kumar wrote:
Instead of AppleScript, I tend to use NSTask to launch the
application, but it won't use the active application instead it
opens another one and do the stuff.
Launching GUI apps via low-level Unix system calls (as NSTask
does) can be problematic. CoreServices, which keeps track of
application processes, either isn't aware of those, or is but
treats them differently; I'm not sure which. I do know that the
"only one copy of an app can be running at once" rule only
applies to apps launched by LaunchServices; so if you start one
yourself via exec or NSTask, and then something goes through the
normal launch mechanism (in this case AppleScript), a second copy
will be launched.
It would be better if you used NSWorkspace to launch your app. Or
for more control, you can call LaunchServices directly.
—Jens_______________________________________________
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
_______________________________________________
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
_______________________________________________
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