Can someone show me how to copy a .icns to a folder?
I want to paste a special Icon on every folder which is created by my program.
How to copy Icon file to a folder?
How to copy Icon file to a folder?
macOS Catalina 10.15.7
Re: How to copy Icon file to a folder?
Do you really want to copy the file or do you want to set an icon for a directory ?
If you want to set an icon, take a look at the setIcon:forFile:options: method from the NSWorkspace class.
If you want to set an icon, take a look at the setIcon:forFile:options: method from the NSWorkspace class.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: How to copy Icon file to a folder?
But this use just one image and an .icns file includes different sizes.
Do you have any other idea?
Do you have any other idea?
macOS Catalina 10.15.7
Re: How to copy Icon file to a folder?
Are you sure ? It looks pretty good to meWolfram wrote:But this use just one image and an .icns file includes different sizes.
Code: Select all
Workspace = CocoaMessage(0, 0, "NSWorkspace sharedWorkspace")
Icon = CocoaMessage(0, CocoaMessage(0, 0, "NSImage alloc"), "initWithContentsOfFile:$", @"icon.icns")
CocoaMessage(0, Workspace, "setIcon:", Icon, "forFile:$", @"MyFolder", "options:", 0)
CocoaMessage(0, Icon, "release")
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: How to copy Icon file to a folder?
Yes, I'm sure.
For example: get info of the Preview.app and copy the icon shown on the top of the window. Open the Preview.app and press CMD + N.
You will see the icon in different sizes and resolutions (for retina and normal).
And that's exactly the code I need
Thanks!
For example: get info of the Preview.app and copy the icon shown on the top of the window. Open the Preview.app and press CMD + N.
You will see the icon in different sizes and resolutions (for retina and normal).
And that's exactly the code I need
Thanks!
macOS Catalina 10.15.7
Re: How to copy Icon file to a folder?
Works exactly the same when I try it (OSX 10.11.6).
If I copy the icon that my code has set for a folder and press Cmd + N in the preview app, it shows in all different sizes.
Are you sure your .icns file contains multiple images with different sizes ?
If I copy the icon that my code has set for a folder and press Cmd + N in the preview app, it shows in all different sizes.
Are you sure your .icns file contains multiple images with different sizes ?
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)