• 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
Make a Service AppleScriptable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make a Service AppleScriptable


  • Subject: Make a Service AppleScriptable
  • From: "Dr. Jan-Hendrik Dörner" <email@hidden>
  • Date: Mon, 25 Apr 2005 09:07:20 +0200

Hi,
being a good MacOSX citizen, I would like my service (comparable to Apples SimpleService found in /Developer/Examples/AppKit/SimpleService) to be AppleScriptable useing a .sdef - file. The problem I am faceing here is that I do not know how to set the delegate to my controller object, incase of the Apple Example, the "serviceProvider" object (of the ServiceTest -class). In case of a "normal" App, I would simply use InterfaceBuilder to set the delegate, but since the service is faceless, there is no nib-file in my project and I like it to be left it that way. So I guess, I need a way on how to set the delegate by hand. How can this be done?


Regards,
Jan-Hendrik

Am 22.04.2005 um 19:00 schrieb email@hidden:

Send Cocoa-dev mailing list submissions to
	email@hidden

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.apple.com/mailman/listinfo/cocoa-dev
or, via email, send a message with subject or body 'help' to
	email@hidden

You can reach the person managing the list at
	email@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Cocoa-dev digest..."


Today's Topics:

   1. Re: #define issues (Michael Rothwell)
   2. NSNetServiceBrowser / NSNetService Hostname Lookup (Adam)
   3. Custom NSMenu help (Rakka)
   4. iconForFile for folders/volumes (Rakka)
   5. Re: Printing issues (Frank Fenn)
   6. Re: Memory management with nibs (Julien Palmas)
   7. subversion support in XCode? (Lloyd Dupont)
   8. Re: Memory management with nibs (j o a r)
   9. Re: matching single key/value pair to dictionary (Steven Spencer)
  10. Objective-C++ and overloading and inheritance of static
      member	functions (Jiri Volejnik)
  11. Re: Memory management with nibs (Ondra Cada)
  12. Re: Printing issues (Andrew Kinnie)
  13. Re: subversion support in XCode? (Darkshadow)
  14. Re: NSNetServiceBrowser / NSNetService Hostname Lookup
      (Marc Krochmal)
  15. Re: NSNetServiceBrowser / NSNetService Hostname Lookup
      (Nicko van Someren)


----------------------------------------------------------------------

Message: 1
Date: Thu, 21 Apr 2005 22:37:54 -0400
From: Michael Rothwell <email@hidden>
Subject: Re: #define issues
To: Cameron Hayne <email@hidden>
Cc: CocoaDev list <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset="us-ascii"

More parentheses!

#define SET_ENTRY( (m),(r),(c),(e)) (m[(r)*4+(c)] = (e))


Michael Rothwell
email@hidden

On Apr 17, 2005, at 12:47 AM, Cameron Hayne wrote:

On 4/16/05 6:58 AM, "Aaron Boothello" <email@hidden> wrote:

typedef double matrix[16];
#define SET_ENTRY(m,r,c,e) (m[r*4+c] = e)

the 'macro' is called as follows (example):
SET_ENTRY(ret,1,1,4.5); //where ret is of type matrix

error generated is:incompatible types in assignment.

Well, there is nothing wrong in principle with this code. I can compile and run the following program with no problem using gcc 3.3: ------------------------- #include <stdio.h> typedef double matrix[16]; #define SET_ENTRY(m,r,c,e) (m[r*4+c] = e) matrix ret; int main() { SET_ENTRY(ret,1,1,4.5); printf("value set was %f\n", ret[5]); return 0; } -------------------------

So probably your problem is due to something else sneaking in there and
redefining "matrix" or something.
In any case, the standard way to debug a problem with the preprocessor
is to
look at the C code after the preprocessor has done its thing.
E.g. via 'gcc -E'
It is usually obvious what is causing the trouble once you do that.

-- Cameron Hayne (email@hidden)
Hayne of Tintagel


  _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2383 bytes
Desc: not available
Url : http://lists.apple.com/pipermail/cocoa-dev/attachments/20050421/ 92842163/smime.bin


------------------------------

Message: 2
Date: Thu, 21 Apr 2005 23:01:45 -0400
From: Adam <email@hidden>
Subject: NSNetServiceBrowser / NSNetService Hostname Lookup
To: Cocoa Apple <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed

I read about NSNetServiceBrowser and I wrote a small app that could
detect the rendezvous / bonjour iTunes sharing service on the network
using NSNetServiceBrowser and NSNetService with a service type of
_daap._tcp.

NSNetService returns a struct sockaddr that has the IP address and the
port of the machine broadcasting the service. However, I would also
like to get the hostname / Computer Name of the machine broadcasting
this service. How could I obtain this info?


Thanks, Adam



------------------------------

Message: 3
Date: Thu, 21 Apr 2005 22:08:54 +1000
From: Rakka <email@hidden>
Subject: Custom NSMenu help
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed

Hi,

Could anyone explain to me step by step (or provide a link) how I could
give an NSMenu a custom look? (e.g if I wanted to put a textfield or
button onto it). I've found a couple of articles on custom views but I
just don't get them yet. If someone could show me an example it'd be
really helpful.

Regards,


Rakka



------------------------------

Message: 4
Date: Fri, 22 Apr 2005 14:54:55 +1000
From: Rakka <email@hidden>
Subject: iconForFile for folders/volumes
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed

Hi,

Is there simple way to get a folder's icon, like iconForFile: does for
files? I tried iconForFile with a folder (or actually, a volume), and
it just doesn't work. Or am I doing something wrong? The following
doesn't work for folders and volumes, but only works with files (e.g
pdf, jpg, etc.)

NSImage *volumeIcon = [[NSWorkspace sharedWorkspace]
iconForFile:@"/Volumes/TheDisk"];

Thanks.

Regards,

Rakka



------------------------------

Message: 5
Date: Fri, 22 Apr 2005 00:49:41 -0600
From: Frank Fenn <email@hidden>
Subject: Re: Printing issues
To: Andrew Kinnie <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset="windows-1252"

Hi Andrew,

Second, I also hand coded the paper size, because I can't figure out
how to determine the available paper sizes for a particular printer.
Is there a way to do this?

NSPrinter

pageSizeForPaper:

- (NSSize)pageSizeForPaper:(NSString *)paperName
Returns the size of the page for the paper type paperName. Possible
values for paperName are contained in the printer’s PPD file. Typical
values are Letter and Legal. Returns a zero size if paperName is not
recognized, or its entry in the PPD cannot be parsed.

Sincerely,
Frank Fenn

--

Bright Light Software - http://www.brightlightsoftware.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1233 bytes
Desc: not available
Url : http://lists.apple.com/pipermail/cocoa-dev/attachments/20050422/ 9c37cf11/attachment.bin


------------------------------

Message: 6
Date: Fri, 22 Apr 2005 15:44:52 +0900
From: Julien Palmas <email@hidden>
Subject: Re: Memory management with nibs
To: Ondra Cada <email@hidden>
Cc: Cocoa-Dev List <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=UTF-8; format=flowed

The nib handling abilities of a NSWindowController are pretty
attractive and I would like to use a sub-class of it. Still, I only
need one window per document and each different nib, like I said
before, would only be there to provide other views.

Would it be bad to add a window inside each nib, just in order to use a
sub-class of NSWindowController as its owner ? even if I completely
don't care about this window ?

On Apr 22, 2005, at 10:35 AM, Ondra Cada wrote:

Julien,

On 22.4.2005, at 2:26, Julien Palmas wrote:

But I also have other nibs, one for each different piece of
information present in the document. Let's say there are 50 different
nibs, being able to load only 2 of them if necessary is much more
efficient that always loading the 50 !!!

Definitely.

My question is about the file owner for those nibs. What class (sub
class) should I use.

Some controller, appropriate by the app design. If the NIBs contain separate windows, an NSWindowController subclass looks kind of interesting ;) Otherwise, for separate views and similar, probably the controller of the window into which the NIB objects are to be placed, or something alike.

I don't want to make the NSDocument the file owner. And what should I
do to make sure those nibs are correctly released once the document
closed?

The simplest way: ensure releasing root-level NIB objects yourself. The best way probably is to do that from whatever controller is the NIB owner. Just don't forget to have an outlet for each root-level object, and release the outlet when the controller itself goes poof. Alternatively, for windows, you can just tell them to release when closed (in IB Inspector).

There are tricks to do that semi-automatically, but generally they are
not worth the hassle. See 10.3 NSNib for the easiest one (at least,
far as I know) via instantiateNibWithOwner:topLevelObjects:.
---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc




------------------------------

Message: 7
Date: Fri, 22 Apr 2005 17:07:48 +1000
From: "Lloyd Dupont" <email@hidden>
Subject: subversion support in XCode?
To: <email@hidden>
Message-ID: <000701c54709$feb06ce0$6400a8c0@GIDEON>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
	reply-type=original

I'm running a beta version of 10.4 and I'm using XCode
I'm trying to use Subversion but it doesn't seems to be integrated with the
SCM menu of XCode..


Any reason for that?  Am I missing something? Any lead or pointers?
thanks!



------------------------------

Message: 8
Date: Fri, 22 Apr 2005 09:22:36 +0200
From: j o a r <email@hidden>
Subject: Re: Memory management with nibs
To: Julien Palmas <email@hidden>
Cc: Cocoa-Dev List <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset="us-ascii"


On 2005-04-22, at 08.44, Julien Palmas wrote:

The nib handling abilities of a NSWindowController are pretty
attractive and I would like to use a sub-class of it. Still, I only
need one window per document and each different nib, like I said
before, would only be there to provide other views.

Would it be bad to add a window inside each nib, just in order to use
a sub-class of NSWindowController as its owner ? even if I completely
don't care about this window ?

It seems to me that you think too much about this. What is the problem? If you load a nib file, you need to release all top level objects in the nib file (unless the files owner is a subclass of a class that provides that functionality automagically, like NSWindowController). It's dead simple. Just do it in your nib loading classes.

@interface MyNibLoader : NSObject
{
	@private

	IBOutlet NSView *myView; // Top level item in nib file
	IBOutlet NSView *mySubview;
}

@end

@implementation MyNibLoader

- (void) dealloc
{
	[myView release]; // Top level item in nib file

	[super dealloc];
}

@end

You will have to learn how to release the other instance variables of
your objects anyway, so what's the big difference with learning to
remember to release the appropriate IBOutlets?

I don't think you should use a NSWindowController subclass in this
case, as it's designed with something else in mind. And it would
definitively be both bad, and completely unnecessary, to add a dummy
window to the nib file if you do choose this path.

Perhaps Apple should add a NSNibController class, that you could use as
the superclass of objects that loads a single nib file? The only
functionality this class would need to provide is the automatic
deallocation of top level nib objects, much as NSWindowController does.
Would be kind of neat.

j o a r

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2380 bytes
Desc: not available
Url : http://lists.apple.com/pipermail/cocoa-dev/attachments/20050422/ ce65f88a/smime.bin


------------------------------

Message: 9
Date: Fri, 22 Apr 2005 09:58:17 +0100
From: Steven Spencer <email@hidden>
Subject: Re: matching single key/value pair to dictionary
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=ISO-8859-1

Try this (typed in email)

NSMutableArray *arr = [NSArray array];
NSEnumerator *enm = [myMutableArray objectEnumerator];
NSMutableDictionary *dc;

while (dc = [enm nextObject]) {
  if ([[dc objectForKey:myKey] isEqual:myValue])
    [arr addObject:dc];
}

[myMutableArray removeObjectsInArray:arr];


- Steve


Message: 7
Date: Thu, 21 Apr 2005 17:54:18 -0500
From: Sandeep Parikh <email@hidden>
Subject: matching single key/value pair to dictionary
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

I've got an NSMutableArray wherein every object is an
NSMutableDictionary.  I would like to remove any NSMutableDictionary
that contains (among other things) a given single key/value pair.

Is there an existing class/method that will let me accomplish this?
I looked into using NSArray's makeObjectsPerformSelector but it
didn't seem to fit my needs exactly.

thanks!
-Sandeep



------------------------------

Message: 10
Date: Fri, 22 Apr 2005 12:17:33 +0200
From: Jiri Volejnik <email@hidden>
Subject: Objective-C++ and overloading and inheritance of static
	member	functions
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed

The above to me seems comparable to:
	http://www.research.att.com/~bs/bs_faq2.html#overloadderived
The only difference is the use of static members.  However, when I
attempt
to use B::f, I am told that it doesn't exist and the options are the
two
functions in A::f.

In Bjarne's example, B is derived from A.

-- Jirka



------------------------------

Message: 11
Date: Fri, 22 Apr 2005 12:30:17 +0200
From: Ondra Cada <email@hidden>
Subject: Re: Memory management with nibs
To: j o a r <email@hidden>
Cc: Cocoa-Dev List <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=ISO-8859-2; format=flowed

J o a r,

On 22.4.2005, at 9:22, j o a r wrote:

Perhaps Apple should add a NSNibController class, that you could use
as the superclass of objects that loads a single nib file? The only
functionality this class would need to provide is the automatic
deallocation of top level nib objects, much as NSWindowController
does. Would be kind of neat.

In my personal and highly subjective opinion, with the services of NSNib already available, the class would be too simple to have a real raison'd etre. Anyway, you can make one yourself in no time flat, if need be.

A propos of loaded views: presumed they are loaded once, added to some
view hieararchy, and not switched in/out later, the following pattern
might be slightly more convenient:

...
IBOutlet MyView *loadedView;
...
[NSBundle loadNibNamed:"MyNIBWithView" owner:self];
[parentView addSubview:loadedView];
[loadedView release]; // retained by the parent view

without a need to take care anymore, for the view will be released when
the whole window gets dealloc'd.
---
Ondra Èada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc



------------------------------

Message: 12
Date: Fri, 22 Apr 2005 06:42:45 -0400
From: Andrew Kinnie <email@hidden>
Subject: Re: Printing issues
To: Frank Fenn <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset="windows-1252"

Yeah, I found that one, but that doesn't help me get the available
paper sizes for a given printer, because I need to know the name of the
paper in order to use the method.  For Letter and Legal, that is fine,
but I won't know what different receipt printer manufacturers may be
calling their custom receipt page sizes.

Also, apparently it relies on what is in the PPD file, and it doesn't
appear that Star Micronics (for example) has a PPD file for its printer
(the one I am testing on).  At least nothing showed when I did a global
search for file names containing ppd after installing the drivers.

I can only assume this is why when I hard coded the name of the receipt
paper into the app, and tried to use this method, it returned nil.

I'm hoping I can do this so I won't need to change to code every time a
new receipt printer is released by someone.  That would seem rather
irrational to me.

On Apr 21, 2005, at 10:56 PM, Frank Fenn wrote:

Hi Andrew,

Second, I also hand coded the paper size, because I can't figure out
how to determine the available paper sizes for a particular printer.
Is there a way to do this?

NSPrinter

pageSizeForPaper:

- (NSSize)pageSizeForPaper:(NSString *)paperName
Returns the size of the page for the paper type paperName. Possible
values for paperName are contained in the printer’s PPD file. Typical
values are Letter and Legal. Returns a zero size if paperName is not
recognized, or its entry in the PPD cannot be parsed.

Sincerely,
Frank Fenn

--

Bright Light Software - http://www.brightlightsoftware.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2210 bytes
Desc: not available
Url : http://lists.apple.com/pipermail/cocoa-dev/attachments/20050422/ 04e2c967/attachment.bin


------------------------------

Message: 13
Date: Fri, 22 Apr 2005 07:27:28 -0400
From: Darkshadow <email@hidden>
Subject: Re: subversion support in XCode?
To: Lloyd Dupont <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed


On Apr 22, 2005, at 3:07 AM, Lloyd Dupont wrote:

I'm running a beta version of 10.4 and I'm using XCode
I'm trying to use Subversion but it doesn't seems to be integrated
with the SCM menu of XCode..

Any reason for that?  Am I missing something? Any lead or pointers?
thanks!


That's still under NDA until the 29th....

Darkshadow (aka Michael Nickerson)



------------------------------

Message: 14
Date: Fri, 22 Apr 2005 09:44:56 -0700
From: Marc Krochmal <email@hidden>
Subject: Re: NSNetServiceBrowser / NSNetService Hostname Lookup
To: Adam <email@hidden>
Cc: Cocoa Apple <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Hi Adam,

On Apr 21, 2005, at 8:01 PM, Adam wrote:

I read about NSNetServiceBrowser and I wrote a small app that could
detect the rendezvous / bonjour iTunes sharing service on the
network using NSNetServiceBrowser and NSNetService with a service
type of _daap._tcp.

NSNetService returns a struct sockaddr that has the IP address and
the port of the machine broadcasting the service. However, I would
also like to get the hostname / Computer Name of the machine
broadcasting this service. How could I obtain this info?

There's no easy way to retrieve the Computer Name of the service, but starting in Tiger, you'll be able to get the hostname after resolving the service by using the new NSNetService "hostName" method. If you need to get the hostname in Panther, then you'll need to use DNSServiceResolve() located in /usr/include/dns_sd.h.

-Marc


------------------------------

Message: 15
Date: Fri, 22 Apr 2005 17:57:41 +0100
From: Nicko van Someren <email@hidden>
Subject: Re: NSNetServiceBrowser / NSNetService Hostname Lookup
To: Marc Krochmal <email@hidden>
Cc: Cocoa Apple <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed

On 22 Apr 2005, at 17:44, Marc Krochmal wrote:

On Apr 21, 2005, at 8:01 PM, Adam wrote:

I read about NSNetServiceBrowser and I wrote a small app that could
detect the rendezvous / bonjour iTunes sharing service on the network
using NSNetServiceBrowser and NSNetService with a service type of
_daap._tcp.

NSNetService returns a struct sockaddr that has the IP address and
the port of the machine broadcasting the service. However, I would
also like to get the hostname / Computer Name of the machine
broadcasting this service. How could I obtain this info?

There's no easy way to retrieve the Computer Name of the service, but starting in Tiger, you'll be able to get the hostname after resolving the service by using the new NSNetService "hostName" method. If you need to get the hostname in Panther, then you'll need to use DNSServiceResolve() located in /usr/include/dns_sd.h.

Since an Apple employee has set the precedent, does this mean we are now allowed to discuss the API extensions to 10.4? It's surely in Apple's interest for as many of us as possible to be able to support Tiger sooner rather than later.

	Nicko



------------------------------

_______________________________________________
Cocoa-dev mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/cocoa-dev

End of Cocoa-dev Digest, Vol 2, Issue 560
*****************************************

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Setting a blank ("") argument in NSTask
  • Next by Date: Re: iTunes Radio Tuner
  • Previous by thread: Binding an NSMenuItem in an NSPopUpButton
  • Next by thread: NSFileModificationDate after 2039
  • Index(es):
    • Date
    • Thread