• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bundle and window server interaction
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bundle and window server interaction


  • Subject: Re: Bundle and window server interaction
  • From: "email@hidden" <email@hidden>
  • Date: Mon, 18 Jan 2010 22:04:20 +0000

On 18 Jan 2010, at 15:55, has wrote:

> Dave Keck wrote:
>
>> That seems like a silly requirement for UI interaction...
>>
>> It seems you can get around it by making your app bundled and setting
>> the LSUIElement key in your Info.plist, though.
>
> Or use TransformProcessType to elevate your Unix style executable to GUI status:
>
> OSStatus err = 0;
> ProcessSerialNumber psn = {0, kCurrentProcess};
> err = TransformProcessType(& psn, kProcessTransformToForegroundApplication);
>
> (This is what rb-appscript calls the first time a standard GUI-less ruby process tries to display a Standard Additions dialog.)
>

Dave, Alastair, Has
Thanks a lot. I was unaware of the existence of TransformProcessType().
Definitely moving in the right direction now.
I agree that the bundle/windowserver connection is complicated by the presence of AppleScript.

LSUIElement does the trick for a bundled app but in this case I would like to call TransformProcessType only if and when necessary.

Has

Looking at rb-appscript I can see:

def method_missing(name, *args)
			begin
				super
			rescue Appscript::CommandError => e
				if e.to_i == -1713 # 'No user interaction allowed' error (e.g. user tried to send a 'display dialog' command to a non-GUI ruby process), so convert the target process to a full GUI process and try again
					AE.transform_process_to_foreground_application
					activate
					super
				else
					raise
				end
			end
		end

So the process is transformed only when error -1713 occurs.

Ideally I would like to examine my AppleScript for the presence of syso/dlog et al and transform it accordingly.
Searching has revealed that "a custom send proc" might be suitable.
Ignorance prevents me from proceeding further.
The goal is:

if my script aeDesc contains eventid:{dlog, aleR, chcl, chlt, chra, chur, disA, nwfl, ppcb, stdf, stfl)
	transform_process_to_foreground_application procee
end if

Sorry if we have departed a bit too far from Cocoa - we did start off there.
We can switch this to applescript-implementors if required.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com

> HTH
>
> has
> --
> Control AppleScriptable applications from Python, Ruby and ObjC:
> http://appscript.sourceforge.net
>

_______________________________________________

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

  • Follow-Ups:
    • Re: Bundle and window server interaction
      • From: has <email@hidden>
References: 
 >Re: Bundle and window server interaction (From: has <email@hidden>)

  • Prev by Date: Re: Use NSDocument as a variable of another NSDocument
  • Next by Date: Re: Use NSDocument as a variable of another NSDocument
  • Previous by thread: Re: Bundle and window server interaction
  • Next by thread: Re: Bundle and window server interaction
  • Index(es):
    • Date
    • Thread