Help with Macintosh programming

macintosh programming, mac programming, mac os programming, mac os x programming, mac programming language, mac programing

Archive for May, 2012

help controlling iTunes Import feature

Please excuse the cross-post to these groups, but my question seems to
span these three areas.

I’m trying to find a way to cause iTunes to import an XML library file
in an automated fashion.  The functionality is available in iTunes 3
from the File->Import… menu command.  But, that command doesn’t show
up in iTunes’ AppleScript dictionary.  Telling iTunes to Open the file
does nothing, and it won’t let you drop it onto the app icon or the
main window.

Can anyone think of a clever way to do this?

Thanks,
Jim

.
posted by admin in Uncategorized and have No Comments

Cocoa: setWindowFrameAutosaveName: not working

I’m trying to save document window positions using
setWindowFrameAutosaveName:. In my NSDocument subclass, I have:

- (void)windowControllerDidLoadNib:(NSWindowController*)aController {
    NSString* name;
    if(name = [[[self fileName] lastPathComponent]  
                        stringByDeletingPathExtension])
                        [aController setWindowFrameAutosaveName:name];
    [...]

}

This works fine. But the problem is that when the user creates a new
document, there’s no file name to use until that document is saved
(that’s what the check is there for), so you can’t set the name until
later. I can’t seem to do that.

When I try to use setWindowFrameAutosaveName: in the method doing the
saving (writeToFile:ofType:), it doesn’t work. There’s no error, and if
I check windowFrameAutosaveName I get the right name back, but nothing
ever gets saved. I’ve also tried using setWindowFrameAutosaveName:
from shouldCloseWindowController: and various other places, with
exactly the same results.

What am I doing wrong?


"The war on terror involves Saddam Hussein because of the nature of Saddam
Hussein, the history of Saddam Hussein, and his willingness to terrorize
himself."
                       -George W. Bush, Grand Rapids, Mich., Jan. 29, 2003

posted by admin in Uncategorized and have Comments (4)

launching problem on some Macs

Hi,

I have a Carbon app for OS X that launches fine on most
machines. But some users report that it bounces
once and then fails to launch. Previous versions work
on the problem machines.

I am at a loss as to why this might be. Any suggestions
about where to look would be appreciated.

I’m writing C++ under Project Builder.

TIA.

john elemans

posted by admin in Uncategorized and have Comment (1)

problem with NSTableView

Hello, I’m currently experiencing an error with my program which lead
to the following getting outputted to the console

2003-03-07 21:14:33.618 whisper[508] Application did finish launching.
2003-03-07 21:15:09.902 whisper[508] *** Assertion failure in
-[NSTableView _locationOfRow:], TableView.subproj/NSTableView.m:486
2003-03-07 21:15:10.028 whisper[508] NSInternalInconsistencyException

I haven’t actually been able to find the _locationOfRow: method in any
of Apple’s documentation or the web. I guess it must be a private call
to do with the way that the object renders itself to screen. So if any
of you know what this actually is so I can figure out what is going
wrong that would be very useful.

I’m programming in Python and bridging to Cocoa with the PyObjC module
(version 0.8). This NSTableView instance is pure Obj-C and was created
via Interface builder.

The error occurs when setting the datasource of the NSTableView object
using the following Python code.

self.knownEntitiesTable.setDataSource_(self.knownEntities)

self.knownEntities is a Python object that inheriting from NSObject
and implementing the informal NSTableDataSource protocol. At this
point it contains no data to display as I’m just setting the program
up at this point.

posted by admin in Uncategorized and have Comment (1)

Carbon: Toolbar for OS X and OS 9

Hi,

is the HIToolbox compatible to Mac OS 8 and 9, or is this a Mac OS X feature
only ?
I saw the sample for HIToolbox which comes with the developer tools but it
seems very complicated, isn’t there an easier way to just get a few toolbar
icons added to your app ?
Is there a way to use InterfaceBuilder to add a toolbar to a project ?

Dan

posted by admin in Uncategorized and have No Comments

std containers with malloc?

Hi.

Working on a Code Resource project, a plugin, using Carbon and an API for
working within a host application. Free-store memory must be allocated and
destroyed through specific API calls. APIAllocateMemory mimics std::malloc()
and APIFreeMemory mimics std::free().

I want to use std::vector and std::list (MSL), but can’t figure out how to
do so and still use the API memory handling calls.

One thought is to overload the new operator, but I don’t think that would
work in this case, and I’m not sure what else to do.

Any ideas?

Thank you.

Eric.

posted by admin in Uncategorized and have Comments (3)

Help: Mac SSH & OS X 10.2

I just bought a G4 w/ Jaguar OS 10.2.

I am logging into the UNIX machine at school
w/ Mac SSH…

I want to switch computers tomorrow
but really need to connect to the UNIX
terminal via my Mac .

Will I have any problems, if so
what could I do.

Is there a SSH software compatable w/
10.2


Thanks

Kevin Duggan

http://www.mp3.com/kevin_duggan

kevin_dug…@REMOVEstudent.uml.edu

posted by admin in Uncategorized and have Comments (2)

Porting a DLL from Microsoft Windows to OS X

Under Microsoft Windows I created a DLL that exports only the
functions that need to be public. Everything else is not shared, and
only used privately within the library.

I would like to create a library that acts similar to this under OS X.
From what I have found in my research Frameworks seem to act like
DLLs. Am I correct in that assumption? Is that the best method for
creating a dynamic library on OS X? Any pointers to information about
the different kinds of libaries available on OS X.

Thanks in advance for any help.

pat

posted by admin in Uncategorized and have No Comments

Page flipping on MacOS X

Hey

Is page flipping available on MacOS X? Seems it’s supported by
DrawSprockets, does it support MacOS X?

I am currently using DirectDisplay and draw directly to the framebuffer,
I don’t need any high level stuff like scaling, alpha, drawing
rectangles, clipping etc.

So, what I’d like to do is:

1. Acquire a pointer to an offscreen buffer,
2. Draw directly into it,
3. Wait for beam to reach the bottom of the screen,
4. Flip the buffer (not copy it)

The GameSprockets guide doesn’t actually explain how to obtain a pointer
to the buffer itself, seems you’ll need to dig into QuickDraw’s jungle
of structs… (haha) If there is another way I’ll prefer it, but anyways
DrawSprockets seems OK if it supports OS X (and if its page flipping on
OS X is not software emulation).

It’s a Cocoa app, but it doesn’t seem there’s any page flipping
available under Cocoa?

Per

posted by admin in Uncategorized and have Comments (3)

[Cocoa] Creating an NSImage+NSBitmapImageRep from scratch

I’m creating an NSImage from scratch, and am drawing in it with an
NSBezierPath. I managed to get an NSBitmapImageRep for it like so:

  NSImage *im;
  NSBitmapImageRep *rep;

  … create NSImage, draw in it …

  rep = [NSBitmapImageRep imageRepWithData: [im TIFFRepresentation]];

Is this really the way to do it? It seems a waste to first encode the
image as tiff data just to get a pixmap. Is there a better way?

Thanks,

Just

posted by admin in Uncategorized and have Comments (4)