finder

Can you implement OS X's Finder download progress bars from a shell script?

青春壹個敷衍的年華 提交于 2019-12-13 01:29:35
问题 At first I thought this might be some variation on the extended attributes that can be modified with the xattr command line tool. However, I've staged several tests, and the files don't seem to have any special attributes while in this mode. Is this accessible at all from the command line, or is it only possible from within some cocoa api? 回答1: If you don't mind scripting with swift: #!/usr/bin/env swift import Foundation let path = ProcessInfo.processInfo.environment["HOME"]! + "/Downloads/a

Changing Python path under Mac OS for applications other than the terminal

笑着哭i 提交于 2019-12-13 00:07:53
问题 I have a Python script that I'd like to be able to run with a minimum of fuss from the Finder or Quicksilver. Unfortunately, any way of running the script that doesn't use the terminal can't find my libraries. For example, running do shell script "~/anaconda/bin/python -c 'import sys; print len(sys.path)'" from Applescript gives a value of 13, but running ~/anaconda/bin/python -c 'import sys; print len(sys.path)' from the terminal gives 15. This makes me think that .bash_profile may not be

Finder Plugin in Snow Leopard

本小妞迷上赌 提交于 2019-12-12 17:50:29
问题 Since the Finder in Snow Leopard has been rewritten to use Cocoa instead of Carbon, I'd like to know if there's a new API to write Finder plugins. The old way involved writing a CFPlugin but this doesn't seem to work anymore. 回答1: If by plug-in you mean contextual menu, you can do this via the services API. 回答2: I believe they prefer that you write Services instead of Finder plugins now. 来源: https://stackoverflow.com/questions/1651075/finder-plugin-in-snow-leopard

Applescript Finder path into POSIX path

泪湿孤枕 提交于 2019-12-12 10:17:09
问题 I'm running the following applescript: tell application "Finder" set input to POSIX file "/Users/sam/Desktop/Resized" set theFiles to (every file of folder input whose name does not contain "- Resized") end tell return theFiles It's working as it should, though it's returning: {document file "HighResCat.jpg" of folder "Resized" of folder "Desktop" of folder "sam" of folder "Users" of startup disk of application "Finder", document file "madonna.jpg" of folder "Resized" of folder "Desktop" of

Applescript - move files to folder which name begins with first 7 characters of filename

跟風遠走 提交于 2019-12-12 04:06:20
问题 I've got 2 folders the first folder contains all the files which I'd like to move to a subfolder of the second folder. I'd like to this based on the first 7 characters of both the file & folder names. So if the first 7 characters of the subfolder in FOLDER 2 matches the first 7 characters of the file in FOLDER 1. The file get's moved into the subfolder of FOLDER 2 Right now I've got an Applescript which works, but it's terribly slow. Here's the script so far: set mgFileList to "" set

OSX - Detect when Finder is started

余生颓废 提交于 2019-12-12 02:35:08
问题 How can my app know that Finder has started? Is there any event that could help with this? I thought about enumerating processes and look for Finder but this seems too heavy to do every X seconds. Is there any other way? 回答1: You can observe the notifications that NSWorkspace posts to its notification center ( -[NSWorkspace notificationCenter] ). For example, it posts NSWorkspaceDidLaunchApplicationNotification when a GUI app is launched. That notification's userInfo dictionary has, under the

App won't write to file when run from Finder (ok in Xcode)

梦想的初衷 提交于 2019-12-12 02:06:20
问题 I have created an osx app that runs perfectly in Xcode but not from Finder window. It reads a binary data file and outputs two simple text files and displays some graphics. Since it works in Xcode, I copy the app file to say Applications directory along with the binary input file. The binary file can be read okay. The two text files cannot be opened for writing (permission denied) and so the program exits. When run from Xcode, there is no problem writing the two text files in the Applications

Change Finder folder background color AppleScript

安稳与你 提交于 2019-12-12 01:27:08
问题 I'm trying to change the background color of Finder within a repeat loop. tell application "Finder" set windowCount to (count windows) if windowCount > 0 then #check if windows are available set bgcolor to {65535, 0, 32896} repeat 10 times tell the icon view options of window 1 set the background color to {some item of bgcolor, some item of bgcolor, some item of bgcolor} delay 0.1 end tell end repeat end if end tell I know I'm missing something simple here. I got it to work in other contexts

OSXFuse - How to distinguish open file from preview in Finder

心不动则不痛 提交于 2019-12-11 09:15:11
问题 I'm using OSXFuse https://osxfuse.github.io/ And wanted to know if I can tell apart the following operations: File is opened by the user File is previewed in Finder My problem is that for both cases readFileAtPath is called, and seemingly with the same parameters. 回答1: Apparently this cannot be done using the simple API, as read is read no matter who requests it. But that's the point, if you could identify who requested to read, you could block it for some processes. Using Fuse's C api, you

Why copy and paste in finder doesn't work when I use RegisterEventHotKey (Cocoa)?

a 夏天 提交于 2019-12-11 07:44:05
问题 I use function RegisterEventHotKey() and when I try registering Cmd + C or Cmd + V, I notice that copy and paste in finder doesn't work. I insert parameter inOptions = 0 to function RegisterEventHotKey() so it should non-exclusiv but why finder seem not to receive this hot key? EventTypeSpec eventType; eventType.eventClass=kEventClassKeyboard; eventType.eventKind=kEventHotKeyPressed; InstallApplicationEventHandler(&MyHotKeyHandler,1,&eventType,(void *)self,NULL); EventHotKeyID gMyHotKeyID;