finder

Differences between running OSX App from Finder versus Xcode?

与世无争的帅哥 提交于 2019-12-02 07:51:34
问题 Differences between running OSX App from Finder versus Xcode ??? System is iMac 27” all-in-1 running Mavericks OSX 10.9.5 and latest Xcode 6.0.1 The App reads a binary file and writes two text files, may re-write the binary file, and draws in a window client area. App totally runs in Xcode. App, binary file and two text files are in ~/Debug or ~/Release directory. No problem writing to files. File i/o code does this… std::fstream out( binary_file, std::ios::in|std::ios::binary); if ( out )

Grails using dynamic finders with 3x+ logical arguments

偶尔善良 提交于 2019-12-01 21:08:22
I sucessfully managed to search in the database using this dynamic finder from Hibernate: def temp = User.findByNameAndStreet("name", "street") Although, i need a tripple logical argument like this: def temp = User.findByNameAndStreetAndCity("name", "street", "city") Any simple way to do it ? The Grails dynamic finders don't support more than two predicates. This is because it's not clear whether User.findByNameAndAgeOrGender('foo', 12, 'm') means this: (name == 'foo' && age == 12) || gender == 'm' or this: name == 'foo' && (age == 12 || gender == 'm') Admittedly if the predicates are always

OS X Finder Sync Extension

会有一股神秘感。 提交于 2019-12-01 09:36:45
I am not able to create a simple Finder Sync Extension. I have created a new OS X project and added the Finder Sync Extension target and I ran the extension attached to finder. The code appears to be running the init methods and the toolbar items methods are getting called but nothing is displaying in finder. The terminal is showing this when it runs 2015-04-20 12:45:52.700 pcssyncextension[3196:62451] Failed to connect (colorGridView) outlet from (NSApplication) to (NSColorPickerGridView): missing setter or instance variable 2015-04-20 12:45:52.701 pcssyncextension[3196:62451] Failed to

How to add comments in a file and/or directory programmatically?

萝らか妹 提交于 2019-12-01 07:12:29
问题 I am trying to add comment in files and directory programmatically. Is it possible to do? If yes, please help me to achieve this. I looked for a direct API from Cocoa framework but no success, I will be happy to do this by any way (cocoa, shell or any scripts). 回答1: I achieved this by Apple Script wrapped in Objective-C as : NSString *comment = @"hi boys"; NSOpenPanel *op = [NSOpenPanel new]; NSInteger answer = [op runModal]; if (answer == NSOKButton) { NSURL *url = [op URL]; NSMutableString

How do I create a Finder alias within an application?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 04:36:43
What is the code necessary to create a Finder alias from a Cocoa application? Are there any differences for that code between OS X 10.5, 10.6, and 10.7? Since OS X 10.6 you can use NSUrl 's writeBookmarkData:toURL:options:error: method From the documentation : Creates an alias file on disk at a specified location with specified bookmark data. Sample code: NSURL *originalUrl = [NSURL fileURLWithPath:@"/this/is/your/path"]; NSURL *aliasUrl = [NSURL fileURLWithPath:@"/your/alias/path"]; NSData *bookmarkData = [originalUrl bookmarkDataWithOptions: NSURLBookmarkCreationSuitableForBookmarkFile

Show folder's contents in finder using Swift

一世执手 提交于 2019-12-01 03:14:11
I want to be able to select a folder and show its contents in the Finder. I have managed to select the folder itself and select a file within the folder. But I don't know how to show the contents of an empty folder. e.g. Folder A/Folder B I want to display the contents of folder Folder B (which could be empty). I have written the following code: func showFolder(fileName : String) { var dataPath = homeDirectory.stringByAppendingPathComponent(fileName) var urlPath = NSURL(fileURLWithPath: dataPath) var selectedURLs = [urlPath!] NSWorkspace.sharedWorkspace().activateFileViewerSelectingURLs

How to relaunch finder application

匆匆过客 提交于 2019-12-01 01:13:55
I am using following applescript to relaunch finder application. osascript -e "tell application \"Finder\"" -e "delay 1" -e "try" -e "quit" -e "delay 1" -e "activate" -e "end try" -e "end tell" But sometimes this script is not relaunching finder application(only quiting finder application). i am not getting any error in console. http://www.cocoabuilder.com/archive/cocoa/113654-nsapplescript-buggy.html Can anyone please help me out? Here's an applescript way. You cannot rely on a specific delay time as you've seen. Therefore we manually wait for the Finder to quit by checking if it's in the

How to relaunch finder application

左心房为你撑大大i 提交于 2019-11-30 20:09:49
问题 I am using following applescript to relaunch finder application. osascript -e "tell application \"Finder\"" -e "delay 1" -e "try" -e "quit" -e "delay 1" -e "activate" -e "end try" -e "end tell" But sometimes this script is not relaunching finder application(only quiting finder application). i am not getting any error in console. http://www.cocoabuilder.com/archive/cocoa/113654-nsapplescript-buggy.html Can anyone please help me out? 回答1: Here's an applescript way. You cannot rely on a specific

Change Finder sidebar icon for folder

ぐ巨炮叔叔 提交于 2019-11-30 15:48:08
问题 There are some apps like DropBox that have their own icons in the Finder sidebar. Some other apps did that too. I've found the way to place my folder in the Finder favorites, but I'm not able to change the default icon. IconRef iconRef; FSRef fref; CFURLRef iconURLRef = (CFURLRef)[NSURL fileURLWithPath:@"icon"]; CFURLGetFSRef(iconURLRef, &fref); RegisterIconRefFromFSRef('SSBL', 'ssic', &fref, &iconRef); CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:path]; LSSharedFileListRef favoriteItems =

Change Finder sidebar icon for folder

流过昼夜 提交于 2019-11-30 15:15:52
There are some apps like DropBox that have their own icons in the Finder sidebar. Some other apps did that too. I've found the way to place my folder in the Finder favorites, but I'm not able to change the default icon. IconRef iconRef; FSRef fref; CFURLRef iconURLRef = (CFURLRef)[NSURL fileURLWithPath:@"icon"]; CFURLGetFSRef(iconURLRef, &fref); RegisterIconRefFromFSRef('SSBL', 'ssic', &fref, &iconRef); CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:path]; LSSharedFileListRef favoriteItems = LSSharedFileListCreate(NULL, kLSSharedFileListFavoriteItems, NULL); if (favoriteItems) {