[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Running a command using NSTask
From: |
Csanyi Pal |
Subject: |
Re: Running a command using NSTask |
Date: |
Sun, 21 Nov 2010 11:29:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Csanyi Pal <csanyipal@gmail.com> writes:
> I'm trying to run a command from my app using NSTask.
> Here is the part od the code:
>
> [code]
> - (void) DPbitSetReset: (id)sender
> {
> NSSound *DPbitReset = [NSSound soundNamed: @"DPbitReset.wav"];
> NSSound *DPbitSet = [NSSound soundNamed: @"DPbitSet.wav"];
>
> NSTask *DPSetBit0 = [[NSTask alloc] init];
> [DPSetBit0 setLaunchPath: @"/usr/local/bin/DPSetBit0"];
>
> // Whether the button state is 1 or 0?
> if ([sender state] == 1)
> {
> // Play the bit set sound
> [DPbitSet play];
>
> // Which bit to set on Data Port?
> switch ([sender tag])
> {
> case 110: // DPb0sr
> [DPSetBit0 launch];
> [DPSetBit0 release];
> [StatLine setStringValue: @"Write logical 1 to the data port bit
> 0."];
> break;
> case 111: // DPb1sr
> [StatLine setStringValue: @"Write logical 1 to the data port bit
> 1."];
> break;
> [/code]
>
> I can compile my app but when I run it and use this part of my app, that
> is when click on the button which has sender tag: 110, the statement
> [DPSetBit0 launch]; has no effect. Why?
>
> If I run from the commandline the command '/usr/local/bin/DPSetBit0'
> it works.
It works!
I forgot to install (sudo -E make install) my app after 'make'. :)
--
Regards, Paul Chany
<http://sourceforge.net/projects/lptinterface/>
<http://savannah.nongnu.org/projects/lpt-interface/>
<http://csanyi-pal.info>