Help with Macintosh programming

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

Archive for July, 2012

applescript OS 9 help

Hi

I already found how to write to a file!  But I can not find how to put
carriage return in it!

this is how I write to some file:

try
        open for access file myFile with write permission
        write "Hello world!" to file myFile starting at eof
        close access file myFile
on error myError
        try
                close access file myFile
        on error
        end try
        display dialog myError
end tryNow if I want to put a next sentence on a different line, how do I do
this????Maybe another question , where can I find good information/examples
about applescript for OS9???tnxsteven

.
posted by admin in Uncategorized and have Comment (1)

Please Help. G3 B&W won't boot up from any external scsi HDD.

Hi All
Anyone in the group know of a fix to my problem???
I am unable to boot-up my G3 B&W from any external SCSI HDD.
The ext. HDD’s icon mounts on the desktop when not used as a boot up drive.
However when the HDD is forced as a boot up drive, the G3 will not start up
at all. (SCSI ID and termination are all OK)
I have tried several HDDs and it’s the same with all of them.
With the same configuration the same HDD boots up successfully from my older
beige Apple but not from the G3!
I am beginning to suspect it could be a software driver problem.

Hardware is a G3 Blue & White (OS9.2.2) with an Advansys PCI SCSI card "ASB
3940ua Rev.2" All external HDDs have OS8.6.
Can anyone suggest what I should check?
Any help appreciated.
Thanks
Jerry

posted by admin in Uncategorized and have Comments (2)

Playing .aiff sound files?

Hi folks, that pretty well says it all.

Under OS9 we can play the system sounds by loading ‘snd ‘
resources and call SndPlay.  Easy.  But under OSX the system
sounds are all .aiff files, and the Carbon doco seems to tell
me that I’m supposed to use QuickTime and open and play them
as Movies.  

Well that seems a bit long winded, but I carried on anyway, and
called OpenMovieFile(), then NewMovieFromDataFork().  At that
point I got error -2048 meaning there’s no movie in the file.

Now the data is definitely in the data fork, so basically
I did what I was told, and got into trouble.  Surely there’s
an easier way?

Cheers,  Mike.

—————————————————————-
            Mike Hore        mikeh…@octa4.net.au
—————————————————————-

posted by admin in Uncategorized and have Comments (3)

character encoding for system() parameter

In <stdlib.h> there is the function:
   int system(const char *string);

I’d like to use it to do the following:
 system ("rm /path/to/japanesefile")

But I’m guessing that system() is expecting an ASCII string.  Is that
so?  IAC, how does one pass non-ASCII characters to functions like
system() (or others like AuthorizationExecuteWithPrivileges)?

Thanks!

posted by admin in Uncategorized and have Comments (3)

Heap Scrambler on OS X?

Hello,

I used to use Macsbug to scramble the heap to detect any possible memory
problems. How can I do this under OS X or isn’t that necessary anymore?

Regards,

Robbie

posted by admin in Uncategorized and have Comments (3)

OT: Theory of Microkernel and VPC

Hello.
I am reading a book about softwarearchitecture with patterns.

Here is something I don’t understand:

As far as I know, OS X is a microkernel architecture.

But microkernel is easily (well) extendable. One can abstract system
services to that point that even the layer of a different OS is
implementable; Applications of that OS see only that layer and can call
API of that layer; the API of that foreign OS will then be translated
and passed to the microkern which in turn executes this API call in the
original OS.

Say: I have a Windows application which runs becourse each call to a
Windows API is translated from an external server (part of the
microkernel) and passed to the microkern which executes the demands in
Mac OS. To have a Windows binary running one just has to extend the
microkernel with corresponding internal and external server and an
adapter.

My question is: Why isn’t Virtual PC just extending Mac OS with those
components? As far as I know, VPC is an emulator which encapsulates and
runs Windows without taking care about microkernel.

I know this is very academic but I want to understand the microkernel
pattern in the book by Buschmann et al "Pattern orientierte Software
Architektur"  (which is shure available in english, too).

Thanks for enlighten me,
Robert


The Adress m…@privacy.net is against spammers
and goes directly into the bin.
To contact me privately reverse and use
ed.xmg@xuniLtrebor

posted by admin in Uncategorized and have Comments (6)

pthread_create and Carbon App

    Hello,

    I have loaded the system.framework from a Carbon App. Now, I would like to create a thread using the pthread_create function. I
would like to know if this is legal to pass an Carbon function pointer to pthread_create and more generally to Mach-O code ?

David

posted by admin in Uncategorized and have No Comments

Modeless Dialog Box memory allocation?

Apple recommend that for Modeless Dialog Boxes the dstorage parameter in
GetNewDialog should be pointer to your own provide memory, but then every
example given seems to have this set to NIL.

I’ve got several large Modeless Dialogs with a lot of editable text fields
all loaded from resources. How to I determine the size of storage to
provide?

posted by admin in Uncategorized and have Comments (3)

Help: NSPopUpButton problems…

Hi,

I’m having some odd problems with an NSPopUpButton. It doesn’t seem to
respond to any messages/method calls. I have another NSPopUpButton
that, as far as I can see, is created and reference exactly the same.
However one responds to things such as removeAllItems,
indexOfSelectedItem  or addItemsWithTitles: and the other doesn’t…

does anyone have any debugging tips that could help me resolve this.
(I’m not at my machine at the moment so I can’t include the relevant
code.)

An outline of what I do is:

1) created NSPopUpButton with Interface builder.
2) Wired it to the controller obj as an outlet
2) Wired it to a method in the controller obj;
3) add items to it in the awake from nib method…works fine
4) try to remove items and add new/different ones when another method
is called…this doesn’t work
5) tear my hair out when it doesn’t work….

thanks for any help you can provide

Tom

posted by admin in Uncategorized and have No Comments

Sending AppleEvents to a MacOS X daemon process?

Hi all,

I’m trying to send AppleEvents to a MacOS X process that runs without
talking to the WindowServer: it has no UI, does not link to Carbon (it
uses ApplicationServices), and handles its AppleEvents using
::AEGetRegisteredMachPort() and mach_msg_server with a callback which
dispatches the events to ::AEProcessMessage. This is all specifically
provided, the docs say, so daemons can use AppleEvents. Except I can’t
make it work.

If I can get its PSN (Carbon process serial number), I can talk to it.
The problem is that it isn’t Carbon. If I have it attempt to report
its own PSN using GetCurrentProcess, it attempts to connect to the
WindowServer. Not what I want.

I’ve tried to use Apple’s example in QA 1123, "Getting a List of All
Processes on Mac OS X." I have a program that will find the BSD
process ID by name. The note says "You can map between BSD process IDs
and Process Serial Numbers using the routines GetProcessID and
GetProcessForPID routines declared in "Processes.h"". This works for
some processes, like ProjectBuilder, but for others, it fails: I get
an error -600.

I haven’t seen anything on how I can create an address an AppleEvent
any way other than Carbon PSN or signature. Is there another way?

I was thinking of trying to forcibly stuff an AppleEvent into a Mach
message and send it directly that way. Apple’s docs all encourage use
of the AppleEvent APIs over doing Mach messaging directly, but I don’t
see an example of trying to send an AppleEvent this way.

In a related note, my little server app doesn’t work right if I have
it call daemon(0, 0). It uses a timer and gets some CPU time that way;
if I call daemon(0, 0) it appears to terminate like I expect (it has
detached). It is still shown by ps -aux and top, but its CPU
utilization remains firmly at zero: it is no longer processing timer
events, it appears, and does not seem to complete certain function
calls it supposedly comleted before the call to daemon()… ?

Thanks for any suggestions,

Paul

posted by admin in Uncategorized and have Comments (3)