Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Changing DT w/o Carbon

Changing DT w/o Carbon
Thread Tools
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status: Offline
Reply With Quote
Jun 14, 2002, 04:49 PM
 
I am looking for a simple way to change the desktop image with cocoa. Right now I have my code set-up to change the image in com.apple.desktop.plist. Now I need the desktop to be set...I found this <a href="http://developer.apple.com/samplecode/Sample_Code/Cocoa/DeskPictAppDockMenu.htm" target="_blank">http://developer.apple.com/samplecode/Sample_Code/Cocoa/DeskPictAppDockMenu.htm</a>, but its pretty complex and I dont want to use carbon calls if I don't have to. Is this possible?
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Jun 14, 2002, 08:28 PM
 
sure, use an nstask to do something like "osascript -e 'tell application "Finder" to set the desktop picture to "Frunse:Users:sebictures:Hirn.tif"'" -- i left the path in there to show that you need to use colon separate paths. -- i actually once wrote a small app for myself that does nothing but periodically change the desktop background and this is exactly what i did.
     
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status: Offline
Reply With Quote
Jun 14, 2002, 09:32 PM
 
Thanks, Look!

<img src="http://idisk.mac.com/vasudeva1/Public/statusMenu.jpg" alt=" - " />
go away non-image
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Jun 15, 2002, 04:00 AM
 
haha, how funny. -- have a look:

<img src="http://homepage.mac.com/qe2/.Pictures/dt2.jpg" alt=" - " />

in "my" preferences is where you could set the desktop to rotate at a certain interval.

about the non-image, well, simply filter out everything beginning with ".", that way you're on the safe side as far as .fbc files and other stuff is concerned, as well.
     
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status: Offline
Reply With Quote
Jun 15, 2002, 06:33 AM
 
Very cool. Its such a good idea, I think I originally got the idea from you. I was reading an old post on NSStatusItem's.
     
Mac Enthusiast
Join Date: Jul 2000
Location: Dubai, UAE
Status: Offline
Reply With Quote
Jul 8, 2002, 12:35 AM
 
Where can I find sample code to add a new menu to the right side of the menu bar in X?

I'd like a program that sits in the menu bar and runs mostly as a background task, but has a set of prefs that can be adjusted via a menu such as those above.

Thanks,

Trygve
     
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Jul 8, 2002, 01:46 AM
 
<strong> </font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Trygve:
[qb]Where can I find sample code to add a new menu to the right side of the menu bar in X?

I'd like a program that sits in the menu bar and runs mostly as a background task, but has a set of prefs that can be adjusted via a menu such as those above.

Thanks,

Trygve</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Have a look at <a href="http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSStatusItem.html," target="_blank">http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSStatusItem.html,</a> <a href="http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSStatusBar.html" target="_blank">http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSStatusBar.html</a> and <a href="http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ProgrammingTopics/StatusBar/index.html." target="_blank">http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ProgrammingTopics/StatusBar/index.html.</a> It's really easy; just do something like this:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">NSStatusBar *bar;
NSStatusItem *item;

bar = [NSStatusBar systemStatusBar];
item = [bar statusItemWithLength:NSSquareStatusItemLength];

[item retain];

[item setHighlightMode:YES];
[item setMenu:someMenu];
[item setImage:[NSImage imageNamed:@&quot;PrettyImage&quot;]];</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Good luck .

<small>[ 07-08-2002, 02:54 AM: Message edited by: Ibson ]</small>
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:23 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2